summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/assets/javascripts/notebook/cells/output/html.vue3
-rw-r--r--spec/frontend/notebook/cells/output/html_sanitize_fixtures.js11
2 files changed, 12 insertions, 2 deletions
diff --git a/app/assets/javascripts/notebook/cells/output/html.vue b/app/assets/javascripts/notebook/cells/output/html.vue
index ca02ee18dd1..2d1d8845e41 100644
--- a/app/assets/javascripts/notebook/cells/output/html.vue
+++ b/app/assets/javascripts/notebook/cells/output/html.vue
@@ -30,6 +30,9 @@ export default {
},
safeHtmlConfig: {
ADD_TAGS: ['use'], // to support icon SVGs
+ FORBID_TAGS: ['style'],
+ FORBID_ATTR: ['style'],
+ ALLOW_DATA_ATTR: false,
},
};
</script>
diff --git a/spec/frontend/notebook/cells/output/html_sanitize_fixtures.js b/spec/frontend/notebook/cells/output/html_sanitize_fixtures.js
index 803ac4a219d..70c7f56b62f 100644
--- a/spec/frontend/notebook/cells/output/html_sanitize_fixtures.js
+++ b/spec/frontend/notebook/cells/output/html_sanitize_fixtures.js
@@ -16,13 +16,20 @@ export default [
'text/html table',
{
input: [
- '<table>\n',
+ '<style type="text/css">\n',
+ '\n',
+ 'body {\n',
+ ' background: red;\n',
+ '}\n',
+ '\n',
+ '</style>\n',
+ '<table data-myattr="XSS">\n',
'<tr>\n',
'<th>Header 1</th>\n',
'<th>Header 2</th>\n',
'</tr>\n',
'<tr>\n',
- '<td>row 1, cell 1</td>\n',
+ '<td style="background: red;">row 1, cell 1</td>\n',
'<td>row 1, cell 2</td>\n',
'</tr>\n',
'<tr>\n',