Skip to content

Commit 367fc05

Browse files
author
bkraul
committed
Corrected issue with csp by removing eval(). Corrected issue with issue image referencing.
1 parent f80e079 commit 367fc05

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

BBCodePlus/BBCodePlus.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ function csp_headers() {
124124
if ( (ON == plugin_config_get( 'process_markitup' )) && function_exists( 'http_csp_add' ) ) {
125125
http_csp_add( 'img-src', "*" );
126126
http_csp_add( 'frame-ancestors', "'self'" );
127-
http_csp_add( 'script', "'self'" );
128127
http_csp_add( 'script-src', "'nonce-$this->t_nonceToken'");
129128
}
130129
}

BBCodePlus/files/markitup/jquery_markitup.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,7 @@
220220
}).bind("focusin.markItUp", function(){
221221
$$.focus();
222222
}).bind('mouseup', function(e) {
223-
if (button.call) {
224-
eval(button.call)(e); // Pass the mouseup event to custom delegate
225-
}
223+
if (button.call == 'preview') { preview(); }
226224
setTimeout(function() { markup(button) },1);
227225
return false;
228226
}).bind('mouseenter.markItUp', function() {

BBCodePlus/files/markitup/sets/mantis/set.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,7 @@ mySettings = {
199199
list.attr("class", "bbcodeplus image-picker");
200200

201201
$(".bug-attachment-preview-image a img").each(function(index, value) {
202-
var imgUrl = this.src;
203-
202+
var imgUrl = $(this).parent().prop('href');
204203
var img = $("<li><a href=\"#\"><img src=\"" + imgUrl + "\"></a></li>");
205204
var link = img.children('a');
206205
link.click(function() {
@@ -256,4 +255,16 @@ mySettings = {
256255
{name:'Clean', className:"clean", replaceWith:function(markitup) { return markitup.selection.replace(/\[(.*?)\]/g, "") } },
257256
{name:'Preview', className:'preview', call:'preview'},
258257
]
258+
}
259+
260+
function getQueryVariable(variable) {
261+
var query = window.location.search.substring(1);
262+
var vars = query.split('&');
263+
for (var i = 0; i < vars.length; i++) {
264+
var pair = vars[i].split('=');
265+
if (decodeURIComponent(pair[0]) == variable) {
266+
return decodeURIComponent(pair[1]);
267+
}
268+
}
269+
console.log('Query variable %s not found', variable);
259270
}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ If you would like to contribute to BBCode plus, please [read this guide first](h
2929
### 2.1.18
3030

3131
- Added `nonce` random token and directives for included js scripts in order to hopefully address CSP restrictions.
32+
- Corrected issue with referencing issue images (removed volatile token, now using only file id and type).
3233

3334
### 2.1.17
3435

0 commit comments

Comments
 (0)