baserCMS クラスリファレンス

BcThemeFileService
in package
implements BcThemeFileServiceInterface

BcThemeFileService

Table of Contents

Interfaces

BcThemeFileServiceInterface
BcThemeFileServiceInterface

Methods

getFullpath()  : string
fullpathを作成
assertWithinThemeDir()  : void
指定したパスがテーマ(プラグイン)ディレクトリ配下に収まっているか検証する
normalizePath()  : string
パスを正規化する(../ を解決する)

Methods

getFullpath()

fullpathを作成

public getFullpath(string $theme, string $plugin, string $type, string $path) : string
Parameters
$theme : string
$plugin : string
$type : string
$path : string
Tags
checked
noTodo
unitTest
Return values
string

assertWithinThemeDir()

指定したパスがテーマ(プラグイン)ディレクトリ配下に収まっているか検証する

protected assertWithinThemeDir(string $path) : void

パストラバーサル対策(GHSA-2pj4-v76f-wjvx)の最終防衛線。 Admin web 経路の create()/update() はリクエストの fullpath を直接書き込み先に使い getFullpath() の境界チェックを通らないため、実際の書き込み sink でも 「テーマ配置ルート(App::path('plugins'))配下」であることを必ず検証する。 配下でなければ BcException を投げる。

Parameters
$path : string

検証対象のパス(ファイル or ディレクトリ)

Tags
throws
BcException
checked
noTodo

normalizePath()

パスを正規化する(../ を解決する)

private normalizePath(string $path) : string
Parameters
$path : string
Return values
string
On this page

Search results