Visitar URL original
Python: Add `html.escape` as HTML sanitizer by RasmusWL · Pull Request #15398 · github/codeql · GitHub
The Wayback Machine - https://web.archive.org/web/20240128102823/https://github.com/github/codeql/pull/15398
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

Python: Add html.escape as HTML sanitizer #15398

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

RasmusWL
Copy link
Member

I've seen a few FPs related to XSS where html.escape has been used. When quotes are not escaped, it could end up being used in a dangerous way such as this example:

html = '<foo attr=' + html.escape(user_input, False) + '>...</foo>'

I couldn't really decide whether we should allow this as a sanitizer when quotes are not escaped, but ended up allowing it as a sanitizer, since it was easier this way. (Let me know if you think not doing so was not the right choice)

We should check how JS approaches this, I think they have a more sophisticated way of handling it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant