Skip to content

fix(toolbox): install PyJWT 2.15.1 over semgrep's vulnerable pin - #75

Merged
garymike merged 1 commit into
mainfrom
fix/pyjwt-cve-2026-102268
Sep 30, 2026
Merged

garymike merged 1 commit into
mainfrom
fix/pyjwt-cve-2026-102268

Conversation

@garymike

Copy link
Copy Markdown
Owner

The Trivy publish gate rejected sast-toolbox and skill-audit-toolbox on the build for #74:

CVE-2026-102268 — CRITICAL, PyJWT 2.13.0, fixed in 2.14.0. semgrep requires pyjwt[crypto]~=2.13.0, so the fix is uninstallable while that constraint holds.

Not a regression from #74

semgrep 1.177.0 — the previous pin — carries the identical constraint, and 1.178.0 is the newest release, so there is nothing to bump to. The CVE was published 2026-09-28 20:26Z, eight hours after the 12:25Z build that passed.

The gate is firing on a pre-existing condition that just became known. Which means the currently published sast-toolbox:latest and skill-audit-toolbox:latest — live, scanning every caller — already contain it. The gate blocks new publishes; it cannot retract what shipped.

Why not a VEX entry

The flaw is an HS/asymmetric confusion bypass: is_pem_format misses some PEM encodings, so a mutated public key gets treated as an HMAC secret and anyone who knows the public key can forge tokens. It requires an application that mixes HMAC and asymmetric algorithms and accepts caller-supplied raw key bytes. semgrep touches PyJWT only to authenticate to Semgrep AppSec Platform; sast.yml and skill-audit.yml supply no SEMGREP_APP_TOKEN and run OSS rule packs via --config, so no JWT is ever decoded.

So not_affected / vulnerable_code_not_in_execute_path would be defensible, and .trivy/toolbox.openvex.json is where it would go. It is deliberately not going there — that file sets the standard itself:

a fixable finding is fixed, not excepted

Upstream marks this fixed in 2.14.0. So PyJWT 2.15.1 is installed over semgrep's constraint with --no-deps, and the vulnerable code is gone rather than argued about. cryptography already arrives with semgrep, so the [crypto] extra is not needed.

Bookkeeping

  • pyjwt recorded in tools.lock under both image sections, so the weekly drift check tracks it
  • ARG named PYJWT_VERSION, matching apply-tool-bumps.py's arg_name() convention, so future bumps are automatic
  • The override carries a comment saying when to remove it: once semgrep relaxes the pin and pip resolves 2.14.0+ unaided

dogfood-scan builds both images from source and runs semgrep against this repo, so CI is the functional check that overriding the constraint does not break semgrep.

The Trivy publish gate rejected sast-toolbox and skill-audit-toolbox on the build for #74: CVE-2026-102268, CRITICAL, PyJWT 2.13.0, fixed in 2.14.0.

Not a regression from that bump. semgrep 1.177.0 -- the previous pin -- carries the identical pyjwt[crypto]~=2.13.0 constraint, and 1.178.0 is the newest release, so there is nothing to bump to. The CVE was published 2026-09-28 20:26Z, eight hours after the 12:25Z build that passed. The gate is firing on a pre-existing condition that just became known, which means the currently published sast-toolbox:latest and skill-audit-toolbox:latest already contain it.

The flaw is an HS/asymmetric confusion bypass: is_pem_format misses some PEM encodings, so a mutated public key is treated as an HMAC secret and anyone who knows the public key can forge tokens. It needs an application that mixes HMAC and asymmetric algorithms AND accepts caller-supplied raw key bytes. semgrep touches PyJWT only to authenticate to Semgrep AppSec Platform; these workflows supply no SEMGREP_APP_TOKEN and run OSS rule packs via --config, so no JWT is ever decoded.

So it is defensible as not_affected, and .trivy/toolbox.openvex.json is where that would go. It is not going there: that file's own standard is that a fixable finding is fixed, not excepted, and upstream marks this one fixed in 2.14.0. PyJWT 2.15.1 is installed over semgrep's constraint with --no-deps instead, so the vulnerable code is gone rather than argued about.

pyjwt is recorded in tools.lock under both image sections, so the weekly drift check tracks it and the ARG follows apply-tool-bumps.py's naming (PYJWT_VERSION). Drop the override once semgrep relaxes its pin and pip resolves 2.14.0+ on its own.

dogfood-scan builds both images from source and runs semgrep against this repo, so CI is the functional check that the override does not break it.
@garymike
garymike merged commit d28c15e into main Sep 30, 2026
9 checks passed
@garymike
garymike deleted the fix/pyjwt-cve-2026-102268 branch September 30, 2026 02:49
garymike added a commit that referenced this pull request Sep 30, 2026
sast, iac-security, gha-security and skill-audit pulled their domain image by :latest, so a toolbox rebuild silently changed what every caller scanned with -- the failure mode the digest pin in security-scan.yml exists to prevent (betterleaks 1.6.1 -> 1.8.1 in #64 turned green repos red overnight). All four now pin by digest, with the same rationale comment.

security-scan.yml's own pin is bumped in the same commit. It still referenced 5614f8b9, the base image built before the #67 and #70 tool bumps, so it had drifted from tools.lock -- exactly what its comment says not to let happen.

Every digest here comes from build 36661628989, the rebuild after #75, which is the first run in which all six images published: the Trivy publish gate had been rejecting sast and skill-audit over CVE-2026-102268 until PyJWT was fixed.

These five now move deliberately, alongside toolbox/tools.lock. dogfood-scan is untouched -- it builds from source at :ci tags and never pulls from the registry.
garymike added a commit that referenced this pull request Oct 1, 2026
* chore(workflows): pin every toolbox image by digest

sast, iac-security, gha-security and skill-audit pulled their domain image by :latest, so a toolbox rebuild silently changed what every caller scanned with -- the failure mode the digest pin in security-scan.yml exists to prevent (betterleaks 1.6.1 -> 1.8.1 in #64 turned green repos red overnight). All four now pin by digest, with the same rationale comment.

security-scan.yml's own pin is bumped in the same commit. It still referenced 5614f8b9, the base image built before the #67 and #70 tool bumps, so it had drifted from tools.lock -- exactly what its comment says not to let happen.

Every digest here comes from build 36661628989, the rebuild after #75, which is the first run in which all six images published: the Trivy publish gate had been rejecting sast and skill-audit over CVE-2026-102268 until PyJWT was fixed.

These five now move deliberately, alongside toolbox/tools.lock. dogfood-scan is untouched -- it builds from source at :ci tags and never pulls from the registry.

* docs(toolbox-scan): stop the input description contradicting its default

The image input advised pinning by digest while defaulting to :latest.

Keeping the mutable default is deliberate, and is the one place this repo should not follow the digest rule: this is a public action, and pinning its default would freeze external callers on a digest they never chose and silently stop their scanner updates. The reusable workflows pin because their images are bumped here, deliberately, alongside tools.lock; a third party has no such cadence.

So the description now says what the default actually does and offers pinning as the opt-in, rather than advising one thing and doing another.
garymike added a commit that referenced this pull request Oct 21, 2026
…#87)

GHSA-6q48-6c7w-9gw2 (CRITICAL): certifi bundles emSign root CAs whose
intermediate keys were compromised. Fixed in certifi 2026.10.19.

The vulnerable copy is pip's vendored one, which `pip install` cannot reach.
Three different versions were in play, which is what made this confusing to
read off a Trivy table:

  site-packages/certifi              2026.10.19  already fine, resolves on its own
  pip/_vendor/certifi                2026.6.17   from the python base layer, flagged

pip 26.2.2 vendors certifi 2026.10.19, so this is a fix and not a VEX
exception. .trivy/toolbox.openvex.json already states the rule: a fixable
finding is fixed, not excepted.

Done in the base final stage because all five domain images inherit
FROM ${BASE}, and the vulnerable copy came from the shared python layer
rather than from anything they install. Pinned as ARG PIP_VERSION with a
tools.lock row rather than a bare --upgrade, so the drift gate tracks it and
apply-tool-bumps.py can move it later: arg_name("pip") is PIP_VERSION, which
matches the applier's convention.

Verified: base reports pip 26.2.2 with vendored certifi 2026.10.19 and all
four scanners still run. A derived skill-audit image built on it has BOTH
copies at 2026.10.19, so the fix survives FROM and the derived pip install
does not pull an older certifi into site-packages, which would have moved the
finding rather than removed it. Drift check reports pip up to date.

No changelog entry, matching #75 and #62, the two previous CVE unbreak-main
fixes.

Co-authored-by: Claude Opus 5 <[email protected]>
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