Bounty #36: demo key can sign a production-scoped receipt and bypass the demo refusal
Claim for permission-protocol/deploy-gate#36.
Summary
verifyArtifactReceipt() decides whether a receipt is a demo receipt from the signed payload field scope, not from the key that actually signed it. A holder of an mcpg-demo- key can therefore sign a payload with scope: "production", a future expiry, and status: "APPROVED"; the verifier accepts it with allowDemo: false whenever that demo key is present in the pinned key set.
This is distinct from the key-trust, unsigned-envelope, scope-injection, and call-binding findings. The key is a valid pinned key, the signature is genuine, and the payload is canonical. The defect is the mismatch between the demo guarantee and the field used to enforce it.
Exact locations
mcp-guard/src/receipt-verify.ts:206-208— demo refusal is driven solely bypayload.scope === 'demo'.mcp-guard/src/signing/keys.ts:28-29,84-88— demo status is actually encoded by themcpg-demo-key-id prefix, and key resolution enforces the self-certifying fingerprint for that prefix.mcp-guard/src/issuer.ts:178,237— the normal issuer happens to derivescope: "demo"from the key, but the verifier does not require that invariant after signature verification.
Local PoC
Using the public receipt-spec demo key and a pinned key set:
{
"keyId": "mcpg-demo-5787f378b3f39ff4",
"allowDemo": false,
"signedScope": "production",
"valid": true,
"reasons": []
}
The signed request uses a production-shaped deploy call and scope deploy:production; the expected scope and --call checks both pass. The only reason a gate should reject this is the key type, but it does not.
Impact
This defeats the contract documented in the receipt standard and README: demo keys are throwaway keys whose receipts authorize nothing real. Any gate that pins an mcpg-demo- key can be satisfied by a production-scoped receipt that the verifier reports as valid.
Suggested fix
Derive demo status from the resolved key ID or key entry, not from the signed payload alone. Reject mcpg-demo-* keys whenever allowDemo is false, regardless of the signed scope. Optionally enforce the schema invariant that scope === "demo" exactly when the signing key is a demo key.
Validation against mcp-guard main 9193053: npm ci, npm run build, npm test (217 tests, 0 failures), plus the local PoC above. If this qualifies under #36, payment details can be provided privately.
Opened the fix PR: permission-protocol/mcp-guard#18. The verifier now derives demo status from the verified key identity as well as the signed scope, with a regression test for a demo key claiming scope: "production".
@rodchalski submitting this as a #36 bounty claim. The production-vs-demo guarantee is derived from a signed field the demo-key holder controls; the resolved mcpg-demo- key identity is not consulted. I also opened the focused fix in mcp-guard#18.