Skip to content

Commit

Permalink
運営ユーザーが実行できないスクリプトイベントに「onerror」を追加、コンテンツ一覧でコンテンツを新規登録する際の通知メッセージをサニタイズ
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuring committed Oct 24, 2024
1 parent 0623a4f commit ffc5df0
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion plugins/baser-core/src/Model/Validation/BcValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ public static function containsScript($value)
if (!$value) return true;
$events = ['onclick', 'ondblclick', 'onmousedown', 'onmouseup', 'onmouseover', 'onmousemove',
'onmouseout', 'onkeypress', 'onkeydown', 'onkeyup', 'onload', 'onunload',
'onfocus', 'onblur', 'onsubmit', 'onreset', 'onselect', 'onchange'];
'onfocus', 'onblur', 'onsubmit', 'onreset', 'onselect', 'onchange', 'onerror'];
if (BcUtil::isAdminUser() || Configure::read('BcApp.allowedPhpOtherThanAdmins')) {
return true;
}
Expand Down
10 changes: 2 additions & 8 deletions plugins/bc-admin-third/src/js/admin/_lib/jquery.bcTree.js
Original file line number Diff line number Diff line change
Expand Up @@ -1037,11 +1037,7 @@
data.name = result.content.name;
data.contentEntityId = result.content.entity_id;
data.contentTitle = result.content.title;
data.contentTitle = data.contentTitle.replace(/&/g, '&')
.replace(/"/g, '"')
.replace(/'/g, ''')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;');

$.ajax($.bcUtil.apiAdminBaseUrl + 'baser-core/contents/get_full_url/' + data.contentId + '.json', {
type: 'GET',
dataType: 'json'
Expand Down Expand Up @@ -1103,9 +1099,7 @@
$.bcUtil.showLoader();
},
success: function (result) {
if (!result) {
$.bcUtil.showNoticeMessage(result.message);
}
$.bcUtil.showNoticeMessage(result.message);
$.bcTree.settings[node.data.jstree.contentType]['existsTitle'] = editNode.text;
editNode.data.jstree.contentFullUrl = result.url;
editNode.data.jstree.name = result.name;
Expand Down
5 changes: 5 additions & 0 deletions plugins/bc-admin-third/src/js/admin/_lib/jquery.bcUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ import Cookies from 'js-cookie'
* @param message
*/
showNoticeMessage: function (message) {
message = message.replace(/&/g, '&amp;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#039;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;');
$.bcUtil.hideMessage();
$("#BcSystemMessage")
.removeClass('notice-messge alert-message')
Expand Down

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions plugins/bc-admin-third/webroot/js/admin/common.bundle.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

0 comments on commit ffc5df0

Please sign in to comment.