Skip to content

fix(deps): resolve pip-audit failures for pillow, gitpython, certifi and black - #143

Open
tkislan wants to merge 2 commits into
mainfrom
tk/fix-pip-audit-2026-10-26
Open

tkislan wants to merge 2 commits into
mainfrom
tk/fix-pip-audit-2026-10-26

Conversation

@tkislan

@tkislan tkislan commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Audit - Production and Audit - All have failed on every PR since about 2026-10-22. The cause is 40 advisories, in 4 packages, published after main's last green run. This PR fixes all of them on Python 3.11–3.14. On Python 3.10 the 37 pillow advisories remain, because no fixed pillow release supports 3.10 (details below).

Changes

Package Before After Advisories How
pillow 12.3.0 13.0.0 on ≥ 3.11, 12.3.0 on 3.10 GHSA-78g4-xqwv-q3g8 + 36 CVEs (CVE-2026-96636…114501) existing constraint split by Python version
streamlit (server extra) 1.56.0 1.66.1 on ≥ 3.11, 1.56.0 on 3.10 none (needed for pillow 13) constraint split by Python version
GitPython 3.1.62 3.2.1 CVE-2026-114145 existing constraint floor raised
certifi (transitive via requests) 2024.8.30 2026.10.23 PYSEC-2026-4320 new floor under "Security constraint updates for transitive dependencies"
black (dev) 26.3.1 26.10.1 CVE-2026-114134 dev floor raised
+    "certifi>=2026.10.19",  # 2026.10.19 fixes PYSEC-2026-4320 (transitive via requests)
-    "pillow>=12.3.0,<13",  # https://github.com/deepnote/deepnote-toolkit/security/dependabot/34 ...
+    "pillow>=13.0.0,<14; python_version >= '3.11'",  # 13.0.0 fixes GHSA-78g4-xqwv-q3g8 and 36 other advisories
+    "pillow>=12.3.0,<13; python_version < '3.11'",  # pillow 13 requires Python 3.11
-    "GitPython>=3.1.60,<4",  # fixes PYSEC-2026-3982, PYSEC-2026-3983, PYSEC-2026-3984
+    "GitPython>=3.2.1,<4",  # 3.2.1 fixes CVE-2026-114145
 ...
-    "streamlit>=1.40.0,<2.0.0",
+    "streamlit>=1.66.1,<2.0.0; python_version >= '3.11'",  # first release that allows pillow 13
+    "streamlit>=1.40.0,<2.0.0; python_version < '3.11'",
 ...
-    "black>=26.3.1,<27.0.0",
+    "black>=26.10.1,<27.0.0",

Why each change looks the way it does

  • pillow: every advisory is fixed only in 13.0.0. They include a heap-buffer-overflow write in the bundled libopenjp2 that Image.open().load() reaches with default settings. pillow 13 requires Python ≥ 3.11, so the constraint is split. Ignoring the advisories wasn't a good option: they are reachable from opening an untrusted image, and a fix exists for 3.11+. This follows fix(deps): resolve pip-audit failures #133, which accepted pymongo's breaking change for the same reason.
  • streamlit: every streamlit before 1.66.1 requires pillow<13, so pillow 13 needs streamlit ≥ 1.66.1, which itself requires Python ≥ 3.11. Its floor is declared explicitly, as dnspython's was next to the pymongo bump in fix(deps): resolve pip-audit failures #133.
  • GitPython: streamlit allows <4, and the locked gitdb 4.0.11 already satisfies 3.2.1's gitdb>=4.0.1,<5. Streamlit 1.66 no longer depends on GitPython. It stays installed on all versions through our own constraint, so it doesn't disappear from user environments.
  • certifi: nothing caps it; the lock entry was just stale. Recent audit PRs (chore(deps): Address dependabot and pip-audit findings #111, chore(deps): Address pip-audit vulnerability findings #118, fix(deps): resolve pip-audit failures #133) declare transitive fixes as a floor rather than bumping only the lock. It has no upper bound, like fsspec, since both use calendar versioning.
  • black: the advisory is in Black's GitHub Action (use_pyproject: true), which this repo doesn't use. A fix exists and black 26.10.1 reformats nothing (217 files unchanged), so the floor is bumped rather than ignored. black also reaches the server extra through deepnote-python-lsp-server (black = "*"). There, fresh installs resolve the latest black, and the advisory isn't reachable at runtime, so no runtime constraint was added.

⚠️ Streamlit 1.56 → 1.66.1 on Python 3.11+

  • Streamlit 1.66 replaced its Tornado server with Starlette/uvicorn. This adds starlette, uvicorn, websockets, h11, python-multipart and itsdangerous to the server extra on ≥ 3.11. blinker is now needed only on 3.10.
  • Checked with a live streamlit run on 1.66.1, using the flags from installer/module/streamlit.py and a cross-origin Origin header:
    • /_stcore/health and / return 200
    • the websocket session is accepted
    • read_streamlit_token_from_context() and _read_streamlit_app_id_from_context() still read the viewer's streamlit-token cookie and the app host from st.context
  • The same check passes on 1.56.0.
  • Not checked: behaviour behind Deepnote's real proxy (path prefixes, websocket proxying). A Streamlit app on a 3.11+ image should be checked before release.

⚠️ Python 3.10 keeps the pillow advisories

  • No fixed pillow release supports 3.10, so the 37 pillow advisories remain there.
  • CI won't show this. The audit jobs run on Python 3.11, and pip-audit skips pins whose marker excludes 3.11 (checked: a python_version < "3.11" pin of pillow 12.3.0 reports "No known vulnerabilities found"). This is also why the 3.10 pins need no ignore-vulns entry.
  • Python 3.10 reaches end of life this month. Dropping it would remove this gap, but that is out of scope here.

Lock file

Only the entries for these 12 packages changed: black, blinker, certifi, gitpython, h11, itsdangerous, pillow, python-multipart, starlette, streamlit, uvicorn, websockets.

A plain poetry lock on main also drops 20 unrelated older-Python entries (pydantic 2.11.7, pyzmq 26.2.0, pyspark 4.0.1, …). So, as in #133, the new entries were spliced into the existing lock from a fresh lock of the new pyproject.toml. A comparison confirmed that the fresh lock differs from the spliced one only in that unrelated drift.

Testing

  • poetry check --lock passes (Poetry 2.2.0, as in CI).

  • pip-audit with CI's flags and ignores:

    • CI's export on 3.11: main finds 40 known vulnerabilities in 4 packages; this branch finds none.
    • Full export on 3.12, 3.13 and 3.14: none.
    • On 3.10: only pillow 12.3.0, as described above.
  • The full export (all extras + dev) resolves on Python 3.10–3.14 with no package outside the lock, except tomli on 3.11 (via coverage), which is already the case on main.

  • Unit tests, in venvs built from the exported lock with all extras:

    Python Result
    3.10 1433 passed
    3.11 1433 passed
    3.12 1428 passed, 5 skipped
    3.13 1429 passed, 4 skipped
    3.14 1429 passed, 4 skipped

    On 3.12, main's lock gives the same counts, skips and warnings.

Not in this PR (found while auditing, already on main)

CI's audit exports only the main dependencies: no server extra, no dev group. An audit of everything finds these, all present on main and unchanged here:

  • jupyter-server 2.20.0 (server extra): PYSEC-2026-4054, fixed in 2.21.0
  • anyio 4.4.0: PYSEC-2026-4024, PYSEC-2026-4025, fixed in 4.14.2
  • virtualenv 20.36.1 (dev): 19 advisories, fixed in 21.14.9
  • pyspark 3.5.5 (dev, < 3.13): PYSEC-2026-3966, fixed in 3.5.8

Making CI audit extras and other Python versions would catch these, but it is a separate change.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HwkxN8YriHhdXBwMc4sd8h

Summary by CodeRabbit

  • Chores
    • Updated package requirements, including higher minimum versions for image processing, Git integration, and server deployments.
    • Server installations on Python 3.11 and newer now require a newer Streamlit version; older Python versions retain the existing minimum.
    • Updated the minimum supported Python-version ranges for image processing.

…and black

pip-audit flags 40 advisories published after main's last green run:
pillow 12.3.0 (37, fixed in 13.0.0), gitpython 3.1.62 (CVE-2026-114145),
certifi 2024.8.30 (PYSEC-2026-4320) and black 26.3.1 (CVE-2026-114134).

- pillow 13 requires Python 3.11, and every streamlit before 1.66.1 caps
  pillow<13, so on Python >= 3.11 pillow moves to 13 and streamlit to
  1.66.1 (which runs on Starlette/uvicorn instead of Tornado). Python 3.10
  stays on pillow 12.3.0 and streamlit 1.56.0: no fixed pillow supports it.
- GitPython floor raised to 3.2.1; certifi gets a floor in the transitive
  security constraints; the black dev floor is raised to 26.10.1.

Only the affected poetry.lock entries were spliced in, since a plain
`poetry lock` on main also drops about 20 unrelated older-Python entries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HwkxN8YriHhdXBwMc4sd8h
@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 1038be33-9434-4f53-8513-17292405446a
Commits

Reviewing files that changed from the base of the PR and between 4d9c3d2 and f3727a6.

Files selected for processing: 1
  • pyproject.toml
Files skipped from review as they are similar to previous changes: 1
  • pyproject.toml

Included review availability: This review used your included allowance. 2 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.

Walkthrough

The dependency constraints add a minimum version for certifi, raise the minimum versions for GitPython and Black, and set Python-version-specific version bounds for Pillow and Streamlit.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Suggested reviewers: m1so, mfranczel

Merge Risk: Minimal · up to f3727

No merge-blocking issue is established. Python 3.10 continues to retain the reported Pillow advisories, so that limitation should remain visible to release owners.

Pre-merge checks: Passed 5 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Updates Docs Inconclusive The PR changes only pyproject.toml and poetry.lock; it adds no documentation. CLAUDE.md states that user-visible changes to supported Python versions or pre-installed packages require matching d… Check the corresponding documentation PR in deepnote/deepnote and the roadmap entry in deepnote/deepnote-internal. Add or update documentation for the dependency and Streamlit/Pillow support changes if it is missing.
Passed Passed checks: 5 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly identifies the dependency updates intended to resolve pip-audit findings. It matches the main changes to Pillow, GitPython, Certifi, and Black.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)

Full details: Updates Docs

Explanation

The PR changes only pyproject.toml and poetry.lock; it adds no documentation. CLAUDE.md states that user-visible changes to supported Python versions or pre-installed packages require matching documentation in deepnote/deepnote. This checkout does not provide the public deepnote/deepnote repository or the private deepnote/deepnote-internal repository, so the required documentation and roadmap updates cannot be verified.

Resolution

Check the corresponding documentation PR in deepnote/deepnote and the roadmap entry in deepnote/deepnote-internal. Add or update documentation for the dependency and Streamlit/Pillow support changes if it is missing.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

📦 Python package built successfully!

  • Version: 2.9.0.dev3+73f8569
  • Wheel: deepnote_toolkit-2.9.0.dev3+73f8569-py3-none-any.whl
  • Install:
    pip install "deepnote-toolkit @ https://deepnote-staging-runtime-artifactory.s3.amazonaws.com/deepnote-toolkit-packages/2.9.0.dev3%2B73f8569/deepnote_toolkit-2.9.0.dev3%2B73f8569-py3-none-any.whl"

coderabbitai[bot]
coderabbitai Bot previously approved these changes Oct 26, 2026
@codecov

codecov Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.17%. Comparing base (11a8bed) to head (f3727a6).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #143   +/-   ##
=======================================
  Coverage   78.17%   78.17%           
=======================================
  Files         120      120           
  Lines        6837     6837           
  Branches      990      990           
=======================================
  Hits         5345     5345           
  Misses       1182     1182           
  Partials      310      310           
Flag Coverage Δ
combined 78.17% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@deepnote-bot

deepnote-bot commented Oct 26, 2026 •

Copy link
Copy Markdown

🚀 Review App Deployment Started

📝 Description 🌐 Link / Info
🌍 Review application ra-143
🔑 Sign-in URL Click to sign-in
📊 Application logs View logs
🔄 Actions Click to redeploy
🚀 ArgoCD deployment View deployment
⏰ Last deployed 2026-10-26 13:53:03 (UTC)
📜 Deployed commit 39aefeee0d49252f2c9814e7ecfab6d41161e16d
🛠️ Toolkit version 73f8569

@tkislan
tkislan marked this pull request as ready for review October 26, 2026 13:57
@tkislan
tkislan requested a review from a team as a code owner October 26, 2026 13:57
@tkislan
tkislan requested review from m1so and mfranczel October 26, 2026 13:57

This branch has not been deployed

No deployments
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