yii2-ueditor-widget icon indicating copy to clipboard operation
yii2-ueditor-widget copied to clipboard

UEditorAsset.php 将暴露 assets/php/ 内的文件

Open li-qs opened this issue 6 years ago • 0 comments

UEditorAssetAssetBundle 类,默认情况下,当发布资源包时,所有在 yii\web\AssetBundle::$sourcePath 目录里的内容都会发布。所以当前的写法将会把 assets/php/ 内的 .php 文件也一并发布到 @webroot/assets 里;加上关闭了 CSRF 校验,就很容易遭到攻击。

应该删除不需要发布的文件;或者在UEditorAsset.php 添加以下代码,以白名单的方式发布资源文件:

public $publishOptions = [
    'only' => [
        '*.js',
        '*.css',
        '*.gif',
        '*.png',
        '*.jpg',
        '*.html',
        '*.swf',
    ]
];

参考官方文档: Yii 2.0 权威指南-资源-资源选项

li-qs avatar Jan 18 '19 19:01 li-qs