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

Mutation XSS + general sanitization #112

Open
gmatuz opened this issue Jun 12, 2021 · 3 comments · May be fixed by #149
Open

Mutation XSS + general sanitization #112

gmatuz opened this issue Jun 12, 2021 · 3 comments · May be fixed by #149

Comments

@gmatuz
Copy link

gmatuz commented Jun 12, 2021

There are character sequences that would be understood as benign by most sanitisers that when they are passed through anchorme result in javascript execution.
I'll omit examples for obvious reasons, please reach out if you would like to know more.

Add to that based on a small research it is obvious that users of the library do not know that the output of anchore me should not be trusted to be free of potentially malicious javascript.
I think there is an argument to try to do sanitization (or at least make it a default switchable option), because that is how people often use the library and it is possibly beneficial to be safe by default.
That said even if this was not the preferred option the fact that people are often using it in an unsafe way shows that it would be useful to have at least some sort of disclaimer that clarifies the security model of anchorme.

@yukulele
Copy link

GHSA-w4wq-rvmq-77x7

@yukulele yukulele mentioned this issue Oct 7, 2022
@arnolem
Copy link

arnolem commented Jan 19, 2023

Version 1.1.2 seems safe

@lionel-rowe
Copy link

lionel-rowe commented May 11, 2024

Version 1.1.2 seems safe

"Seems safe", two words any web developer should be rightfully terrified of 😱

I think the correct fix for this is to explicitly state in documentation that the library is almost certainly not XSS-safe, most likely never will be, and that it's up to the consumer to properly mitigate XSS by sanitizing the output of anchorme if calling it on untrusted user input. There are plenty of well-tested solutions out there for doing this, such as DOMPurify.

See showdown's article on XSS, which they link to from their README, for a great example of how to document this stuff.

@lionel-rowe lionel-rowe linked a pull request May 11, 2024 that will close this issue
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 a pull request may close this issue.

4 participants