test(plugins/dotenv): silence S701 on test-only jinja2 autoescape=False

The mode-aware dotenv_quote test renders the filter through a real
jinja2.Environment to exercise the @pass_context branch. The filter
produces shell env-file values, not HTML, so autoescape=True would
mangle `&`, `<`, `>`, `'`, and `"` into HTML entities and break every
assertion. Suppressing bandit S701 here is the correct call -- there
is no XSS surface for a test-suite Environment that templates
KEY=VALUE pairs.
This commit is contained in:
kevinveenbirkenbach committed 2026-06-14 19:08:45 +02:00
1 parent fb977e975a
commit 9a9c2f239c
1 file changed
+4 -1
@@ -72,7 +72,10 @@ class TestDotenvQuoteModeAware(unittest.TestCase):
"""
def setUp(self):
env = jinja2.Environment(autoescape=False)
# The filter renders shell env-file values, not HTML; autoescape
# would replace `&`, `<`, `>`, `'`, `"` with HTML entities and
# break every assertion below.
env = jinja2.Environment(autoescape=False) # noqa: S701
env.filters["dotenv_quote"] = FilterModule().filters()["dotenv_quote"]
self.env = env