Skip to content

Security audit: re-approve fastmcp-slim 4.0.x and unsloth-zoo 2026.8.17 - #10187

Merged
danielhanchen merged 1 commit into
mainfrom
reapprove-scan-baseline-fastmcp4-zoo-2026-8-17
Sep 2, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
reapprove-scan-baseline-fastmcp4-zoo-2026-8-17

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

pip scan-packages :: hf-stack and :: studio are red on main and on every PR that runs them. No repo commit caused either. Both are the allowlist going stale against a new upstream release, which is the documented maintenance step for this gate, same as #9674 did for unsloth-zoo 2026.8.14.

The allowlist matches on a hash of the matched code, so a release that rewrites a flagged line reopens its entry:

  • fastmcp-slim 4.0.0 published 2026-08-31T18:20Z, which renamed httpx to httpx2 in the matched lines. The last green run on main was 17:32Z and the first red was 18:54Z; the boundary commit only touches CSS and TSX.
  • unsloth_zoo 2026.8.17 published 2026-09-01T16:16Z, which rewrote the matched region of compiler.py.

The four findings, reviewed

I read the flagged code rather than regenerating on trust.

fastmcp-slim fastmcp/cli/apps_dev.py, CRITICAL, archive plus network. The dev CLI fetches @modelcontextprotocol/ext-apps from the npm registry and extracts package/dist/src/app-bridge.js to serve a dev UI. The tarfile.open is mode="r:gz", so it reads an archive rather than creating one; the check's "creates archive with sensitive data" half does not apply at all. Only the evidence text moved, httpx to httpx2.

fastmcp-slim fastmcp/server/auth/providers/jwt.py, HIGH, embedded key plus network. The PEM strings are markers in _looks_like_pem_public_key, a format detector that returns a bool; there is no embedded key. The network call is client.get(self.jwks_uri), ordinary JWKS fetching. It now matches two client sites instead of one, which is what changed the hash.

unsloth-zoo unsloth_zoo/compiler.py, HIGH, obfuscation plus exec. Ours. The match is __import__(model_location, fromlist=items) plus the chr(92) in the training banner, which is how the backslashes in the ASCII sloth are escaped.

unsloth-zoo unsloth_zoo/mlx/loader.py, HIGH, obfuscation plus exec. Ours. __import__(module_name, fromlist=["_"]), and the "exec" half is mx.eval(...), MLX's array evaluation, not Python's eval.

What changed

Deliberately additive, 25 insertions and 1 deletion:

  • three new entries for the reopened evidence hashes
  • one file_sha256 re-pin on the compiler.py entry, whose evidence hash still matched

No existing entry is removed. I had first replaced the eight superseded hashes for these files and backed that out: dropping an entry can reopen a finding on any shard that resolves an older version, and :: extras is currently green. Stale entries are dead weight, not a hazard, so removing them is a separate cleanup.

I did not regenerate the whole baseline with --write-baseline. That rewrites all 220 entries from one run and would auto-approve anything else that has appeared since the last review, which is the opposite of what this gate is for.

Checks

python scripts/scan_packages.py fastmcp-slim unsloth-zoo goes from exit 1, with 1 CRITICAL and 3 HIGH unsuppressed, to exit 0 with 14 suppressed and only MEDIUM remaining, which this gate does not enforce.

One limit worth stating: I could not run a full shard locally, because audit-reqs/ is generated inside the workflow and the real scan resolves hundreds of transitive packages. The shards on this PR are the authoritative check. From the failing logs on main, the only unsuppressed CRITICAL/HIGH in either shard were these four.

Worth fixing separately

pyproject.toml floats fastmcp>=3.0.2 and unsloth_zoo>=2026.8.17 with no upper bound, while CI gates on a content-hashed allowlist with SCAN_ENFORCE=1. That combination puts main red on every upstream release of a flagged package until someone re-reviews, which is what happened twice this week. Options are an upper bound on these two, or keeping direct dependencies enforcing while transitive third-party findings go advisory. That is a policy call, so I have not made it here.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 2, 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-09-02T10:51:44.751254Z edb45ba PR opened
ℹ️ 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: edb45ba150

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

"evidence": "Obfusc: L1240: _mod = __import__(model_location, fromlist=items) | L5329: f\" {chr(92)}{chr(92)} /| Num examples = {num_examples:,} | Num Epochs = {num_train_epochs:,} | Total steps = {max_steps:,}\\\\n\"\\\\\nL5330: f\"O^O/ {chr(92)}_/ {chr(92)} Batch size per device = {self._train_batch_size:,} | Gradient accumulation steps = {args.gradient_accumulation_steps}\\\\n\"\\\\\nL5331: f\"{chr(92)} / Data Parallel GPUs = {args.world_size} | Total batch size ({self._train_batch_size} x {args.gradient_accumulation_steps} x {args.world_size}) = {total_train_batch_size: sha256:b7ea9cdbe360ad323911014caf12a9d4ec87cb36195a511080e4e484c2fb80d2\nL5332: f' \"-____-\" Trainable parameters = {get_model_param_count(model, trainable_only=True):,} of {get_model_param_count(model):,} ({get_model_param_count(model, trainable_only=True)/get_model_p sha256:9e832c1e7b2815aa44dc42638d821cb9df22550db88d85bd4bfb29c13f984b53 | L5330: f\"O^O/ {chr(92)}_/ {chr(92)} Batch size per device = {self._train_batch_size:,} | Gradient accumulation steps = {args.gradient_accumulation_steps}\\\\n\"\\\\\nL5331: f\"{chr(92)} / Data Parallel GPUs = {args.world_size} | Total batch size ({self._train_batch_size} x {args.gradient_accumulation_steps} x {args.world_size}) = {total_train_batch_size: sha256:b7ea9cdbe360ad323911014caf12a9d4ec87cb36195a511080e4e484c2fb80d2\nL5332: f' \"-____-\" Trainable parameters = {get_model_param_count(model, trainable_only=True):,} of {get_model_param_count(model):,} ({get_model_param_count(model, trainable_only=True)/get_model_p sha256:9e832c1e7b2815aa44dc42638d821cb9df22550db88d85bd4bfb29c13f984b53 | L5329: f\" {chr(92)}{chr(92)} /| Num examples = {num_examples:,} | Num Epochs = {num_train_epochs:,} | Total steps = {max_steps:,}\\\\n\"\\\\\nL5330: f\"O^O/ {chr(92)}_/ {chr(92)} Batch size per device = {self._train_batch_size:,} | Gradient accumulation steps = {args.gradient_accumulation_steps}\\\\n\"\\\\\nL5331: f\"{chr(92)} / Data Parallel GPUs = {args.world_size} | Total batch size ({self._train_batch_size} x {args.gradient_accumulation_steps} x {args.world_size}) = {total_train_batch_size: sha256:b7ea9cdbe360ad323911014caf12a9d4ec87cb36195a511080e4e484c2fb80d2\nExec: L1169: _modeling_file = eval(model_location) | L1658: f = eval(f\"{model_location}.{module}\") | L1988: exec(f\"def raise_{j}(*args, **kwargs): print('{function}')\", globals(), locals()) | L1989: try: exec(f\"EMPTY_LOGITS.{function} = raise_{j}\", globals(), locals()) | L3414: exec(f\"import {parent}\", locals(), globals()) | L3545: dir(eval(parent)), | L3549: exec(f\"{parent}.{child}.forward = forward\", globals(), locals()) | L3623: module = eval(f\"modeling_file.{module}\") | L3650: inner_class = eval(f\"modeling_file.{inner_class}\") | L3780: exec(f\"from timm.layers.norm_act import {norm}\") | L3788: forward = eval(norm).forward | L3794: exec(f\"timm.layers.norm_act.{norm}.forward = forward\") | L3811: exec(f\"from timm.models._efficientnet_blocks import {block}\") | L3819: forward = eval(block).forward | L3825: exec(f\"timm.models._efficientnet_blocks.{block}.forward = forward\") | L4059: exec(\nL4060: f\"{model_location}.torch.nn.{module}.forward = forward\",\nL4061: globals(),\nL4062: locals(),\nL4063: ) | L4065: exec(f\"{model_location}.nn.{module}.forward = forward\", globals(), locals()) | L4069: exec(\nL4070: f\"combined_module.torch.nn.{module}.forward = forward\",\nL4071: globals(),\nL4072: locals(),\nL4073: ) | L4075: exec(f\"combined_module.nn.{module}.forward = forward\", globals(), locals()) | L4152: source = eval(f\"{model_location}.torch\") | L4159: function = eval(f\"source.nn.{module}\") | L4336: exec(\"import transformers\", globals()) | L4349: exec(\nL4350: \"model_logger.addFilter(HideLoggingMessage('`use_cache`'))\", globals(), locals()\nL4351: ) | L4353: exec(\nL4354: \"model_logger.addFilter(HideLoggingMessage('compile_config'))\",\nL4355: globals(),\nL4356: locals(),\nL4357: ) | L4589: source = eval(f\"modeling_file.{module}\") | L4603: source = eval(f\"modeling_file.{module}\") | L4704: source = eval(f\"modeling_file.{module}\") | L4742: source = eval(f\"{model_location}.{module}\") | L4822: source = eval(f\"{model_location}.{module}\") | L4870: source = eval(f\"{model_location}.{module}\") | L5092: source = eval(f\"{model_location}.{module}\") | L5103: exec(\nL5104: f\"{model_location}.{module}._update_causal_mask = no_update_causal_mask\",\nL5105: globals(),\nL5106: ) | L5169: source = eval(f\"{model_location}.{module}\") | L5210: module_cls = eval(f\"{model_location}.{module}\") | L5247: module_cls = eval(f\"{model_location}.{module}\") | L5314: exec(\nL5315: \"from transformers.trainer import (\" + \", \".join(x for x in good_items) + \")\",\nL5316: globals(),\nL5317: ) | L5379: exec(inner_training_loop, globals()) | L5387: function = eval(f\"{model_location}.{module}\") | L5465: function = eval(f\"{model_location}.{module}\") | L5603: exec(\nL5604: f\"{model_location}.{module} = combined_module.{module}\",\nL5605: globals(),\nL5606: locals(),\nL5607: ) | L5617: check_dicts = dir(eval(f\"{model_location}\")) | L5619: item = eval(f\"{model_location}.{check}\") | L5629: exec(\nL5630: f\"{model_location}.{check}['{key}'] = combined_module.{replaced_class}\",\nL5631: globals(),\nL5632: locals(),\nL5633: )",
"evidence_hash": "bdfae4c24572c2a86fa6a2dede720ebb0723746963e43c2cd42701de5fc48fdb",
"file_sha256": "58f43e3b6ddeefff69cb345baec7642eb10e3f081b0753f236be6571550d54e3"
"file_sha256": "f1f6751f710ca026f844ed377b267a998b9650279dab2404d944fab3723991ea"

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 Update the compiler pin regression test

Changing this digest leaves test_context_dependent_unsloth_zoo_findings_are_digest_pinned expecting the previous 58f43e... value, so the repository's workflow-guard invocation of tests/security fails on every run. Update the paired expectation in tests/security/test_scan_packages.py (and preserve both pins there if older reviewed files are intentionally retained) alongside this baseline change.

Useful? React with 👍 / 👎.

"check": "Embedded cryptographic key + network calls (encrypted exfil pattern)",
"severity": "HIGH",
"evidence": "Key: L197: \"-----BEGIN PUBLIC KEY-----\", | L198: \"-----BEGIN RSA PUBLIC KEY-----\",\nNetwork: L236: http_client: httpx2.AsyncClient | None = None, | L462: else httpx2.AsyncClient(timeout=httpx2.Timeout(10.0))",
"evidence_hash": "da378a5affa4d88bf7c81d625d5f82eed662cafa6e5d3d4c104bdb3d5369d664"

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 reviewed JWT file contents

Because this new entry has no file_sha256, any future fastmcp-slim release that preserves the PEM marker strings and httpx2.AsyncClient lines retains this evidence hash even if it changes the surrounding instance call (for example, client.get(self.jwks_uri)) into a credential-send path; _partition_baseline will then suppress the HIGH finding without reviewing the changed file. This is reachable because the dependency floats across future releases, so this context-dependent approval should carry the reviewed file digest.

Useful? React with 👍 / 👎.

@danielhanchen
danielhanchen merged commit ca161bd into main Sep 2, 2026
13 of 17 checks passed
@danielhanchen
danielhanchen deleted the reapprove-scan-baseline-fastmcp4-zoo-2026-8-17 branch September 2, 2026 11:12
danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Sep 3, 2026
* Security audit: sync the zoo compiler.py digest pin with the approved baseline

unslothai#10187 re-approved unsloth-zoo 2026.8.17 and moved the compiler.py obfuscation
finding's pinned digest in scan_packages_baseline.json, but the same digest is
written a second time in the test that guards the pin, and that copy was left
on the old value. The pin and its guard have disagreed since, so
test_context_dependent_unsloth_zoo_findings_are_digest_pinned fails on main and
on every open PR, taking Repo tests (CPU) and workflow-trigger lint with it.

This is the follow-up write only. The review the pin exists to force already
happened in unslothai#10187; nothing here re-approves anything.

* Stop the zoo digest pin living in two places

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Require a pin on every new zoo variant, not just one per pair

---------

Co-authored-by: danielhanchen <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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