Skip to content

fix(mcp): hash _meta, and re-baseline instead of alerting on every server - #144

Merged
blitzcrieg1 merged 1 commit into
masterfrom
fix/meta-fingerprint-bypass
Sep 1, 2026
Merged

blitzcrieg1 merged 1 commit into
masterfrom
fix/meta-fingerprint-bypass

Conversation

@blitzcrieg1

Copy link
Copy Markdown
Owner

Closes #142.

The bypass

_VOLATILE held _meta, so it was stripped before hashing. A listing with instructions planted in a tool's _meta hashed identically to a clean one:

baseline            4b40e8ff9183c727
with poisoned _meta 4b40e8ff9183c727

Not a weakened signal. An absent one. Neither the listing digest nor the per-tool digests added in 0.6.0 moved at all.

_meta rides on the tool object, reaches clients, and whether it reaches the model is client-dependent. So it is the obvious place to move behaviour-bearing text once descriptions are being watched. The rules here are public on purpose, which means the exemptions were public too, and an exemption in a published detector is a published bypass.

How it got in

Not carelessly. A test pinned it, and its docstring read:

"Servers stamp _meta per call. Hashing it would alert every reconnect."

That conflated two different things called _meta: the one on a request or result envelope, which can carry per-call bookkeeping, and the one on a tool definition inside tools/list, which describes the tool. Only the second is hashed here.

Same shape as the trait bug and the pydantic bug this repository already documents: a reasonable-looking decision that removed signal and passed its tests because the tests shared its assumption.

The migration is the half that could have done damage

Changing what is hashed invalidates every stored baseline. Shipping the fix alone would have reported a rug pull on every server every user had ever observed, on upgrade day, and taught them the alert is noise.

FINGERPRINT_VERSION is stamped per record. A baseline computed under an older version re-baselines as new rather than reporting changed. A fix that causes a fleet-wide false positive is not a fix.

Tested both directions: an old-format store re-baselines, and a genuine _meta poison after that re-baseline is still caught as changed.

_VOLATILE is now empty, deliberately

The bar for adding a key is evidence that it genuinely varies per call on a real server, naming the server. "It looks like metadata" is how the last entry got in, and it cost the detection. A test asserts the set stays empty.

Residual risk, stated rather than assumed away: a server that really does stamp varying data into a tool's _meta will now churn the digest. The remedy is a specific path exemption with evidence, not a blanket one.

Verification

  • 1,164 tests pass, ruff clean
  • Benchmark 26/26, 0 missed, 0 false positives
  • Ruleset fingerprint unchanged at 15846a0915769d4a, since core/diagnostics is not part of it, so the dogfood clock is untouched
  • Store format 2 to 3

Reported by @Santoshkumarpuppala, who noted the same defect exists by design in their own implementation. Reporting a hole you also have is the useful kind of review.

🤖 Generated with Claude Code

…rver

Closes #142.

`_VOLATILE` held `_meta`, so it was stripped before hashing and a listing with
instructions planted in a tool's `_meta` hashed identically to a clean one.
Not a weakened signal, an absent one: neither the listing digest nor the
per-tool digests added in 0.6.0 moved at all.

    baseline            4b40e8ff9183c727
    with poisoned _meta 4b40e8ff9183c727

`_meta` rides on the tool object, reaches clients, and whether it reaches the
model is client-dependent. That makes it the obvious place to move
behaviour-bearing text once descriptions are being watched. The rules here are
public on purpose, so the exemptions were public too, and an exemption in a
published detector is a published bypass.

The exemption was not careless. A test pinned it, and its docstring said
servers stamp `_meta` per call so hashing it would alert on every reconnect.
That conflated the `_meta` on a request or result envelope, which can carry
per-call bookkeeping, with the `_meta` on a tool definition inside tools/list,
which describes the tool. Only the second is hashed here. Same shape as the
trait bug and the pydantic bug: a reasonable-looking decision that removed
signal and passed its tests because the tests shared its assumption.

The migration is the half that could have done real damage. Changing what is
hashed invalidates every stored baseline, so shipping this alone would report a
rug pull on every server every user had ever observed, on upgrade day, and
teach them the alert is noise. FINGERPRINT_VERSION is stamped on each record
and a baseline computed under an older version re-baselines as `new` rather
than reporting `changed`. A fix that causes a fleet-wide false positive is not
a fix.

_VOLATILE is now empty and documented to stay that way. Adding a key needs
evidence that it genuinely varies per call on a real server, naming the server.
"It looks like metadata" is how the last entry got in.

Store format 2 -> 3. Ruleset fingerprint unchanged at 15846a0915769d4a, since
core/diagnostics is not part of it.

Reported by @Santoshkumarpuppala, who noted the same defect exists by design in
their own implementation.

Co-Authored-By: Claude Opus 5 <[email protected]>
@blitzcrieg1
blitzcrieg1 merged commit b39724f into master Sep 1, 2026
9 checks passed
@blitzcrieg1
blitzcrieg1 deleted the fix/meta-fingerprint-bypass branch September 1, 2026 16:49
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mcp_schema: _meta is stripped before hashing, so text moved there bypasses the rug-pull digest entirely

1 participant