Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sanitizeUrl vbscript/data xss #307

Merged
merged 1 commit into from May 22, 2020

Conversation

ariabuckles
Copy link
Collaborator

@ariabuckles ariabuckles commented May 21, 2020

Fixes #306 : I believe this fixes https://www.npmjs.com/advisories/1219 if
options.disableParsingRawHTML is set.

NOTE: This does not handle script elements, etc., that may be rendered
when options.disableParsingRawHTML is not enabled. We might be able to
use something like dompurify to
solve that case?

According to https://owasp.org/www-community/xss-filter-evasion-cheatsheet ,
the dangerous javascript: protocol can contain some whitespace
characters and still be vulnerable, and sometimes when used in
conjunction with images, some other special characters like ` or <
before the javascript: protocol can also leave a url vulnerable.

This change re-adds the sanitiation logic removed in 9c6c782 , and also
adds the vbscript/data handling from github.com/ariabuckles/simple-markdown/pull/63

Test plan:

Add tests and run npm test

I believe this fixes https://www.npmjs.com/advisories/1219 if
`options.disableParsingRawHTML` is set.

NOTE: This does not handle script elements, etc., that may be rendered
when `options.disableParsingRawHTML` is not enabled. We might be able to
use something like [`dompurify`](https://github.com/cure53/DOMPurify) to
solve that case?

According to https://owasp.org/www-community/xss-filter-evasion-cheatsheet ,
the dangerous `javascript:` protocol can contain some whitespace
characters and still be vulnerable, and sometimes when used in
conjunction with images, some other special characters like ` or <
before the javascript: protocol can also leave a url vulnerable.

This change re-adds the sanitiation logic removed in 9c6c782 , and also
adds the vbscript/data handling from github.com/ariabuckles/simple-markdown/pull/63

Test plan:

Add tests and run `npm test`
@ariabuckles
Copy link
Collaborator Author

Should fix #306

@ariabuckles ariabuckles changed the title XSS: Fix sanitizeUrl vbscript/data xss Fix sanitizeUrl vbscript/data xss May 22, 2020
@ariabuckles ariabuckles merged commit 105d6a6 into quantizor:master May 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

XSS reported by npm audit
1 participant