Skip to content

Baseline two benign unsloth-zoo test-file findings in scan_packages - #7325

Merged
danielhanchen merged 1 commit into
mainfrom
security/baseline-zoo-test-tmp-fp
Jul 22, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
security/baseline-zoo-test-tmp-fp

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Summary

The enforcing pip scan-packages :: hf-stack shard in security-audit.yml currently red-fails on main (and therefore on every open PR) with two CRITICAL findings:

Summary: 2 CRITICAL, 181 MEDIUM

Both are false positives in unsloth-zoo test files, flagged by the scanner's "Writes to /tmp and executes (staged dropper)" combination heuristic:

  • tests/test_mlx_save_export_regressions.py L165: temporary_location="/tmp/ignored", (a keyword argument in a mocked save/export regression test)
  • tests/test_vision_collator_audio.py L111: out = extract_audio_info(msgs({"type": "audio", key: "/tmp/a.wav"})) (an asserted path-literal fixture)

The heuristic matches a /tmp path literal alongside unrelated subprocess/__import__ references elsewhere in the same file. Those references are all mocking (monkeypatch.setattr(subprocess, "run", fake_run), monkeypatch.setattr(builtins, "__import__", ...)) and subprocess-based test isolation, not a staged dropper. These test files postdate the last baseline triage, so they are not yet suppressed.

Change

Add both findings to the reviewed allowlist scripts/scan_packages_baseline.json, keyed on (package, package-relative file, check, evidence_hash) like every other entry. Only comment-free data; no scanner logic changes.

Validation

  • Direct python scripts/scan_packages.py unsloth-zoo: was 2 CRITICAL, 17 MEDIUM, now 17 MEDIUM, exit 0 (the two CRITICALs move to suppressed: 27 to 29).
  • Exact hf-stack shard command scan_packages.py --with-deps -r audit-reqs/unsloth-deps.txt -r audit-reqs/no-torch-runtime.txt (109 archives): was 2 CRITICAL, 181 MEDIUM exit 1, now 181 MEDIUM exit 0 (suppressed 119 to 121).
  • tests/security/test_scan_packages.py baseline/partition/evidence-hash suite: 12 passed, including test_committed_baseline_entries_all_carry_evidence_hash which asserts each entry's evidence_hash recomputes from its stored evidence.

Note: the separate pip scan-packages :: extras shard's intermittent SCAN INCOMPLETE on openai-whisper resolution is an environmental PyPI-availability issue, not addressed here.

The enforcing pip scan-packages hf-stack shard fails on two CRITICAL
staged-dropper findings in unsloth-zoo test files:
tests/test_mlx_save_export_regressions.py and
tests/test_vision_collator_audio.py. Both are false positives: the
combination heuristic matches a /tmp path literal alongside unrelated
subprocess/import references in the same file, but those are mocked test
fixtures (monkeypatch.setattr on subprocess, asserted /tmp path strings),
not droppers. Add both to the reviewed allowlist so the gate stops
red-failing on legitimate test code. The scan then exits 0 on both the
hf-stack shard and a direct unsloth-zoo scan.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1285bcf951

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1562 to +1563
"evidence": "L111: out = extract_audio_info(msgs({\"type\": \"audio\", key: \"/tmp/a.wav\"})) sha256:2efe23ffbe2b91b8403aec9b700736919b59e5ca770f8e1f5501651b44b7d398",
"evidence_hash": "d416b79dd17b24214f3f7653ac01354507d7bf0fc464dee30a4a4b8998f063ba"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Regenerate the audio-test allowlist entry

The entry does not match the current unsloth-zoo audio test finding, so it will not suppress the CRITICAL result it is intended to baseline. Running check_py_file on the unsloth-zoo source produces evidence with the embedded span digest 022f81dd... and canonical evidence_hash 2d1e7544..., rather than the 2efe23ff.../d416b79d... values stored here. Because baseline matching requires that exact hash, the test_vision_collator_audio.py finding remains active and the enforcing security-audit scan continues to exit nonzero; regenerate this entry from the scanned package version.

Useful? React with 👍 / 👎.

@danielhanchen
danielhanchen merged commit f2f41bf into main Jul 22, 2026
15 checks passed
@danielhanchen
danielhanchen deleted the security/baseline-zoo-test-tmp-fp branch July 22, 2026 10:52
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