scan_packages: baseline transitive-dep drift in the supply-chain scan#6917
Conversation
The pip scan-packages gate (SCAN_ENFORCE=1) blocks on non-baselined CRITICAL/HIGH findings. Recent upstream releases of transitive dependencies added new files/loops that trip the pattern scanner, so all three shards (extras, hf-stack, studio) red-failed on legitimate library code. Add the 7 reviewed findings to scripts/scan_packages_baseline.json. Each entry is genuine upstream code from the official PyPI archive: - huggingface-hub huggingface_hub/_sandbox.py (staged dropper + C2 loop): the HF Jobs sandbox bootstrap string and its host-pool reservation loop. New in huggingface_hub 1.x (pulled via huggingface_hub>=0.34.0). - huggingface-hub huggingface_hub/hf_api.py, utils/_http.py (C2 loop): standard polling / retry while True loops. - fastapi fastapi/routing.py (C2 loop): websocket receive loop. - fastmcp-slim fastmcp/cli/apps_dev.py (fs enum + network): the FastMCP dev CLI (PrefectHQ) making httpx/socket calls. - cffi cffi/_cffi_gen_src.py (compile + exec): cffi generating and running C extension source, its core purpose. Additive only: no existing baseline entry is changed or removed. Verified by re-running the scanner over the full closure on Python 3.12.13 (the CI interpreter); it now exits 0 with only MEDIUM findings remaining.
|
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 updates scripts/scan_packages_baseline.json to add several package scanning baseline exceptions for fastapi, fastmcp-slim, huggingface-hub, and cffi. No review comments were provided, so I have no feedback to offer.
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
The
Security auditworkflow'spip scan-packagesgate runsscripts/scan_packages.py --with-depswithSCAN_ENFORCE=1, whichdownloads the full transitive dependency closure and blocks on any
CRITICAL/HIGH pattern-scan finding that is not in
scripts/scan_packages_baseline.json.Recent upstream releases of transitive dependencies added new files and
loops that the pattern scanner flags, so all three shards red-failed on
mainon legitimate library code:pip scan-packages :: extras(4 CRITICAL, 1 HIGH)pip scan-packages :: hf-stack(4 CRITICAL)pip scan-packages :: studio(6 CRITICAL, 1 HIGH)This is dependency-baseline drift, not a code change in this repo. The
biggest driver is
huggingface_hub1.22.0 (published 2026-07-03), pulledin via
huggingface_hub>=0.34.0; it ships a new_sandbox.py(HF Jobssandbox) plus new
while Trueloops. The remaining ones come fromfastapi,fastmcp-slimandcffi.Fix
Add the 7 reviewed findings to the baseline. Each was confirmed to be
genuine upstream code from the official PyPI archive, not a typosquat or
injected payload:
huggingface_hub/_sandbox.py_BOOTSTRAP_DOWNLOAD) that fetches HF's ownsbx-serverhuggingface_hub/_sandbox.pywhile Trueloophuggingface_hub/hf_api.pyhuggingface_hub/utils/_http.pyfastapi/routing.pyfastmcp/cli/apps_dev.pycffi/_cffi_gen_src.pyThe change is additive only: no existing baseline entry is changed or
removed.
Verification
Re-ran
scripts/scan_packages.py --with-depsover the full closure ofall shard requirement files on Python 3.12.13 (the CI interpreter). The
while Truespan digests generated locally match the CI logs exactly(e.g.
_sandbox.pysha256:33ceddf9...,hf_api.pysha256:f764b6ca...,_http.pysha256:c75d1ee2...), confirming identical resolved versions.With the updated baseline the scan exits 0: all 140 CRITICAL + 72 HIGH
findings are suppressed and only MEDIUM (non-blocking) findings remain.
Note on the other red check (
Core / HF=4.57.6 + TRL<1)Out of scope for this PR. Its failing step,
unsloth_zoo @ main - full pytest (CPU), fails 6 tests inunsloth_zoo'stests/test_moe_bnb4bit_per_expert_conversions.pywithAttributeError: 'WeightConverter' object has no attribute 'target_patterns'. Root cause is anunsloth_zoo-side interaction, notthe studio merge: that test (added in unsloth_zoo #856) guards with
pytest.importorskip("transformers.core_model_loading"), but unsloth'simport_fixes.pyintentionally injects a stubcore_model_loadingmodule on transformers 4.x (to keep peft 0.19 LoRA reloads working), so
the guard does not skip and the test runs against the inert stub. The
identical 6 failures are present on the previous
maincommit(
eb1ef442), so it predates this PR's HEAD. The correct fix belongs inunsloth_zoo(guard on the real v5 module, not mere importability), notin unsloth.