Commit 6597b1f0 authored by Medicean's avatar Medicean

(Fix: FileManager) fix #153 (thx @ViCrack)

parent 4b932e81
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* 主窗口增加 CSP 策略 * 主窗口增加 CSP 策略
* Fix self-xss in database config #151 (thx @miaochiahao) * Fix self-xss in database config #151 (thx @miaochiahao)
* Fix #153 (thx @ViCrack)
## `v(2.0.7.2)` ## `v(2.0.7.2)`
......
...@@ -921,6 +921,7 @@ class PHP { ...@@ -921,6 +921,7 @@ class PHP {
// 获取配置 // 获取配置
const id = this.tree.getSelected().split('::')[1].split(":")[0]; const id = this.tree.getSelected().split('::')[1].split(":")[0];
let dbname = new Buffer(this.tree.getSelected().split('::')[1].split(":")[1],"base64").toString(); let dbname = new Buffer(this.tree.getSelected().split('::')[1].split(":")[1],"base64").toString();
// 已在 lang 中过滤
layer.confirm(LANG['form']['deldb']['confirm'](dbname), { layer.confirm(LANG['form']['deldb']['confirm'](dbname), {
icon: 2, shift: 6, icon: 2, shift: 6,
title: LANG['form']['deldb']['title'] title: LANG['form']['deldb']['title']
...@@ -1146,7 +1147,7 @@ class PHP { ...@@ -1146,7 +1147,7 @@ class PHP {
let tablename = new Buffer(treeselect.split('::')[1].split(":")[2],"base64").toString(); let tablename = new Buffer(treeselect.split('::')[1].split(":")[2],"base64").toString();
// const hash = (+new Date * Math.random()).toString(16).substr(2, 8); // const hash = (+new Date * Math.random()).toString(16).substr(2, 8);
layer.prompt({ layer.prompt({
value: tablename, value: antSword.noxss(tablename),
title: `<i class="fa fa-file-code-o"></i> ${LANG['form']['edittable']['title']}` title: `<i class="fa fa-file-code-o"></i> ${LANG['form']['edittable']['title']}`
},(value, i, e) => { },(value, i, e) => {
if(!value.match(/^[a-zA-Z0-9_]+$/)){ if(!value.match(/^[a-zA-Z0-9_]+$/)){
...@@ -1186,6 +1187,7 @@ class PHP { ...@@ -1186,6 +1187,7 @@ class PHP {
const id = treeselect.split('::')[1].split(":")[0]; const id = treeselect.split('::')[1].split(":")[0];
let dbname = new Buffer(treeselect.split('::')[1].split(":")[1],"base64").toString(); let dbname = new Buffer(treeselect.split('::')[1].split(":")[1],"base64").toString();
let tablename = new Buffer(treeselect.split('::')[1].split(":")[2],"base64").toString(); let tablename = new Buffer(treeselect.split('::')[1].split(":")[2],"base64").toString();
// 已在 lang 中过滤
layer.confirm(LANG['form']['deltable']['confirm'](tablename), { layer.confirm(LANG['form']['deltable']['confirm'](tablename), {
icon: 2, shift: 6, icon: 2, shift: 6,
title: LANG['form']['deltable']['title'] title: LANG['form']['deltable']['title']
...@@ -1283,7 +1285,7 @@ class PHP { ...@@ -1283,7 +1285,7 @@ class PHP {
return return
} }
layer.prompt({ layer.prompt({
value: columnname, value: antSword.noxss(columnname),
title: `<i class="fa fa-file-code-o"></i> ${LANG['form']['editcolumn']['title']}` title: `<i class="fa fa-file-code-o"></i> ${LANG['form']['editcolumn']['title']}`
},(value, i, e) => { },(value, i, e) => {
if(!value.match(/^[a-zA-Z0-9_]+$/)){ if(!value.match(/^[a-zA-Z0-9_]+$/)){
...@@ -1324,6 +1326,7 @@ class PHP { ...@@ -1324,6 +1326,7 @@ class PHP {
let dbname = new Buffer(treeselect.split('::')[1].split(":")[1],"base64").toString(); let dbname = new Buffer(treeselect.split('::')[1].split(":")[1],"base64").toString();
let tablename = new Buffer(treeselect.split('::')[1].split(":")[2],"base64").toString(); let tablename = new Buffer(treeselect.split('::')[1].split(":")[2],"base64").toString();
let columnname = new Buffer(treeselect.split('::')[1].split(":")[3],"base64").toString(); let columnname = new Buffer(treeselect.split('::')[1].split(":")[3],"base64").toString();
// 已在LANG中过滤
layer.confirm(LANG['form']['delcolumn']['confirm'](columnname), { layer.confirm(LANG['form']['delcolumn']['confirm'](columnname), {
icon: 2, shift: 6, icon: 2, shift: 6,
title: LANG['form']['delcolumn']['title'] title: LANG['form']['delcolumn']['title']
......
...@@ -137,7 +137,7 @@ class Files { ...@@ -137,7 +137,7 @@ class Files {
case 'bookmark_add': case 'bookmark_add':
// 添加书签 // 添加书签
layer.prompt({ layer.prompt({
value: self.manager.path, value: antSword.noxss(self.manager.path),
title: LANG['prompt']['add']['title'] title: LANG['prompt']['add']['title']
}, (value, i, e) => { }, (value, i, e) => {
bookmark[self.manager.path] = value; bookmark[self.manager.path] = value;
......
...@@ -286,7 +286,7 @@ class FileManager { ...@@ -286,7 +286,7 @@ class FileManager {
let self = this; let self = this;
layer.confirm( layer.confirm(
LANG['delete']['confirm'](files.length > 1 ? files.length : files[0]), LANG['delete']['confirm'](files.length > 1 ? files.length : files[0]), // 已在 lang 中过滤
{ {
icon: 2, icon: 2,
shift: 6, shift: 6,
...@@ -492,7 +492,7 @@ class FileManager { ...@@ -492,7 +492,7 @@ class FileManager {
// 设置文件和目录权限 // 设置文件和目录权限
chmodFile(name, oldmod) { chmodFile(name, oldmod) {
layer.prompt({ layer.prompt({
value: oldmod, value: antSword.noxss(oldmod),
title: `<i class="fa fa-users"></i> ${LANG['chmod']['title']} (${antSword.noxss(name)})`, title: `<i class="fa fa-users"></i> ${LANG['chmod']['title']} (${antSword.noxss(name)})`,
}, (value, i, e) => { }, (value, i, e) => {
if(!value.match(/^[0-7]{4}$/)){ if(!value.match(/^[0-7]{4}$/)){
...@@ -625,7 +625,7 @@ class FileManager { ...@@ -625,7 +625,7 @@ class FileManager {
// 获取URL // 获取URL
let _index = layer.prompt({ let _index = layer.prompt({
title: `<i class="fa fa-cloud-download"></i> ${LANG['wget']['title']}`, title: `<i class="fa fa-cloud-download"></i> ${LANG['wget']['title']}`,
content: '<input type="text" style="width:300px;" class="layui-layer-input" id="url_' + hash + '" value="http://" placeholder="target url"><p/><input style="width:300px;" type="text" id="path_' + hash + '" class="layui-layer-input" value="' + self.path + '" placeholder="file name">', content: '<input type="text" style="width:300px;" class="layui-layer-input" id="url_' + hash + '" value="http://" placeholder="target url"><p/><input style="width:300px;" type="text" id="path_' + hash + '" class="layui-layer-input" value="' + antSword.noxss(self.path) + '" placeholder="file name">',
btn: ['wget'], btn: ['wget'],
yes: (i) => { yes: (i) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment