Harden Jinja template rendering with sandboxing - #6888
Conversation
blackboxsw
left a comment
There was a problem hiding this comment.
Thank you for this submission and increasing the security posture for cloud-init's jinja2 template handling. Integration tests look happy with this approach. Some things we'll need on this PR:
- tox -e do_format
It looks like the sandboxedenvironment has been in Jinja2 for.... ever. So we don't have to worry about backward compatibility issues.
Requesting minor changes to ensure CI passes.
|
Let's resolve conflicts in this PR and get CI passing on this please. |
| JUndefinedError: Type[Exception] | ||
| try: | ||
| from jinja2.exceptions import UndefinedError as JUndefinedError | ||
| from jinja2.exceptions import SecurityError as JSecurityError |
There was a problem hiding this comment.
Note due to 473fa33 we are no longer allowing jinja2 to be an optional runtime dependency within try/except ImportError clauses. This is primary cause for the current merge conflicts.
|
@tcoatswo Any updates? |
Updated. |
|
@tcoatswo The CLA job is failing. |
e83b234 to
c4d1dee
Compare
|
Squashed the commits to resolve the CLA issue. Let me know if there's anything else! |
|
@tcoatswo, changeset looks good thanks for resolving the merge conflicts. Our CLA service may not have received your CLA signing for the github username: tcoatswo. As the CLA service continues to report false for a github_username check which is what is rejecting this PR. Is it possible that the CLA was submitted under a different username? |
There was a problem hiding this comment.
Updated changes look good and conflicts resolved. Thanks @tcoatswo, just awaiting CI run.
I think we just need confirmation that the CLA was signed or an understanding about why CLA service is rejecting this github username.
c4d1dee to
9a35b52
Compare
|
I've updated the commit author email to |
|
Apologies for the back-and-forth! I realized I hadn't actually signed the CLA yet. I just created my account, signed the agreement, and linked my GitHub/email ( |
blackboxsw
left a comment
There was a problem hiding this comment.
Thank you much @tcoatswo for the quick resolution here. CLA is happy and so are we.
let's ship it.
Summary
Harden cloud-init Jinja template rendering by switching to a sandboxed Jinja environment.
Changes
Verification