Skip to content

SEC-3320 Harden SDK dependencies, credential logging, and CI (Python 3.11+) - #476

Merged
blainekasten merged 7 commits into
mainfrom
fix/sec-3320-python-images
Oct 22, 2026
Merged

blainekasten merged 7 commits into
mainfrom
fix/sec-3320-python-images

Conversation

@TechnoFinch

@TechnoFinch TechnoFinch commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

This closes the dependency findings from the security scan and prevents SDK debug logs from disclosing credentials. Python 3.11+ is now required, allowing Pillow 13 to replace vulnerable Pillow releases. Part of SEC-3320; follows the certifi work in #474.

Changes

  • Refresh all dependency groups, including optional examples and test/quality tooling. The lock now uses Pillow 13.0.0, aiohttp 3.14.5, requests 2.34.2, urllib3 2.8.0, filelock 4.2.4, pyarrow 26.0.0, datasets 5.1.0, transformers 5.20.2, fsspec 2026.7.0, idna 3.20, pygments 2.21.0, Black 26.10.1, pytest 9.1.1, virtualenv 21.14.12, and certifi 2026.10.19.
  • Enforce patched minimums in package metadata, including certifi, so pip consumers receive the security constraints rather than relying on a Poetry-only lockfile.
  • Remove Black and unused NumPy from runtime requirements. Build this pure-Python package with poetry-core rather than installing the full Poetry application and NumPy into its build environment. NumPy remains a dependency of optional example tooling.
  • Keep request/response headers, request bodies, URL queries, and URL credentials out of debug logs. Exclude API keys and custom headers from the client dataclass representation. Add regression tests proving secrets stay out of logs while HTTP requests remain intact.
  • Align CI, publishing, tox, docs, and the devcontainer with Python 3.11+. Upgrade Poetry and the Black pre-commit hook; the small formatting-only changes are required by the patched formatter.
  • Restrict four workflows to contents: read, resolving the existing CodeQL token-permission findings.
  • Pin the verified devcontainer base by digest, install available OS updates including the fixed CA bundle, and update inherited pip/setuptools/wheel tooling. Remove unused inherited formatter/linter/Pipenv/virtualenv environments and unnecessary Node/Java features; use the project's locked quality/test tools instead. Run as non-root vscode.

Validation

  • pip-audit: zero known vulnerabilities across all 88 locked package versions, including development/examples and the alternate Python-specific NumPy resolution. Final lock versions were cross-checked against both audit reports.
  • 209 unit tests passed locally on Python 3.11, including credential-disclosure regressions. GitHub unit jobs passed on Python 3.11 and 3.12 for the dependency/code changes.
  • All pre-commit hooks (including mypy and patched Black), actionlint, and lock validation passed. GitHub CodeQL passed.
  • Wheel and source distribution built successfully. Wheel metadata verifies Requires-Python: >=3.11,<4.0 and patched runtime floors.
  • Offline tokenizer/dataset, Pillow PNG round-trip, and image CLI import smoke tests passed.
  • Final devcontainer build and run verified user vscode, Python 3.11.17, Poetry 2.5.1, Git, and ca-certificates 20250419+deb13u1. Rebuild the devcontainer to apply the image changes.

Remaining environment limitation

The live integration workflow fails because TOGETHER_API_KEY is unavailable. This predates these changes and was reproduced on the updated PR; live API integration coverage is not claimed. No API credential was added to the repository, and the failing check was not disabled.

Residual upstream development-image findings

The SDK's locked dependency graph has zero known pip-audit findings; the complete development image is not CVE-free. A local Trivy 0.76.1 OS/Python scan of the final built image reports:

  • Debian package advisories with no fixed version available in the distribution, after applying all available OS upgrades. The report contains 3,513 package/advisory matches (not 3,513 unique CVEs).
  • Six findings in libraries vendored by the latest pip 26.2.2: msgpack 1.1.2 (GHSA-6v7p-g79w-8964), setuptools 70.3.0 (CVE-2025-47273 and CVE-2026-59890), and urllib3 2.7.0 (CVE-2026-97687, CVE-2026-97688, CVE-2026-97689). Upgrading the independently installed packages does not replace pip's bundled copies. These are separate from the SDK's fixed runtime requirements.

No advisories were suppressed or dismissed. Clearing these residual findings requires upstream distribution/installer updates or a separately validated replacement development environment. Broly has also reported incomplete container/AI analysis on prior scans; its neutral status must not be treated as a clean full-image scan.


Note

High Risk
Breaking Python 3.10 support and a minor release with broad dependency bumps affect all consumers; logging changes are security-positive but alter debug observability.

Overview
Raises the minimum Python version to 3.11 and ships 1.6.0 with refreshed, security-floored dependencies (including Pillow 13, patched certifi/urllib3/transitives for pip installs), poetry-core builds, and Black removed from runtime requirements.

Reduces credential leakage in debug logging: request/response debug lines log URL paths only (not query strings, bodies, or headers); async debug no longer dumps response bodies; error paths avoid logging response content. TogetherClient hides api_key and supplied_headers from repr, with new unit tests locking this in.

CI, publish, tox, devcontainer, and docs align on Python 3.11+, Poetry 2.5.1, tighter workflow contents: read permissions, and a hardened dev image (digest-pinned base, OS/CA updates, Poetry 2.5.1, non-root user, slimmer feature set). Pre-commit Black and mypy stubs move to match the new stack.

Reviewed by Cursor Bugbot for commit 079eb7f. Bugbot is set up for automated code reviews on this repo. Configure here.

@broly-code-security-scanner

broly-code-security-scanner Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Broly Security Scan

Warning

Latest baseline snapshot is stale. Broly is running in PR-only fallback mode until the next scheduled baseline refreshes. This does not block the PR.

Caution

⚠️ Container scan did not complete for .devcontainer/Dockerfile image mcr.microsoft.com/devcontainers/python:3.11@sha256:1eb48ffd772f0618d66844eff8cbfd9914785be25f6a936d0756a1ddfc866cc3.

Note

Re-scan this PR anytime with /broly scan — useful after /broly undismiss, or to refresh findings without a new push.

Broly — SAST (GLM-5.3-Flash) · Secrets · SCA · IaC · GH Actions · Base Images · Supply Chain Threats · Attack Hypotheses · Adversarial Verification

We're continuously improving Broly's accuracy and finding quality — your feedback is valuable. False positives, missed findings, bugs, and feature requests all welcome.

Ask in #security-engineering   Powered by Together AI

@TechnoFinch TechnoFinch changed the title fix(security): update ca-certificates in container images (CVE-2026-111943) fix(security): update ca-certificates (CVE-2026-111943) and bump Pillow to 12.3.0 (CVE-2026-42311, CVE-2026-25990) Oct 22, 2026
Comment thread poetry.lock Fixed
Comment thread poetry.lock Fixed
Comment thread poetry.lock Fixed
Comment thread poetry.lock Fixed
Comment thread poetry.lock Fixed
Comment thread poetry.lock Fixed
Comment thread poetry.lock Fixed
Comment thread poetry.lock Fixed
Comment thread poetry.lock Fixed
Comment thread poetry.lock Fixed
…quire Python 3.11

Pillow 12.x is affected by 39 advisories fixed only in Pillow 13.0.0, which
requires Python >= 3.11. Python 3.10 reached end of life in October 2026.

- pyproject.toml: python ^3.11, pillow ^13.0.0, black target py311
- poetry.lock: targeted re-lock; pillow 13.0.0, drops py3.10-only backports
  (async-timeout, exceptiongroup, tomli); no other versions moved
- CI: drop 3.10 from unit/integration matrices; publish on 3.11
- devcontainer base python:3.10 -> python:3.11; tox, README, CONTRIBUTING
@TechnoFinch TechnoFinch changed the title fix(security): update ca-certificates (CVE-2026-111943) and bump Pillow to 12.3.0 (CVE-2026-42311, CVE-2026-25990) fix(security): update ca-certificates (CVE-2026-111943) and bump Pillow to 13.0.0 (CVE-2026-96639 and 38 more); require Python 3.11 Oct 22, 2026
Comment thread .devcontainer/Dockerfile Fixed
Comment thread .devcontainer/Dockerfile Fixed
Comment thread .devcontainer/Dockerfile Fixed
@TechnoFinch TechnoFinch changed the title fix(security): update ca-certificates (CVE-2026-111943) and bump Pillow to 13.0.0 (CVE-2026-96639 and 38 more); require Python 3.11 SEC-3320 Harden SDK dependencies, credential logging, and CI (Python 3.11+) Oct 22, 2026
@dac-together
dac-together self-requested a review October 22, 2026 20:57
@blainekasten
blainekasten merged commit 807b790 into main Oct 22, 2026
9 of 11 checks passed
@blainekasten
blainekasten deleted the fix/sec-3320-python-images branch October 22, 2026 20:59
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.

4 participants