Bounty #36: non-injective JSON-RPC call binding accepts two wire shapes for one inputHash
Claim for permission-protocol/deploy-gate#36.
Summary
The signed inputHash is not injective over JSON-RPC calls. serverInput() normalizes two different wire messages to the same object before hashing, so the same valid receipt verifies for both:
{"jsonrpc":"2.0","id":1,"method":"resources/read","params":[{"uri":"file:///approved-safe"}]}
and
{"jsonrpc":"2.0","id":2,"method":"resources/read","params":{"params":[{"uri":"file:///approved-safe"}]}}
This is distinct from #64 (scope tuple re-splitting) and from the missing --call problem in the reference workflow. Even if every caller supplies --call, the exact-call check hashes the same normalized object for both wire forms.
Exact locations
mcp-guard/src/frame.ts:119-124—serverInput()converts array params to{ params }, while object params are returned unchanged.params: [X]andparams: { params: [X] }become identical.mcp-guard/src/issuer.ts:90-93—hashablePayloadInputHash()hashes that normalized object.mcp-guard/src/proxy.ts:243-251— the guard signs the normalizedforwardArgs, not the original params shape.mcp-guard/src/receipt-verify.ts:209-214—opts.callrecomputes the same normalization, inheriting the collision.mcp-guard/src/release.ts:43-52— the release-pathforwardedCall()also reads the call back throughserverInput().
Reproduction
A local PoC used the public verifier path and a pinned Ed25519 key set:
wireBytesDiffer: true
hashesEqual: true
receiptVerifiedForWireA: true
receiptVerifiedForWireB: true
reasonsA: []
reasonsB: []
The same signed artifact and inputHash verify for both wire messages when verifyArtifactReceipt(... { call }) is given each form through the normal serverInput() path.
Impact
A human approves one JSON-RPC shape, but the receipt remains valid for a different wire shape that reaches the server. For methods whose servers accept or can be induced to interpret both positional and named params, this is an authorization substitution. It also means a future requirement to pass --call does not by itself make the signed action exact.
Suggested fix
Make the signed call representation type-preserving. For example, hash { kind: "array", value: params } for positional params and { kind: "object", value: params } for named params, or hash the exact canonical forwarded JSON-RPC method/params bytes. Add a regression test asserting the two messages above produce different inputHash values and that a receipt for one fails exact-call verification for the other.
Validation against mcp-guard main 9193053: npm ci, npm run build, and npm test (217 tests, 0 failures). If this qualifies under #36, payment details can be provided privately.
@rodchalski submitting this as a #36 bounty claim. This one is a true signing-input collision: the same valid artifact verifies for two different JSON-RPC wire shapes even with --call, because serverInput() normalizes both to {params:[...]}. The exact PoC and code references are in the issue body.