Skip to content

Baseline the eight unsloth-zoo 2026.10.1 findings after review - #12884

Merged
danielhanchen merged 2 commits into
mainfrom
ci/scan-baseline-zoo-2026-10-1
Oct 6, 2026
Merged

danielhanchen merged 2 commits into
mainfrom
ci/scan-baseline-zoo-2026-10-1

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

pip scan-packages :: hf-stack in Security audit went red on main (8435a749be, run 37506595163) once unsloth-zoo 2026.10.1 reached PyPI. All 8 findings are at sites already reviewed in scripts/scan_packages_baseline.json; the release moved them outside their pins:

Site Check What differs
unsloth_zoo/compiler.py Advanced obfuscation + exec/eval same matched code, new file digest
unsloth_zoo/llama_cpp.py Harvests env vars + network same matched code, new file digest
unsloth_zoo/mlx/loader.py Advanced obfuscation + exec/eval 1 matched line appended
unsloth_zoo/temporary_patches/gpt_oss.py Downloads and executes remote code same matched code, new file digest
unsloth_zoo/temporary_patches/moe_utils.py Advanced obfuscation + exec/eval same matched code, new file digest
unsloth_zoo/vision_utils.py Harvests env vars + network same matched code, new file digest
unsloth_zoo/vision_utils.py Cloud metadata/IMDS + network same matched code, new file digest
unsloth_zoo/vllm_utils.py Advanced obfuscation + exec/eval same matched code, new file digest

Review

  • Seven entries have an evidence hash identical to an entry already in the baseline; only the file digest changed, so the flagged code is exactly what was reviewed before.
  • mlx/loader.py: compared line by line against the previous entry, every match is the same statement shifted down, except one new model.eval() at L3412. Read in the 2026.10.1 wheel, it is nn.Module.eval() switching the model to eval mode inside _mlx_module_state_restored so dropout does not draw from a seeded RNG. It is not Python eval.

Change

The 8 entries are appended to scripts/scan_packages_baseline.json with their 2026.10.1 evidence hash and file digest pins, same as #12515 did for 2026.9.9. All 8 carry a 2026.10.1 file digest, checked against the files in the wheel. No existing entry is modified or removed.

Writer fix

_write_baseline carried a file_sha256 pin over only for an unchanged evidence hash. mlx/loader.py has been pinned since 2026.9.x, but its new variant has a new evidence hash, so regeneration wrote it unpinned and it would have suppressed the finding for any file contents. The writer now keeps a site (package, file, check) pinned once it has been reviewed under a pin. test_write_baseline_keeps_a_pinned_site_pinned_when_its_evidence_changes covers it, and mlx/loader.py joins the must-be-pinned list in test_context_dependent_unsloth_zoo_findings_are_digest_pinned with its four older unpinned variants grandfathered. Each test fails with its fix reverted.

Verification

  • python scripts/scan_packages.py -r <unsloth-zoo==2026.10.1>: exit 1 on main with the 8 findings above, exit 0 on this branch with 22 suppressed.
  • tests/security/test_scan_packages.py, tests/security/test_scan_npm_packages.py: 203 passed.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-06T19:11:59.185105Z d6790a0 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 1c02db953f

ℹ️ 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 thread scripts/scan_packages_baseline.json Outdated
"check": "Advanced obfuscation (marshal/compile/zlib) + exec/eval",
"severity": "HIGH",
"evidence": "Obfusc: L5202: _mod = __import__(module_name, fromlist=[\"_\"])\nExec: L162: mx.eval(model.parameters()) | L196: mx.eval([v for k, v in tree_flatten(casted) if is_mlx_norm_parameter_path(k)]) | L1440: mx.eval(model.parameters()) | L1441: mx.eval(mx.distributed.all_sum(mx.array(1.0), stream=mx.cpu)) | L1508: mx.eval(model.parameters()) | L1511: mx.eval(mx.distributed.all_sum(mx.array(1.0), stream=mx.cpu)) | L2940: mx.eval(altup.correct(predictions, activated)) | L3412: model.eval() | L3489: mx.eval(baseline, perturbed) | L4850: model.eval() | L5607: mx.eval(model.parameters()) | L5723: mx.eval(module.weight) | L8326: mx.eval(model.parameters()) | L8343: mx.eval(target.parameters()) | L9342: lambda: mx.eval(model.parameters()), | L9406: lambda: mx.eval(model.parameters()), | L9569: mx.eval(model.parameters())",
"evidence_hash": "d1c32d6d0a0f4625af70ef11ce765a893c07f48e54c21fb8ff5ef43381daf18e"

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 Pin the new MLX baseline entry to the reviewed file

This entry omits file_sha256, unlike the previously reviewed mlx/loader.py revision and the other seven entries added here. _load_baseline therefore records this key as unpinned and _partition_baseline will suppress it for any file digest, so a future unsloth-zoo release that retains these matched eval/import lines while adding or changing a payload elsewhere in the file will pass the security gate without review. Add the digest of the reviewed 2026.10.1 file so unrelated file changes reopen the finding.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Correct. The entry is now pinned to the 2026.10.1 file digest. The cause was in _write_baseline: it only carried a pin over for an unchanged evidence hash, so a pinned site whose matched lines changed was written unpinned. It now keeps any site that was reviewed under a pin pinned, with a test for that, and mlx/loader.py joins the must-be-pinned guard with its four older unpinned variants grandfathered. Both fail when the fix is reverted.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 6, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: d6790a0760

ℹ️ 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".

@danielhanchen
danielhanchen merged commit 6c3d915 into main Oct 6, 2026
@danielhanchen
danielhanchen deleted the ci/scan-baseline-zoo-2026-10-1 branch October 6, 2026 19:20
danielhanchen added a commit that referenced this pull request Nov 24, 2026
… again (#19245)

## Keep scan_packages.py clear of Bitdefender's Python stealer signature
again

`scripts/scan_packages.py` on main is flagged again on VirusTotal as
`Generic.PY.STEALER.B`, the same detection #12169 fixed in September.
Bitdefender, and every engine that ships its signatures, quarantines the
file on a contributor's machine.

### What changed

Comments only. The comment trim in #12969 shortened several comment
blocks near the top of the file; that is what brought the detection
back. This restores those comments (the 28 edits above the anti-analysis
patterns) and keeps the rest of the trim. The parsed code is identical
to main (same `ast.dump`), so behaviour does not change.

One line is added above `_joined` noting that trimming the comments
there re-triggered it, so the next cleanup rescans the file.

### Evidence (VirusTotal, fresh uploads, 2026-11-24)

| Version of `scripts/scan_packages.py` | Detections |
|---|---|
| After #12169 (Sep 27) and after #12884 (Oct 6) | 0 |
| After #12969 (Oct 26) | 8: ALYac, Arcabit, BitDefender, Emsisoft,
GData, MicroWorld-eScan, VIPRE `Generic.PY.STEALER.B`; CTX
`script.spyware.generic` |
| main today (after #16112) | the same 8 |
| main with the top 28 comment edits reverted | 0 |
| This PR | 0 / 72 (sha256
`29cb47f1b33b57815d75a1a76476c53b068ce452068c8569d10ea2f949b968af`) |

Bisecting the 110 comment edits between #12884 and main: applying only
edits 55 to 110 stays clean, while several small subsets of edits 0 to
21 each bring the detection back on their own. The detection reacts to
how much comment text separates the pattern tables near the top of the
file, not to any single word.

### Tests

- `tests/security/test_scan_packages.py`,
`tests/security/test_lint_av_shapes.py`,
`tests/test_scripts_write_lf.py`: 181 passed.
- `scripts/lint_av_shapes.py`: 0 new errors. Pre-commit ruff clean.

### Not covered

- Engines can change their signatures at any time; this is clean against
today's.
- Other files were not affected: the installers, setup scripts,
uninstallers, `studio/install_*.py` helpers and `scan_npm_packages.py`
on main are all 0 detections today.
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