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

[Backport perf-v16] chore(deps): update dependency jinja2 to v3.1.5 [security] #9724

Merged
merged 3 commits into from
Jan 8, 2025

Conversation

mergify[bot]
Copy link

@mergify mergify bot commented Jan 8, 2025

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
jinja2 (changelog) ==3.1.3 -> ==3.1.5 age adoption passing confidence

GitHub Vulnerability Alerts

CVE-2024-56326

An oversight in how the Jinja sandboxed environment detects calls to str.format allows an attacker that controls the content of a template to execute arbitrary Python code.

To exploit the vulnerability, an attacker needs to control the content of a template. Whether that is the case depends on the type of application using Jinja. This vulnerability impacts users of applications which execute untrusted templates.

Jinja's sandbox does catch calls to str.format and ensures they don't escape the sandbox. However, it's possible to store a reference to a malicious string's format method, then pass that to a filter that calls it. No such filters are built-in to Jinja, but could be present through custom filters in an application. After the fix, such indirect calls are also handled by the sandbox.


Jinja vulnerable to HTML attribute injection when passing user input as keys to xmlattr filter

CGA-g5xx-83xq-8g5j / CVE-2024-34064 / GHSA-h75v-3vvj-5mfj

More information

Details

The xmlattr filter in affected versions of Jinja accepts keys containing non-attribute characters. XML/HTML attributes cannot contain spaces, /, >, or =, as each would then be interpreted as starting a separate attribute. If an application accepts keys (as opposed to only values) as user input, and renders these in pages that other users see as well, an attacker could use this to inject other attributes and perform XSS. The fix for the previous GHSA-h5c8-rqwp-cp95 CVE-2024-22195 only addressed spaces but not other characters.

Accepting keys as user input is now explicitly considered an unintended use case of the xmlattr filter, and code that does so without otherwise validating the input should be flagged as insecure, regardless of Jinja version. Accepting values as user input continues to be safe.

Severity

  • CVSS Score: 5.4 / 10 (Medium)
  • Vector String: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N

References

This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).


Jinja has a sandbox breakout through indirect reference to format method

CVE-2024-56326 / GHSA-q2x7-8rv6-6q7h

More information

Details

An oversight in how the Jinja sandboxed environment detects calls to str.format allows an attacker that controls the content of a template to execute arbitrary Python code.

To exploit the vulnerability, an attacker needs to control the content of a template. Whether that is the case depends on the type of application using Jinja. This vulnerability impacts users of applications which execute untrusted templates.

Jinja's sandbox does catch calls to str.format and ensures they don't escape the sandbox. However, it's possible to store a reference to a malicious string's format method, then pass that to a filter that calls it. No such filters are built-in to Jinja, but could be present through custom filters in an application. After the fix, such indirect calls are also handled by the sandbox.

Severity

  • CVSS Score: 7.8 / 10 (High)
  • Vector String: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

References

This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).


Jinja has a sandbox breakout through malicious filenames

CVE-2024-56201 / GHSA-gmj6-6f8f-6699

More information

Details

A bug in the Jinja compiler allows an attacker that controls both the content and filename of a template to execute arbitrary Python code, regardless of if Jinja's sandbox is used.

To exploit the vulnerability, an attacker needs to control both the filename and the contents of a template. Whether that is the case depends on the type of application using Jinja. This vulnerability impacts users of applications which execute untrusted templates where the template author can also choose the template filename.

Severity

  • CVSS Score: 8.8 / 10 (High)
  • Vector String: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

References

This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).


Release Notes

pallets/jinja (jinja2)

v3.1.5

Compare Source

Unreleased

  • Calling sync render for an async template uses asyncio.run.
    :pr:1952
  • Avoid unclosed auto_aiter warnings. :pr:1960
  • Return an aclose-able AsyncGenerator from
    Template.generate_async. :pr:1960
  • Avoid leaving root_render_func() unclosed in
    Template.generate_async. :pr:1960
  • Avoid leaving async generators unclosed in blocks, includes and extends.
    :pr:1960

v3.1.4

Compare Source

Released 2024-05-05

  • The xmlattr filter does not allow keys with / solidus, >
    greater-than sign, or = equals sign, in addition to disallowing spaces.
    Regardless of any validation done by Jinja, user input should never be used
    as keys to this filter, or must be separately validated first.
    :ghsa:h75v-3vvj-5mfj

Configuration

📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

(cherry picked from commit 3bf287b)

Parent PR: #9703

@mergify mergify bot added the conflicts label Jan 8, 2025
Copy link
Author

mergify bot commented Jan 8, 2025

Cherry-pick of 3bf287b has failed:

On branch mergify/bp/branch-perf-v16/pr-9703
Your branch is up to date with 'origin/branch-perf-v16'.

You are currently cherry-picking commit 3bf287b8.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   requirements.in

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   docker/env/version
	both modified:   requirements.txt

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@mergify mergify bot marked this pull request as draft January 8, 2025 18:13
@fruch fruch removed the conflicts label Jan 8, 2025
fruch and others added 3 commits January 8, 2025 20:23
`ssh2-python` project is abondoned and didn't have a release in
2 years, in order to upgrade to newer python versions
we are switching forks of that project
Pins pycodestyle(https://pypi.org/project/pycodestyle/) to 2.10.0
More recent versions break autopep8 due to PyCQA/pycodestyle#1191
@fruch fruch force-pushed the mergify/bp/branch-perf-v16/pr-9703 branch from b1c5c6c to 076d41e Compare January 8, 2025 18:24
@fruch fruch marked this pull request as ready for review January 8, 2025 18:24
@fruch fruch merged commit e6a9aa9 into branch-perf-v16 Jan 8, 2025
6 checks passed
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 this pull request may close these issues.

2 participants