scan_packages: baseline sentencepiece dup2 finding after upstream reindent - #7120
Conversation
…ndent The supply-chain scan gates on non-baselined CRITICAL/HIGH findings. A newer sentencepiece release reindented the stdout/stderr fd-redirect helper in sentencepiece/__init__.py (the os.dup2 pair the heuristic flags as a reverse/bind-shell pattern), moving it from L1221/L1226 to L772/L777 and changing its leading indentation. The baseline key is (package, package-relative file, check, evidence_hash), where evidence_hash is over the matched code with the L<NN>: markers stripped but the code's own indentation preserved. The reindent therefore changed the hash (bba233.. -> 65b5a11c..), so the existing entry no longer suppressed the finding and it resurfaced as a blocking CRITICAL in the hf-stack and studio scan legs. Add the new indentation variant to the allowlist. The calls are sentencepiece redirecting stdout/stderr file descriptors to capture its C++ logs, not a shell; no socket or networking is involved. The old L1221 entry is kept so both versions stay covered.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
There was a problem hiding this comment.
Code Review
This pull request adds a baseline exception for the 'sentencepiece' package in 'scripts/scan_packages_baseline.json' to ignore a critical severity 'Reverse shell / bind shell pattern' check. There are no review comments, so I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
What
Add the current-indentation variant of the sentencepiece
os.dup2finding to thescan_packages.pyallowlist so the supply-chain scan stops blocking on it.Why it was failing
pip scan-packages :: hf-stackandpip scan-packages :: studioboth fail on the "Scan declared + transitive Python deps" step with a single non-baselined CRITICAL:This is a benign false positive: sentencepiece redirects stdout/stderr file descriptors to capture its C++ logs, and the heuristic flags
os.dup2because reverse shells dup socket fds onto 0/1/2. No socket or networking is involved.The finding is already allowlisted, but the baseline key is
(package, package-relative file, check, evidence_hash), whereevidence_hashis over the matched code with theL<NN>:markers stripped and the code's own indentation preserved. A newer sentencepiece release reindented this block, moving it from L1221/L1226 to L772/L777 and changing its leading indentation. That changed the hash (bba233..to65b5a11c..), so the existing entry no longer matched and the finding resurfaced as a blocking CRITICAL. The scan gate only trips on non-baselined CRITICAL/HIGH, which is why the MEDIUM findings are unaffected.Fix
Add the new indentation variant to
scripts/scan_packages_baseline.json. The old L1221 entry is kept so both sentencepiece versions stay covered.Verified with the scanner's own
_load_baseline/_finding_key: the L772/L777 finding key is now present in the baseline set, and the old L1221 variant is still covered.