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

MutableSequence coverage in ImmutableSandboxedEnvironment #2032

Closed
dylanscott opened this issue Oct 4, 2024 · 1 comment · Fixed by #2033
Closed

MutableSequence coverage in ImmutableSandboxedEnvironment #2032

dylanscott opened this issue Oct 4, 2024 · 1 comment · Fixed by #2033
Milestone

Comments

@dylanscott
Copy link
Contributor

I happened to notice in using ImmutableSandboxedEnvironment that the default modifies_known_mutable check seems to be missing coverage for a couple of methods. In particular the clear and pop methods are checked for both MutableMapping and MutableSet but not MutableSequence.

Example:

from jinja2.sandbox import ImmutableSandboxedEnvironment

env = ImmutableSandboxedEnvironment()
print(env.from_string("{{ [1].pop() }}").render())

Expected: SecurityError should be raised
Actual: 1 is printed

Environment:

  • Python version: 3.10
  • Jinja version: 3.1.4
@dylanscott
Copy link
Contributor Author

I prepared a PR to add checks for these attributes if the change makes sense #2033

@davidism davidism added this to the 3.1.5 milestone Dec 19, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants