-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
filter ascii control chars for backspace #266
Comments
Michael Bayer (@zzzeek) wrote: did you confirm this for mako ? |
jvanasco (@jvanasco) wrote: Yeah. Only the url-encoding filter will escape it, turning here's an illustration:
note that I'm using |
Michael Bayer (@zzzeek) wrote: i've got no resources to put thought into Mako these days, I've long wanted it to have anew maintainer. What is markupsafe doing? |
jvanasco (@jvanasco) wrote: markupsafe has a Ticket+PR-candidate pending (no comment on either yet). if they address it, Mako should be fine via the default html escaping. A small amount of Python (and other language) projects filter this out on form submission or rendering. I was surprised at how many websites allow this though. I don't see a need this to be actively addressed in a filter. Perhaps a doc? It really only effects people who use mako in a bug tracker or coding site. |
Noting that the MarkupSafe ticket has been closed without a resolution: pallets/markupsafe#71 |
Migrated issue, originally created by jvanasco (@jvanasco)
I've opened a ticket/PR with Markupsafe for this, but wanted to alert Mako on this too as addressing this behavior may be warranted on other filters.
Most Python libraries for form validation or text sanitizing will let ASCII control characters through. If they make it to Mako, they are rendered in the template as-is, and wind up in web browsers as non-printing characters.
That allows a malicious actor to carefully construct a payload such as this:
which looks like this on an HTML page:
However all the backspace control characters are in there and will copy/paste into a Python/ruby/etc terminal, where they are interpreted in realtime and become...
If Mako is used as the engine on a coding website or bug reporting system, this introduces a way of tricking users into executing seemingly safe code that is actually malicious.
The text was updated successfully, but these errors were encountered: