Repository navigation
feat(core,cli,action): wasit run, config file and GitHub Action for read-only checks; stellar-sdk 16.4.1 - #23
Merged
Merged
Conversation
A fixed table of networks (core/src/guard/networks.ts) decides before any request is sent or any key is read: the four test networks pass; stellar:pubnet and any network not in the table are refused as a configuration error. The guard runs in every core entry point that signs (the x402 preflight and preparePayment, the MPP charge run and payCharge, the channel suite, each channel check and the channel credential), so the CLI, the MCP server, the dashboard and direct users of @wasit-dev/core get the same refusal from one place. It is the first layer of the network guard; the mainnet opt-in is not part of it. Tests: core (the table and every entry point), the CLI's built binary, the dashboard's runAction, and the MCP server over stdio (new test and typecheck scripts, both run in CI). Help and tool texts no longer offer stellar:pubnet.
…one sanitiser Groundwork for the read-only GitHub Action (SOW 2, Deliverable 1). - config: a loader for wasit.config.json version 1. Unknown keys, secrets, the mainnet opt-in, anything that enables MPP-13, header names that look like secrets and paths that could leave the origin are refused. An error never repeats a value from the file. - report: a run report with one outcome per endpoint (conformant, non-conformant, no-verdict, unsupported), skipKind on skipped checks, expected and actual values on every X402-01..05 FAIL, and the Wasit and SDK versions read from the installed packages. A comment renderer, a baseline and a history to compare a pull request with main. - unsupported: an x402 v1 body challenge and a network no payment adapter pays on are SKIP unsupported, not a FAIL or a preflight error. A service that was never graded exits 2, and so does a run that asked for payment checks when none could be graded: nothing is green that was not tested. - sanitize: one module for everything printed, written to a report or put in a comment: control characters, workflow commands, secrets, links, mentions. - redirects: the read checks follow one redirect inside the origin and never leave it. Paid requests keep today's behaviour. - denied-env: the variables a service started by wasit must not see (keys, header values, the job's tokens and command files). - server: the MCP output carries skipKind, expected and actual.
wasit run reads wasit.config.json and runs the read-only checks of each endpoint, one after another, into one report (--json, --out). The payment tier is not in this version: without --read-only it exits 2 before it reads the config, and no flag that pays, signs or opts into mainnet exists. - --start runs service.start, waits for service.ready, runs, and stops the service on a normal end, on an error and on SIGINT, SIGTERM and SIGHUP. The service does not receive Wasit's key variables, header variables, RPC url or the job's tokens. --start-if-local does the same only when service.start is set and the environment is on this machine, so a deployed endpoint is read as it is. - --baseline compares with the report of the default branch: an endpoint graded there that is unsupported or without a verdict now is a regression, exit 1. Nothing graded is exit 2. - .env is not read by wasit run when CI or GITHUB_ACTIONS is set. - wasit ci-report writes the pull request comment, the job summary and the next baseline from the report. With no usable report it still writes a fixed "no verdict" comment, so the comment of the push before does not stay next to a red check, and it writes no baseline. - wasit test and the MCP tool exit 2 for a service that was never graded (x402 v1) and for payment checks that could not be graded on the network. Terminal output goes through the one sanitiser.
A composite action (wasit-dev/wasit/action@<ref>) that a builder adds to a workflow. On a pull request it builds Wasit from its own ref with the locked dependencies, starts the service the config names, runs the read-only checks (X402-01 to 05), and shows the result as the job result and as one comment that is updated on each push, with what changed since main. - The job result is the exit code of wasit run. The report step always runs; a run that left no report replaces the comment with "no verdict". - The token reaches only the two steps that call gh, never the step that starts the service. Inputs reach the scripts as environment variables, never as text inside a run block. pull_request_target is refused. - The baseline is the artifact of the latest successful push run of this workflow on the default branch, from this repository, chosen by run id. A run from a pull request or a fork is never used. - The comment is found by its marker and by github-actions[bot]; a 403 on a fork's token is logged and does not fail the job. - tier: payment is refused in this version. Linux runners only. - Offline tests for the scripts (gh injected) and the YAML, wired into npm test and CI. A real workflow run is not part of this commit. - yaml is an explicit devDependency at the version the lockfile already had.
…work A channel commitment is the bytes that prepare_commitment returns from an RPC the caller chooses, and the contract writes the network it runs on into them. Before the key signs them, they are now decoded and must name the run's channel, the amount the run means to sign, the commitment domain and the run's network, the same rule the MPP SDK's own client applies. Anything else is refused as a configuration error and nothing is signed. So the network the guard allowed is also the network the signature is valid on, whatever the RPC returns. Tests: a commitment for another network, channel, amount or domain, and bytes that are not a commitment, are refused; a good one signs and verifies; the RPC step never receives the key.
Testnet runs protocol 30. stellar-sdk 16.1.0 cannot decode its ledger header
("XDR Read Error: unknown StellarValueType member for value 3"), so every call
that reads one fails: getLatestLedger and getLedgers, and with them the MPP
channel server's on-chain state check, which then refuses every voucher.
16.4.1 decodes them.
16.4.1 is inside the range core declares (^16.1.0), so no package.json
changes; only the lockfile moves, with the SDK's own pins (axios 1.20.0,
follow-redirects 1.16.3). The separate 16.3.1 copy under @x402/stellar now
resolves to the same 16.4.1.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…n refs
A pull request comment named "Wasit 0.7.0" for a build of an unreleased commit,
because the packages still declare 0.7.0. The Action now passes its ref to the
steps that run Wasit and write the report. When the ref is a full commit id, the
result names it ("built from commit 0123456"); a tag or a branch name says
nothing, since a pinned tag already names the version. The report parser accepts
the new optional field only as seven lower-case hex characters, and so does the
comment, whatever a report claims.
The reason under "Not graded" starts with a capital letter, as it follows a full
stop.
actions/upload-artifact in action.yml, and checkout and setup-node in the
template workflow, are pinned to full commit SHAs instead of version tags.
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.
What
wasit.config.json(version 1): endpoints, methods, request bodies and environments in one file. The loader is strict: an unknown key is an error, and secrets, the mainnet opt-in and per-payment caps have no place in the file.wasit run --read-only: runs the checks X402-01 to X402-05 for every endpoint of the config and writes one report (--json,--out). It can start the service itself (--start,--start-if-local) and compare with the report of the default branch (--baseline).wasit ci-report: renders the pull request comment and the job summary from a report. One sanitiser covers everything a service sent.action/: a composite GitHub Action for Linux runners with Node 22. It starts the service in the job, runs the read-only checks, comments on the pull request (one comment, updated on each push) and compares with the last successful run on the default branch.@stellar/stellar-sdk16.4.1 in the lockfile: the test network is on protocol 30, and 16.1.0 cannot read its ledger headers.Behaviour changes
Not in this pull request
The payment tier of the Action, the mainnet opt-in, and documentation for these features, which stays off
mainuntil a release.Tests
npm run build && npm test: cli 173, core 609, server 10.npm run test:action: 149. No failures (local run). The Action has also run on pull requests of a separate example repository.