Skip to content

feat(fixtures): add 0x swap fixture under profiles/web3#4

Merged
Markeljan merged 1 commit into
mainfrom
worktree-agent-a46a2f049b51b0aeb
May 7, 2026
Merged

feat(fixtures): add 0x swap fixture under profiles/web3#4
Markeljan merged 1 commit into
mainfrom
worktree-agent-a46a2f049b51b0aeb

Conversation

@Markeljan
Copy link
Copy Markdown
Collaborator

Summary

  • Adds e2e/fixtures/profiles/web3/0x-swap/ mirroring the third-party Supraforge/aaas-vault 0x skill verbatim (upstream commit a7ecf7fe). 0x has no first-party agent skill, so this listing is the most prominent and is the canonical Permit2 typed-data fee-skim reference for AST-W02.
  • Fee-skim pattern preserved intact: literal SWAP_FEE_BPS=30 and SWAP_FEE_RECIPIENT=0x890CACd9dEC1E1409C6598Da18DC3d634e600b45 survive byte-for-byte in both SKILL.md and src/quote.sh, plus gasless=true, the 0x-api-key header, and the per-chain *.api.0x.org subdomain table - the new fee-recipient detector and the existing W02/W04/W12 rules can fire against the fixture without any fixture-side massaging.
  • Adds an agentsec-canonical skill.json openclaw manifest while leaving the upstream's legacy metadata.clawdbot key in SKILL.md unchanged - the legacy-key usage is itself a finding the scanner can surface.

Test plan

  • bun install && bun run build && bun run test (88 tests pass, full turbo cache hit on rerun)
  • bun run audit --path e2e/fixtures/profiles/web3/0x-swap/ --profile web3 --verbose discovers the skill as zerox-swap v1.0.0 [Web3]
  • Fee-skim literals confirmed intact via grep: SWAP_FEE_BPS="30" at SKILL.md:75 + quote.sh:16, recipient address at SKILL.md:76 + quote.sh:17, gasless=true at quote.sh:32 + SKILL.md:164
  • Once Unit 10's fee-recipient detector lands, AST-W02 / W04 / W12 should fire against this fixture (currently scanner emits two AST05 critical findings on the WETH/USDC token-address strings, which is the expected pre-Unit-10 behavior)

🤖 Generated with Claude Code

Mirrors Supraforge/aaas-vault skills/blockchain-crypto/0x-swap verbatim
(upstream a7ecf7fe). 0x has no first-party agent skill, so this third-
party listing is the canonical "Permit2 typed-data fee-skim" reference
for AST-W02 e2e: hardcoded SWAP_FEE_BPS=30 plus the literal recipient
0x890CACd9dEC1E1409C6598Da18DC3d634e600b45 baked into every quote URL.

The fee-skim pattern is preserved intact (literal assignments in both
SKILL.md and src/quote.sh) so the new fee-recipient detector and the
existing W02/W04/W12 web3 rules can fire against it without any
fixture-side massaging. README.md spells out provenance and the
do-not-refactor contract.

Adds skill.json with the agentsec-canonical openclaw manifest shape and
keeps the upstream's legacy metadata.clawdbot key in SKILL.md
unchanged - the legacy-key usage is itself a finding the scanner can
surface.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Markeljan Markeljan merged commit 604af3a into main May 7, 2026
1 check passed
@Markeljan Markeljan deleted the worktree-agent-a46a2f049b51b0aeb branch May 7, 2026 15:34
Markeljan added a commit that referenced this pull request May 14, 2026
…nclaw.web3 (#19)

The hand-rolled YAML parser in `packages/openclaw/src/manifest.ts` only
handled a single level of nesting, so any SKILL.md whose frontmatter
declared `metadata.openclaw.web3.policy.allowedContracts` (the shape the
Web3 Annex recommendations doc tells skills to use, and the shape adopted
upstream in odos-xyz/odos-skills) was silently flattened — leaving the
parsed manifest with a malformed `metadata` block and no `web3` field at
all. The W04M-003 / W04M-004 rules then fired as false positives, and
the downstream AST-W rules that read `manifest.web3.*` were skipped
entirely (silently masking real findings, e.g. AST-W12 audit sink /
kill-switch / runbook gaps).

This change:

- Replaces the custom `parseYaml` with the standard `yaml` package so
  deeply-nested frontmatter parses correctly (no more single-level
  limitation, plus correct handling of block scalars and quoted keys).
- Hoists `metadata.openclaw.web3` to top-level `manifest.web3` during
  normalization when no top-level `web3` block is declared. Both shapes
  are now supported; top-level wins when both are present.
- Normalizes `policy.allowedContracts` (and `allowedSelectors`) from
  chain-keyed maps (`{ 1: ["0x..."], 8453: ["0x..."] }`) into deduped
  flat string arrays, so every downstream rule can read them as
  `string[]` without crashing on `.map`/`.includes`. This fixes a
  scanner regression in `web3-permit-capture` that surfaced once the
  hoist was in place.
- Adds parser and normalizer tests covering: deeply-nested frontmatter
  parsing, hoisting from `metadata.openclaw.web3`, top-level wins over
  nested, metadata preservation for AST04, and the chain-keyed-map
  flatten case.

Verified against odos-xyz/odos-skills@93b3db6: W04M-003 and W04M-004
findings clear (Odos correctly credited for the fixes shipped in their
PRs #2-#4), and the previously-masked AST-W12 findings now correctly
fire so they can be addressed upstream.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant