Skip to content
New issue

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

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

Already on GitHub? # to your account

Ignore control chars in links #334

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/helpers/parse_link_destination.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ export default function parseLinkDestination(state, pos) {

if (code === 0x20) { break; }

if (code > 0x08 && code < 0x0e) { break; }
// ascii control chars
if (code < 0x20 || code === 0x7F) { break; }

if (code === 0x5C /* \ */ && pos + 1 < max) {
pos += 2;
Expand Down
7 changes: 7 additions & 0 deletions test/fixtures/remarkable/xss.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,10 @@ javascript:alert(1)
<p>javascript:alert(1)</p>
<p>javascript:alert(1)</p>
.


.
[ASCII control characters XSS](javascript:alert(1))
.
<p>[ASCII control characters XSS](javascript:alert(1))</p>
.