Add additional test for safe case in documentation

This commit is contained in:
Joe Farebrother
2024-11-29 10:21:13 +00:00
parent 55557f8dd3
commit dd8b7a4a8f

View File

@@ -1,7 +1,11 @@
from jinja2 import Environment, Template
from jinja2.sandbox import SandboxedEnvironment
def test():
env = Environment()
t = env.from_string("abc") # $ templateConstruction="abc"
t = Template("abc") # $ templateConstruction="abc"
env2 = SandboxedEnvironment()
t = env.from_string("abc") # No result as we don't model SandboxedEnvironment. We may wish to instead specifically model it as NOT vulnerable to template injection vulnerabilities.
return t