Skip to content

Commit

Permalink
use the more generic sanitizer option instead of `sanitizerRemoveHt…
Browse files Browse the repository at this point in the history
…ml` in tests
  • Loading branch information
koczkatamas committed Jun 28, 2019
1 parent 44da69e commit 0e8d8f4
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions test/specs/run-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ function runSpecs(title, dir, showCompletionTable, options) {
spec.options = Object.assign({}, options, (spec.options || {}));
const example = (spec.example ? ' example ' + spec.example : '');
const passFail = (spec.shouldFail ? 'fail' : 'pass');
if (spec.options.sanitizerRemoveHtml) {
spec.options.sanitizer = () => '';
if (spec.options.sanitizer) {
// eslint-disable-next-line no-eval
spec.options.sanitizer = eval(spec.options.sanitizer);
}
(spec.only ? fit : it)('should ' + passFail + example, () => {
const before = process.hrtime();
Expand Down
2 changes: 1 addition & 1 deletion test/specs/security/sanitizer_bypass_remove_generic.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sanitize: true
sanitizerRemoveHtml: true
sanitizer: () => ''
---
<a>a2<a2t>a2</a> b <c>c</c> d
# ![text](URL)
2 changes: 1 addition & 1 deletion test/specs/security/sanitizer_bypass_remove_script.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sanitize: true
sanitizerRemoveHtml: true
sanitizer: () => ''
---
AAA<script> <img <script> src=x onerror=alert(1) />BBB
2 changes: 1 addition & 1 deletion test/specs/security/sanitizer_bypass_remove_tag.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sanitize: true
sanitizerRemoveHtml: true
sanitizer: () => ''
---
AAA<sometag> <img <sometag> src=x onerror=alert(1)BBB

0 comments on commit 0e8d8f4

Please sign in to comment.