Skip to content

scripts: refresh scan_packages allowlist baseline - #7032

Merged
danielhanchen merged 2 commits into
mainfrom
scan-baseline-refresh
Jul 9, 2026
Merged

danielhanchen merged 2 commits into
mainfrom
scan-baseline-refresh

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

What

Regenerate scripts/scan_packages_baseline.json so the blocking pip scan-packages security gate matches what the scanner currently finds against the resolved dependency set.

The baseline had drifted: several allowlisted entries pointed at benign findings whose code had since shifted lines (so their evidence_hash no longer matched), and a couple of mainstream-library findings were newly surfaced and never allowlisted. Because the gate runs with SCAN_ENFORCE=1, the drift made the scan-packages jobs fail on every PR, not just this one.

How

Rebuilt the allowlist by running scripts/scan_packages.py --with-deps --no-baseline --write-baseline over the same requirement shards the workflow uses (hf-stack, studio, extras), then unioned the results. Net delta versus the previous baseline is small (195 to 191 entries):

Added (benign, newly surfaced):

  • torch/_inductor/codecache.py - torch.compile inductor cache: base64-decodes a cached compile artifact and invokes the compiler via subprocess.
  • torch/testing/_internal/common_utils.py - import socket in torch's internal test utilities.
  • unsloth-zoo test fixtures writing to /tmp (gguf/mlx regression tests) and unsloth_zoo/mlx/loader.py dynamic __import__ plus MLX mx.eval.

Removed (stale): the same benign findings under old hashes whose code moved, plus a few whose matching code changed enough that they no longer trigger.

Every remaining entry is a CRITICAL/HIGH finding manually judged benign; matching is on (package, file, check, evidence_hash), so version bumps and line shifts do not reopen an entry but genuinely changed code does.

Validation

The scan-packages jobs in this PR's CI re-run the scanner against the same shards and enforce the refreshed baseline, so a green run here confirms the hashes line up with what CI resolves.

Regenerate scripts/scan_packages_baseline.json against the current
resolved dependency set so the blocking pip scan-packages gate matches
what the scanner now finds. Refreshes evidence hashes for benign
findings whose code shifted lines (unsloth-zoo mlx loader, gguf/mlx
test /tmp fixtures) and adds two mainstream-library entries that were
newly surfaced (torch inductor codecache base64+subprocess compile
cache, torch testing common_utils socket import). Stale entries whose
matching code changed and no longer triggers are dropped.

All entries remain CRITICAL/HIGH findings manually judged benign;
matched on (package, file, check, evidence_hash).

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the package scanning baseline file scripts/scan_packages_baseline.json. It modifies line numbers, evidence, and hashes for several existing package checks, adds new baseline entries for packages such as fastapi, huggingface-hub, multiprocess, torch, unsloth-zoo, cffi, and tensorboard, and removes redundant entries at the end of the file. 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.

The security-audit pull_request trigger listed the scanners but not
their allowlist baselines, so a baseline-only edit never re-ran the
scan that consumes it. A refreshed baseline could therefore merge
without CI confirming its evidence hashes match what the scanner finds.
Add scan_packages_baseline.json and scan_npm_packages_baseline.json to
the paths filter so baseline changes are validated on their own PR.
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