Visitar URL original
`MutableSequence` coverage in `ImmutableSandboxedEnvironment` · Issue #2032 · pallets/jinja · GitHub
Skip to content

MutableSequence coverage in ImmutableSandboxedEnvironment #2032

Closed

Description

@dylanscott

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

Activity

  1. dylanscott commented on Oct 4, 2024

    @dylanscott
    ContributorAuthor

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

  2. added this to the 3.1.5 milestone on Dec 19, 2024
  3. locked as resolved and limited conversation to collaborators on Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions