yii2-ueditor-widget
yii2-ueditor-widget copied to clipboard
UEditorAsset.php 将暴露 assets/php/ 内的文件
UEditorAsset
是 AssetBundle
类,默认情况下,当发布资源包时,所有在 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 权威指南-资源-资源选项