-
Notifications
You must be signed in to change notification settings - Fork 2
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
Escape attributes by default #9
Conversation
I would remove all of the Reference: https://portswigger.net/web-security/cross-site-scripting/cheat-sheet |
To better manage performance, consider having a default mode where everything is escaped (safe/slow) where one can opt out by using That will delegate the trade off decision to package consumers. Reference: https://jinja.palletsprojects.com/en/3.1.x/templates/#html-escaping |
Perhaps the code is easy to misunderstand here. The only use of the safe keys lookup is for avoiding the escaping logic on the keys-only; and only if the keys exactly match. The result of escaping on those keys would produce no change, so it's ok to avoid if we know we can (and because a dict lookup is typically much faster than escaping in this case, it makes performance sense). The values are still be escaped. |
closes #7
SafeString
to overrideThanks to @gcollazo for putting forth a good argument to doing this.