contrib: add experimental feature flag pattern for x402 signer policies - #342
Open
arandomogg wants to merge 1 commit into
Open
Conversation
Self-contained reference for issue Vellar-Wallet#284 under contrib/examples. Demonstrates gating experimental signer policy behavior behind a named experimental* flag so early adopters can opt in without a breaking change for everyone else. The gated behavior: capability rules accept a "*" wildcard by default, and a wildcard left behind after copying an example silently widens what a session key will sign. Setting experimentalStrictWildcardCapabilities rejects any wildcard rule at construction, requiring fully explicit rules. Omitted or false reproduces current behavior exactly. Includes 20 tests covering rule validation, capability evaluation, and that flagged and unflagged construction diverge only on wildcard rules, plus a README documenting the pattern and the risks of enabling the flag.
|
@arandomogg is attempting to deploy a commit to the david's projects Team on Vercel. A member of the Team first needs to authorize it. |
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.
Summary
Adds a self-contained reference implementation under
contrib/examples/issue-284-experimental-signer-policy-flag/demonstrating a feature-flag pattern for gating experimental x402 signer policy behavior, so early-adopter consumers can opt in without a hard breaking change for everyone else.Scoped entirely to
contrib/per CONTRIBUTING.md andcontrib/README.md.The pattern
An experimental signer policy change ships behind a named
experimental*boolean on the signer config:experimental*flag.falsereproduces today's behavior exactly.trueopts into the new (here, stricter) behavior.The behavior being gated
Capability rules accept a
"*"wildcard forresourceType/action. A wildcard left behind after copy-pasting an example silently widens what a session key will sign, but tightening it by default would break every config that relies on wildcards. So it's gated behindexperimentalStrictWildcardCapabilities:true)[{ resourceType: usdc, action: "*" }][{ resourceType: usdc, action: "transfer" }]capabilitiesomitted entirelyFiles
experimental-signer-policy-flag.ts— the flag pattern, capability rule validation/evaluation, and a mock signer that applies the flag at construction. Includes a runnablemain()demo.experimental-signer-policy-flag.test.ts— 20 tests.README.md— documents the pattern, a usage example, the behavior table above, and the risks of enabling the flag.Requirements checklist
contrib/)Test plan
20 tests, all passing. The runnable demo was verified to produce the expected unflagged-accepts / flagged-rejects / explicit-rules-unaffected output.
closes #284