-
-
Notifications
You must be signed in to change notification settings - Fork 194
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
Added security checks for str.format. [5.0] #1912
Conversation
@vangheem This merges the hotfix into 5.0. |
Note that this adds the formatting function and classes from the hotfix into |
Well, utils.py is probably the right location. if we want to indicate this a thing not to use outside we could prefix all with |
Since nobody has an opposite opinion on this I will merge it. |
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.
@mauritsvanrees - since I'm not totally sure about the intentions of your PR I ask you to correct the wrong import in mixins.py.
@@ -67,9 +68,10 @@ def __call__(self): | |||
less_vars_params[name] = value | |||
|
|||
for name, value in registry.items(): | |||
t = value.format(**less_vars_params) | |||
t = SafeFormatter(value).safe_format(**less_vars_params) |
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.
@mauritsvanrees you have imported safe_format
but using SafeFormatter
. This leads to an error mentioned here: #1938 (comment)
@@ -115,7 +117,7 @@ def __call__(self): | |||
less_vars_params[name] = value | |||
|
|||
for name, value in registry.items(): | |||
t = value.format(**less_vars_params) | |||
t = SafeFormatter(value).safe_format(**less_vars_params) |
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.
Same here.
Huh, strange that this is not caught by the tests. |
Part of PloneHotfix20170117.