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

Open
dylanscott opened this issue Oct 4, 2024 · 1 comment · May be fixed by #2033
Open

MutableSequence coverage in ImmutableSandboxedEnvironment #2032

dylanscott opened this issue Oct 4, 2024 · 1 comment · May be fixed by #2033

Comments

@dylanscott
Copy link

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
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant