Repository navigation
SOW 2 week 3: before the mainnet opt-in (signed terms on Stellar, the run's RPC, the mainnet job rules) - #41
Merged
Merged
Conversation
…ough the run's RPC The caps, the pin and the plan were checked on the terms Wasit hands the x402 client, while the Stellar client signs the authorization entries the RPC's simulation returns. The payer's signer is now gated: each preimage is decoded and the key signs only one transfer of the checked amount from the payer to the checked payee, on the checked asset and the run's network, with no sub-invocation, once per payment, expiring no later than the payment's lifetime allows from the run's first ledger reading. A built payment that carries anything but that one signed authorization is discarded unsent. On stellar:testnet the client now builds and simulates through the run's RPC, the one whose network is checked and the settlement is read from, instead of the SDK's default. It accepts only https, so an http RPC is refused in the preflight and, in wasit run, before the service starts. stellar:pubnet still gets no RPC from Wasit. Tests: the preimage check, the gate and the anchor; the real x402 Stellar client against a stood-in RPC (other payee, amount, contract, a sub-invocation, two entries, a stretched ledger); the binding after signing; the wiring in preparePayment; the https rule in core, the CLI and the MCP server. Every mainnet-optin network must belong to a gated adapter.
Inside one job, code that ran earlier as the runner's user can reach every later step (PATH, files on disk, a process left running), so no check in the job holds against it. The rules refuse the workflows where such code would be: a mainnet run in GitHub Actions is started by hand, on the default branch, on a GitHub-hosted runner; it tests a deployed service (no service.start, no local baseUrl); nothing was installed before Wasit (no node_modules in the workspace or the config's directory); and WASIT_MAINNET_PAYER_SECRET is the only key variable. Outside GitHub Actions none applies. They stop a wrong workflow; the key itself belongs in a GitHub environment limited to the default branch, with a required reviewer. This version has no mainnet opt-in: assertMainnetJob is exported for it and called by nothing yet. --mainnet and the Action's mainnet input still refuse, and now also name the runner rule on a runner that is not GitHub-hosted. Tests: each rule alone, all together, no echo of a key, an odd event or ref, local hosts as the URL parser writes them, and the runner rule in the CLI and the Action.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
dzakwannajmi
marked this pull request as ready for review
November 21, 2026 10:00
This branch was successfully deployed
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.
Two commits, both on the payment path. Nothing here pays on mainnet: the mainnet opt-in is not part of this version, and its switches still refuse.
fix(core): on Stellar, sign only the checked authorization, built through the run's RPC (4de705b)packages/core/src/guard/signed-terms.ts): each preimage is decoded, and the key signs only onetransferof the checked amount from the payer to the checkedpayTo, on the checked asset and the run's network, with no sub-invocation, once per payment, expiring no later than the payment's lifetime allows from the run's first ledger reading. A built payment that carries anything but that one signed authorization is discarded unsent.stellar:testnetthe client builds and simulates through the run's RPC (the one whose network is checked and the settlement is read from) instead of the SDK's default. It accepts only https, so anhttp://RPC is refused in the preflight and, inwasit run, before the service starts.stellar:pubnetstill gets no RPC from Wasit.feat(core): the rules of a mainnet job in GitHub Actions (d669b33)mainnetJobRefusals/assertMainnetJob(packages/core/src/guard/ci-mainnet.ts): started by hand, on the default branch, on a GitHub-hosted runner; a deployed service (noservice.start, no localbaseUrl); nonode_modulesbefore Wasit;WASIT_MAINNET_PAYER_SECRETthe only key variable. Outside GitHub Actions none applies. Exported for the opt-in and called by nothing yet.--mainnetand the Action'smainnet: truestill refuse, and now also name the runner rule on a runner that is not GitHub-hosted.Results can change on upgrade (CHANGELOG
[Unreleased]): a Stellar payment the simulation asks to sign for anything else isERROR (setup)with nothing signed, as is a testnet token whosetransferneeds further authorized calls; anhttp://RPC on a Stellar payment run is refused.Tests (local,
npm run build && npm test): cli 277, core 930, server 30, Action 196, 0 failures; typecheck core, cli, server clean. The gate is tested through the real@x402/stellarclient against a stood-in RPC (another payee, amount or contract, a sub-invocation, two entries for the payer, a stretched ledger). Each condition of the gate, the RPC rule and the job rules was removed one at a time: 30 + 6 + 17 mutations, all caught.Docs for these changes (
docs/CHECKS.md, the CLI README) wait for the release that ships them.