Repository navigation
fix(skill): bind x402 payments to approved terms and harden helpers - #56
Open
yashovardhan wants to merge 2 commits into
Open
yashovardhan wants to merge 2 commits into
yashovardhan wants to merge 2 commits into
Conversation
Address the review of davila7/claude-code-templates#1032: - x402: inspect/mcp-inspect print an approvalId per option. pay and mcp-sign require --approved and refuse to sign if the fresh offer's scheme, network, asset, payTo, or amount differ from the approved ones. - x402: report "paid_unverified" instead of "settled" when a 200 has no decodable receipt. - x402: require CAIP-2 chains to appear in `mm chains list`. - x402: parse mm JSON output object by object and skip `_notice` lines, so an AWAITING_MFA notice before the result no longer crashes signing. - amount_to_hex.py: reject excess precision instead of truncating, plus negative, non-numeric, and non-finite input. - Docs: stop showing passwords or mnemonics inline. Use the prompting commands and `read -rs` for MM_MNEMONIC and MM_PASSWORD. Bump the skill to 7.7.2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
yashovardhan
added a commit
to yashovardhan/claude-code-templates
that referenced
this pull request
Sep 30, 2026
Pull in MetaMask/agent-skills#56, which addresses the review on this PR: x402 payments are bound to the approved terms with --approved, receipt-less 200s report paid_unverified, CAIP-2 chains are checked against mm, MFA notices no longer break JSON parsing, amount_to_hex.py rejects excess precision, and secret examples use prompts or read -rs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add the Agent Skills compatibility field: the skill needs the mm CLI and Python 3, mm talks to MetaMask services and chains, x402_pay.py only contacts the URL or MCP challenge the user asks to pay, and amount_to_hex.py is offline. Skill scanners such as awesome-llm-apps' skill_scanner treat undeclared network use as a warning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Sep 30, 2026
This was referenced Oct 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
Greptile reviewed the vendored copy of this skill in davila7/claude-code-templates#1032, gave it a confidence score of 0/5, and flagged four P1 and two P2 issues. All six are real defects in this repo's skill, so this PR fixes them here. The biggest one is that
pay --confirmcould sign terms other than the ones the user approved.Jira Link
N/A
Description
Behavior change:
payandmcp-signnow require--approved <approvalId>.payfetched a fresh402and signed it without comparing it to what the user approvedinspect/mcp-inspectprint anapprovalIdfor each option. It is a SHA-256 fingerprint of the scheme, network, asset,payTo, amount, and transfer method.pay/mcp-signrequire--approvedand refuse to sign if the offer they're about to sign has a different fingerprint. The fresh fetch stays, so the short payment window is still respected.{to last}slice merged anAWAITING_MFANDJSON line with the resultmmoutput is decoded one object at a time withraw_decode._noticeobjects are skipped, and the result object is returned. If the output holds only notices, the last one is returned so the approval state is surfaced.amount_to_hex.pysilently truncated extra decimal placesauth.mdshowsmm wallet password set/change/removein their prompting form, and the flag rows say never to pass the value inline. I also found the same problem in the BYOKexport MM_MNEMONIC="…"/MM_PASSWORDexamples inauth.mdandonboarding.md, which would put a seed phrase in shell history. Those now useread -rs, which works in bash and zsh.eip155:<id>must appear inmm chains list, the same rule as for named networks.settled200with no decodable receipt reports"status": "paid_unverified", with a note not to pay again and to check transaction history.A second commit adds the Agent Skills
compatibilityfield toSKILL.md. It declares that the skill needs themmCLI and Python 3, and which parts use the network.SKILL.md,references/x402.md,workflows/x402-pay.md,workflows/x402-mcp.md, andreferences/transaction.mddocument the new flag, the mismatch error, and the new status. The skill is bumped to 7.7.2, with a CHANGELOG entry.How has this been tested?
I ran end-to-end tests against a local x402 server on loopback. The script allows plain HTTP only on loopback. For
mm, I used a stub that prints a Node warning beforechains list, and anAWAITING_MFANDJSON notice before thesign-typed-dataresult.pay --confirmwithout--approvedsettledwith the transaction hashinspectpayToafterinspect200without a receiptpaid_unverified,transaction: null, with a noteeip155:999999chainId: null, not eligible,payrefusesmcp-signwithout, with matching, and with changed--approvedamount_to_hex.pygives the same output as before for the documented examples (1.5 18,100 6,0.001 8). It errors on0.1234567 6,-1 6,abc 6,inf 6,1 -1, and1 x.123456789012345678901234.5 18matches exact integer arithmetic.Also run:
--no-llm: score 16 (LOW), the same two intentional MEDIUM findings as fix(skill): reword instructions that static scanners flag as unsafe #55.claude plugin validate . --strict: passes.py_compileon both scripts: passes.Types of changes
pay/mcp-signcalls without--approvednow fail closed. The skill's docs and workflows are updated in the same PR, so agents that follow the skill aren't affected.Checklist
The repo has no test suite, so the harness above was run by hand.
🤖 Generated with Claude Code