Skip to content

feat: add sign-safe — offline signing-time transaction safety gate#34

Open
lrafasouza wants to merge 21 commits into
solanabr:mainfrom
lrafasouza:feat/sign-safe-skill
Open

feat: add sign-safe — offline signing-time transaction safety gate#34
lrafasouza wants to merge 21 commits into
solanabr:mainfrom
lrafasouza:feat/sign-safe-skill

Conversation

@lrafasouza

@lrafasouza lrafasouza commented Jun 22, 2026

Copy link
Copy Markdown

sign-safe v0.6.4 — add the offline pre-sign safety gate as an ext/ skill

This PR adds sign-safe to solana-ai-kit as an ext/ skill: an offline, deterministic pre-sign transaction review gate for Solana agents.

Current submodule target:

What the skill does

Given opaque transaction/message bytes before signing, sign-safe decodes the Solana wire format (legacy + v0 + ALTs), derives account roles, clear-signs known DeFi/NFT/Squads/stake/system/token instructions, detects authority- and ownership-transfer primitives, computes signer outflow, and returns a machine-readable verdict:

  • SIGN for recognized benign flows under policy (exit 0)
  • HOLD when a human or higher-trust policy should review (exit 10)
  • REJECT for known dangerous shapes (exit 20)

The deterministic core has no runtime dependencies and stays offline. Network-aware enrichment is isolated behind host adapters.

What's new since v0.5

  • Published to npm (sign-safe) — npx sign-safe / npx sign-safe-mcp (MCP server for agents) / library import.
  • Real on-chain attack evidence: the two real Drift (~$285M, Apr 2026) exploit transactions, decoded offline → both HOLD (durable-nonce + Squads v4). See docs/real-attacks.md.
  • IDL-cross-verified registry (69/69 Anchor discriminators), mutation + fuzz testing (Stryker 70.2% behavioral; 44,288 single-byte mutations → 0 SIGN), and a 500-tx benign corpus (18.4% SIGN / 81.6% HOLD / 0 false-REJECT).

Validation

From lrafasouza/sign-safe-skill@e288e9d:

npm run verify:all
  • npm run build
  • npm test803 passed / 42 files
  • npm run test:fixtures80 PASS / 0 FAIL
  • npm run demo:attack-pack37/37 attack fixtures held or rejected before signing; False SIGN: 0 (plus 2 real Drift transactions held)
  • npm pack --dry-run; npm audit --omit=dev → 0 vulnerabilities (zero runtime deps)

Public CI for e288e9d is green: https://github.com/lrafasouza/sign-safe-skill/actions/runs/28447798616

Honest limits

  • SIGN is not a universal safety guarantee; it means the transaction matches recognized benign shapes under the current static policy.
  • The malicious replay result is for the curated corpus, not a universal detection claim.
  • sign-safe is a pre-sign review layer, not on-chain spending enforcement. It complements simulation, wallet UX, human review, and multisig/policy systems.

Integration in this PR

  • Adds .claude/skills/ext/sign-safe as a public submodule (pinned to e288e9d).
  • Adds routing in the skill hub so agent wallets can invoke pre-sign review before authorizing transaction bytes.
  • Keeps the submitted skill self-contained, MIT licensed, and reproducible from the public repository.

Adds sign-safe as an ext submodule: an offline, deterministic pre-sign
transaction safety gate. It decodes an opaque base64 transaction/message
(legacy + v0 with ALTs), classifies instructions against a danger-primitive
catalog (SetAuthority, BPF upgrade, durable nonce, delegate, large outflow,
Token-2022 traps), computes signer-perspective outflow, and emits a
SIGN / HOLD / REJECT verdict + verdict.json for autonomous-agent gating.

Why it fits a gap: every bundled auditor is retrospective / program-source
based, and /debug-user-tx targets a landed transaction. Nothing reviews the
bytes a signer is about to authorize — the 2026 Drift ~$285M blind-signing /
durable-nonce failure class. sign-safe layers on the core (references it by
name), it does not duplicate it.

- .claude/skills/ext/sign-safe: submodule -> github.com/lrafasouza/sign-safe-skill (MIT)
- .claude/skills/SKILL.md: new "Signing-Time Safety" section + Task-Routing row + frontmatter list
- .gitmodules / ext count stay balanced (18 -> 19 both), validate.sh links resolve

Upstream skill validation: 154 tests, tsc clean, CI green (Node 20 + 22),
dual-reference cross-validation (@solana/web3.js + @solana/kit), 5 real mainnet
fixtures, fuzz-clean (9016 inputs), fully offline + deterministic.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 22, 2026

Copy link
Copy Markdown

@lrafasouza is attempting to deploy a commit to the STBR TRUE Team on Vercel.

A member of the Team first needs to authorize it.

@lrafasouza lrafasouza changed the title feat: add sign-safe — offline signing-time transaction safety gate (submodule) feat: add sign-safe — offline signing-time transaction safety gate Jun 22, 2026
lrafasouza and others added 7 commits June 22, 2026 12:22
…cies)

Points to the polished sign-safe HEAD: MIT copyright owned by the author,
package.json author/repository metadata, and @solana/web3.js + @solana/kit moved
to devDependencies (the deterministic core imports neither). 154 tests still green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ves / 164 tests)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ives / 168 tests)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…74 tests)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… — 34 primitives / 180 tests)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…5 primitives / 183 tests)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
lrafasouza and others added 13 commits June 22, 2026 16:52
…decode), 238 tests

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…T registry/blocklist), 292 tests

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
sign-safe v0.4: real RPC enrichment (ALT resolution, Token-2022 mint screening,
Squads clear-sign), two-tier REJECT posture + --strict, 12-program clear-signing
registry, real-mainnet precision study (0 false-REJECT, 100% recall). 607 tests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
v0.5: simulation, Native Stake, programmatic API + signTransaction/MWA gate + MCP
server, schema (requiresHumanReview/category), durable-nonce asymmetry, Lighthouse
INFO, Marginfi/Squads registry; full adversarial review + 3 fix passes; 728 tests.
Reflects the competitive-analysis release: evaluator Quickstart, reproducible
sample verdicts, Squads HOLD walkthrough, MCP example, failure-recovery doc,
CLI e2e + RPC-adversarial tests; 777 tests / 40 files, verify:all green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Real on-chain Drift attack corpus (held), npm sign-safe, rpc-adversarial coverage,
fuzz + fail-closed fix. 800 tests/42 files, verify:all green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
IDL-verified registry (69/69 ixNames vs canonical IDLs), benign corpus 500
(18.4% SIGN / 81.6% HOLD / 0 false-REJECT), Stryker mutation testing. verify:all green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Fix: npx sign-safe bin was inert (exit 0 for every tx); now correct exit codes + regression test. 803 tests/42 files, verify:all green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Updates the pinned sign-safe-skill from v0.6.2 (02b3150) to the current main
(e288e9d): v0.6.4 (npm-published, README install + What's-new) plus the repo
security hardening (CI least-privilege + SHA-pinned actions, Dependabot,
branch protection).

Co-Authored-By: Claude Opus 4.8 (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