-
-
Notifications
You must be signed in to change notification settings - Fork 621
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
Add flask.Markup XSS plugin #877
base: main
Are you sure you want to change the base?
Conversation
I feel as if this should be not in core but a separate plugin that users can install |
Hi @sigmavirus24 , |
Considering But I would concur that it makes sense to add this plugin to bandit. I don't see why this should be separate, considering the existing plugins in core. That being said the implementation could be greatly improved. This rule is much too broad. It's always fine to pass a literal/uninterpolated string into |
@ericwb @lukehinds @sigmavirus24 As long as there's some interest, considering the precedent set by django/jinja/mako, I'd be happy to take a stab at an implementation for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add to the functional tests that verify this new plugin.
Co-authored-by: Eric Brown <[email protected]>
Co-authored-by: Eric Brown <[email protected]>
Co-authored-by: Eric Brown <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it seems that Flask removed the deprecated Flask.markup. Flask advises to now use:
from markupsafe import Markup
Importing escape and Markup from flask is deprecated. Import them directly from markupsafe instead. [#4996](https://github.com/pallets/flask/pull/4996)
Ah, thanks! I guess this plugin is no longer needed in context of flask. I will close the PR. Let me know if you find it useful to have a separate plugin for usage of |
I can try to port the rule I wrote for ruff to bandit, if there's interest. https://docs.astral.sh/ruff/rules/unsafe-markup-use/ Either with or without the corresponding settings. I'm personally not a huge fan of the whitelist, but it was requested by the community. |
Hi,
I would like to contribute another plugin based on Flask's security consideration about calling
flask.Markup
on user submitted data.Cheers!