Skip to content

Commit d85fb61

Browse files
committed
feat: run autonomous payment attack scenarios
1 parent 29ae12b commit d85fb61

6 files changed

Lines changed: 1055 additions & 0 deletions

File tree

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,18 @@ uv run solguard-api --config ./autonomous-api.json
191191
See the [autonomous payment-intent API guide](docs/AUTONOMOUS_API.md) for the public-key
192192
configuration, Ed25519 signing contract, quarantine semantics, and trust boundary.
193193

194+
Run the deterministic headless agent demonstration (no dashboard or external funds required):
195+
196+
```bash
197+
uv run solguard-autonomous
198+
```
199+
200+
The command prints one machine-readable JSON report. Its wallet balance, decisions, counters,
201+
and settlement references are computed during the run and explicitly labelled
202+
`DETERMINISTIC_SIMULATION`; they are not blockchain claims. See the
203+
[autonomous security runner guide](docs/AUTONOMOUS_RUNNER.md) for the exact scenario and trust
204+
boundary.
205+
194206
Open `http://127.0.0.1:8765`. Select **Start guided demo** for an eight-step,
195207
judge-facing walkthrough of a payment intent, canonical request, integrity check,
196208
financial mandate, behavioural analysis, authorization, wallet outcome, and hash-linked

docs/AUTONOMOUS_RUNNER.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Autonomous security runner
2+
3+
`solguard-autonomous` is the reproducible, headless proof that SolGuard can control an
4+
autonomous payment loop without a person approving each transaction. It is independent of the
5+
dashboard: CLI events and gateway audit receipts are the authoritative evidence, while a UI may
6+
observe them passively.
7+
8+
## Deterministic sequence
9+
10+
The local command executes one fixed sequence against the real contracts, identity verifier,
11+
integrity guard, mandate engine, behavioural engine, decision API service, authorization guard,
12+
and simulated settlement boundary:
13+
14+
1. Three 10 USDC payments to a known recipient are allowed and settled. These confirmed clean
15+
settlements establish a 10 USDC behavioural average.
16+
2. A 10 USDC payment to a first-seen but policy-allowed recipient is quarantined. It receives no
17+
authorization and never reaches settlement.
18+
3. The exact same signed request and nonce are submitted again. Replay protection blocks it
19+
before behaviour evaluation and settlement.
20+
4. A manipulated x402 requirement requests 20 USDC for a new attacker recipient at the fifth
21+
evaluated attempt inside ten seconds. The documented compound rule is therefore true: new
22+
recipient + at least 2x the clean average + high velocity. SolGuard blocks the request without
23+
authorization or settlement.
24+
25+
There is no random compromise trigger. Scenario inputs, ordering, and observed time are fixed for
26+
each run.
27+
28+
## Execution boundary
29+
30+
```text
31+
simulated paid resource -> x402 parser -> canonical PaymentRequest
32+
-> Ed25519 agent signature -> authenticated decision API
33+
-> ALLOW -> request-bound authorization -> injected settlement boundary
34+
-> REQUIRE_APPROVAL -> quarantine; stop that intent
35+
-> BLOCK -> stop that intent
36+
```
37+
38+
The runner owns an agent identity key but has no wallet-signing method. Its only payment dependency
39+
is the injected settlement protocol. The default implementation uses the existing in-memory
40+
settlement adapter and labels every result `SIMULATED`.
41+
42+
The decision API itself is constructed with a forbidden settlement adapter. This makes an
43+
accidental attempt to settle from the policy service an explicit failure.
44+
45+
## Behaviour state
46+
47+
Only a successful settlement calls `BehaviourEngine.record_allowed`. Quarantined, replayed,
48+
blocked, or failed traffic cannot enter the clean amount/recipient baseline. Attempts still count
49+
toward the velocity rule, as required for rapid-drain detection.
50+
51+
## Output and exit status
52+
53+
The command emits a single JSON object containing ordered runtime events and computed totals. It
54+
returns zero only when all expected decisions and signer-boundary invariants are observed. A
55+
resource, protocol, API, authorization, or settlement failure stops safely and returns non-zero.
56+
57+
No result from this command is a real Solana transaction or a real asset balance. Real devnet
58+
confirmation remains a separate opt-in integration and must be supported by RPC-derived evidence.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ dependencies = [
3232

3333
[project.scripts]
3434
solguard-api = "solguard.autonomous_api:main"
35+
solguard-autonomous = "solguard.autonomous_runner:main"
3536
solguard-dashboard = "solguard.dashboard:main"
3637
solguard-demo = "solguard.demo:main"
3738
solguard-paysh = "solguard.paysh:main"

0 commit comments

Comments
 (0)