Skip to content

Conversation

@renovate
Copy link

@renovate renovate bot commented Feb 1, 2025

This PR contains the following updates:

Package Change Age Confidence
jinja2 (changelog) ==3.1.3==3.1.6 age confidence

GitHub Vulnerability Alerts

CVE-2024-34064

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.

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.

CVE-2024-56201

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.

CVE-2025-27516

An oversight in how the Jinja sandboxed environment interacts with the |attr filter 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 use the |attr filter to get a reference to a string's plain format method, bypassing the sandbox. After the fix, the |attr filter no longer bypasses the environment's attribute lookup.


Release Notes

pallets/jinja (jinja2)

v3.1.6

Compare Source

Released 2025-03-05

  • The |attr filter does not bypass the environment's attribute lookup,
    allowing the sandbox to apply its checks. :ghsa:cpwx-vrp4-4pq7

v3.1.5

Compare Source

Released 2024-12-21

  • The sandboxed environment handles indirect calls to str.format, such as
    by passing a stored reference to a filter that calls its argument.
    :ghsa:q2x7-8rv6-6q7h
  • Escape template name before formatting it into error messages, to avoid
    issues with names that contain f-string syntax.
    :issue:1792, :ghsa:gmj6-6f8f-6699
  • Sandbox does not allow clear and pop on known mutable sequence
    types. :issue:2032
  • 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
  • The runtime uses the correct concat function for the current environment
    when calling block references. :issue:1701
  • Make |unique async-aware, allowing it to be used after another
    async-aware filter. :issue:1781
  • |int filter handles OverflowError from scientific notation.
    :issue:1921
  • Make compiling deterministic for tuple unpacking in a {% set ... %}
    call. :issue:2021
  • Fix dunder protocol (copy/pickle/etc) interaction with Undefined
    objects. :issue:2025
  • Fix copy/pickle support for the internal missing object.
    :issue:2027
  • Environment.overlay(enable_async) is applied correctly. :pr:2061
  • The error message from FileSystemLoader includes the paths that were
    searched. :issue:1661
  • PackageLoader shows a clearer error message when the package does not
    contain the templates directory. :issue:1705
  • Improve annotations for methods returning copies. :pr:1880
  • urlize does not add mailto: to values like @a@b. :pr:1870
  • Tests decorated with @pass_context`` can be used with the ``|select`` filter. :issue:1624`
  • Using set for multiple assignment (a, b = 1, 2) does not fail when the
    target is a namespace attribute. :issue:1413
  • Using set in all branches of {% if %}{% elif %}{% else %} blocks
    does not cause the variable to be considered initially undefined.
    :issue:1253

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: Enabled.

Rebasing: Whenever PR is behind base branch, 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.

@renovate
Copy link
Author

renovate bot commented Feb 1, 2025

Branch automerge failure

This PR was configured for branch automerge. However, this is not possible, so it has been raised as a PR instead.

@korbit-ai
Copy link

korbit-ai bot commented Feb 1, 2025

By default, I don't review pull requests opened by bots. If you would like me to review this pull request anyway, you can request a review via the /korbit-review command in a comment.

@sourcery-ai
Copy link

sourcery-ai bot commented Feb 1, 2025

Reviewer's Guide by Sourcery

This PR updates the jinja2 dependency from version 3.1.3 to 3.1.5 to address multiple security vulnerabilities. The update also includes some bug fixes and improvements.

Sequence diagram showing potential XSS vulnerability in xmlattr filter

sequenceDiagram
    actor Attacker
    actor Victim
    participant App
    participant Jinja2

    Note over Attacker, Jinja2: CVE-2024-34064 vulnerability (v3.1.3)
    Attacker->>App: Submit malicious attribute key with '/' or '>'
    App->>Jinja2: Use xmlattr filter with malicious key
    Jinja2-->>App: Renders unsafe HTML attributes
    App-->>Victim: Serves page with injected attributes
    Note over Victim: Potential XSS attack

    Note over Attacker, Jinja2: After fix in v3.1.5
    Attacker->>App: Submit malicious attribute key
    App->>Jinja2: Use xmlattr filter
    Jinja2-->>App: Blocks keys with '/', '>', '='
    App-->>Victim: Serves safe page
Loading

Sequence diagram showing sandbox escape vulnerability

sequenceDiagram
    actor Attacker
    participant App
    participant Jinja2
    participant Python

    Note over Attacker, Python: CVE-2024-56326 vulnerability (v3.1.3)
    Attacker->>App: Submit template with malicious str.format reference
    App->>Jinja2: Execute template in sandbox
    Jinja2->>Python: Indirect str.format call via filter
    Note over Python: Arbitrary code execution

    Note over Attacker, Python: After fix in v3.1.5
    Attacker->>App: Submit template with malicious str.format
    App->>Jinja2: Execute template in sandbox
    Jinja2-->>App: Blocks indirect format calls
    Note over App: Attack prevented
Loading

File-Level Changes

Change Details Files
Updated the jinja2 dependency to address security vulnerabilities.
  • Updated jinja2 from version 3.1.3 to 3.1.5.
docs/requirements.txt

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@evolua-app
Copy link

evolua-app bot commented Feb 1, 2025

Welcome @renovate[bot]! 🎉

Great PR! I've analyzed your code changes for:

  • 🔒 Security vulnerabilities
  • ✨ Code quality improvements
  • 🎯 Best practices alignment

Ready to see the full review?
Head over to https://evolua.io to:

  • Create your free account
  • Get detailed insights
  • Unlock automated PR reviews
  • Ensure high-quality code

Let's make your code even better together! 🚀

@coderabbitai
Copy link

coderabbitai bot commented Feb 1, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Join our Discord community for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have skipped reviewing this pull request. Here's why:

  • It seems to have been created by a bot (hey, renovate[bot]!). We assume it knows what it's doing!
  • We don't review packaging changes - Let us know if you'd like us to change this.

@deepsource-io
Copy link

deepsource-io bot commented Feb 1, 2025

Here's the code health analysis summary for commits 2d20dba..a3a9454. View details on DeepSource ↗.

Analysis Summary

AnalyzerStatusSummaryLink
DeepSource Python LogoPython✅ SuccessView Check ↗

💡 If you’re a repository administrator, you can configure the quality gates from the settings.

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR updates the Jinja2 dependency from version 3.1.3 to 3.1.5 to address three critical security vulnerabilities in the NextGenContributions/nitpick repository.

  • Updates docs/requirements.txt to use Jinja2 3.1.5 to fix CVE-2024-34064 (XSS via xmlattr filter)
  • Patches CVE-2024-56326 vulnerability in sandboxed environment str.format handling
  • Fixes CVE-2024-56201 compiler bug that could allow arbitrary code execution
  • Includes improvements to async template handling and generator cleanup
  • Maintains Python version compatibility requirements (>=3.8, <4.0)

💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

@renovate renovate bot force-pushed the renovate/pypi-jinja2-vulnerability branch 3 times, most recently from 4517785 to 28c74b9 Compare February 7, 2025 13:17
@renovate renovate bot force-pushed the renovate/pypi-jinja2-vulnerability branch 2 times, most recently from 2df3310 to d5df5aa Compare February 18, 2025 08:56
@renovate renovate bot changed the title chore(deps): update dependency jinja2 to v3.1.5 [security] chore(deps): update dependency jinja2 to v3.1.6 [security] Mar 8, 2025
@renovate renovate bot force-pushed the renovate/pypi-jinja2-vulnerability branch from d5df5aa to 8dfe82e Compare March 8, 2025 04:00
@snyk-io
Copy link

snyk-io bot commented Mar 8, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

@bito-code-review
Copy link

bito-code-review bot commented Mar 8, 2025

Code Review Agent Run #f25c12

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 8dfe82e..8dfe82e
    • docs/requirements.txt
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at jukka.hassinen@gmail.com.

Documentation & Help

AI Code Review powered by Bito Logo

@bito-code-review
Copy link

bito-code-review bot commented Mar 8, 2025

Changelist by Bito

This pull request implements the following key changes.

Key Change Files Impacted
Bug Fix - Dependency Security Patch

requirements.txt - Updated jinja2 version from 3.1.3 to 3.1.6 to mitigate multiple security vulnerabilities.

@renovate renovate bot force-pushed the renovate/pypi-jinja2-vulnerability branch from 8dfe82e to 2e2c47e Compare March 18, 2025 15:17
@bito-code-review
Copy link

bito-code-review bot commented Mar 18, 2025

Code Review Agent Run #627e90

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 2e2c47e..2e2c47e
    • docs/requirements.txt
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at jukka.hassinen@gmail.com.

Documentation & Help

AI Code Review powered by Bito Logo

@renovate renovate bot enabled auto-merge (squash) March 19, 2025 10:05
@renovate renovate bot force-pushed the renovate/pypi-jinja2-vulnerability branch from 2e2c47e to 706b996 Compare March 19, 2025 10:05
@bito-code-review
Copy link

bito-code-review bot commented Mar 19, 2025

Code Review Agent Run #4267b7

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 706b996..706b996
    • docs/requirements.txt
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at jukka.hassinen@gmail.com.

Documentation & Help

AI Code Review powered by Bito Logo

@renovate renovate bot force-pushed the renovate/pypi-jinja2-vulnerability branch from 706b996 to a3a9454 Compare May 6, 2025 10:50
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.

1 participant