Repository navigation
build(binary): keep brotli out of the standalone binary - #130
Merged
Merged
Conversation
brotli reaches the PyInstaller bundle only through the dev-group py7zr, but urllib3 enables brotli response decoding whenever it is importable, so frozen binaries advertised Accept-Encoding: br on every remote scan. Exclude brotli/brotlicffi (py7zr works without them) and fail the build if they are bundled again.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Keeps brotli out of the PyInstaller standalone binary, and fails the build if it is ever bundled again.
Why
binaries.ymlinstalls--with dev, so PyInstaller followsaisbom/corpus.py's lazyimport py7zrand bundles py7zr together with itsbrotlidependency. urllib3 turns on brotli response decoding whenever brotli is importable, so the frozen binary advertisedbron every remote scan (hf://and HTTP URLs) and would run a native brotli decoder on whatever the server sent back. Users get nothing from that: py7zr is only used to write one test-corpus fixture. pip installs are unaffected because py7zr is not a runtime dependency.Brotli advisory for reference: GHSA-9v8h-qqgm-4m35. The lock has carried the patched 1.2.1 since #129; this change removes the decoder from the binary altogether.
Change
scripts/build_binaries.sh:--exclude-moduleforbrotli,_brotliandbrotlicffi, plus a post-build check that lists the archive (pyi-archive_viewer) and exits non-zero if any of them is present.binaries.ymlcalls this script, so the check runs on every release build.aisbom.spec: regenerated by the build; it now carries the sameexcludes.aisbom bypass-scorecardneeds it to build the 7z case. Excluding py7zr as well would make that documented command fail in the binary, because binary users cannotpip install py7zr.Verification
aisbom scan http://…call):Accept-Encoding: gzip, deflate, br, zstdAccept-Encoding: gzip, deflate, zstd_brotli,brotliandpy7zrin the archive, which the check matches.build_binaries.shand thebinaries.ymlmatrix (linux-amd64, macos-15-intel, macos-14 arm64): https://github.com/Lab700xOrg/aisbom/actions/runs/41261108835. Every leg printedOK: brotli not bundled, passed the exit-code contract (CRITICAL CycloneDX/SPDX = 2, markdown--no-fail-on-risk= 0, missing target = 1), includedmock_malware.ptin both SBOMs, and ranbypass-scorecard. The temporary workflow and branch have been deleted.bypass-scorecardoutput is byte-identical between the old and new binary, and the full release smoke contract passes.