Security model
What KryptWarden protects against, how, and where the limits are.
The design rule is simple: the contract decides. The agent, the SDK, the relayer and the indexer can all be wrong or compromised, and the money still only moves in ways the owner's policy allows.
What each component can do
| Component | Holds keys? | Worst case if compromised |
|---|---|---|
| Agent runtime | Agent key | Spends up to the policy: allowed sellers, auto-approve limit, daily budget. Can't withdraw, change policy or skip holds |
| SDK | No | Same as the agent; the contract re-checks everything |
| Facilitator / relayer | Its own fee account | Refuses to submit (fails closed). Can't forge or alter agent signatures |
| Indexer | None | Shows wrong history. Reconciliation against the chain exposes it |
| Dashboard | None (signing happens in your wallet extension) | Can ask you to sign something; your wallet shows exactly what |
Threats and mitigations
The key can only authorise a single USDC transfer from the wallet, to an allowed seller, within budget. It can't call withdraw, update_policy or approve_hold. The owner can revoke_agent in one signature, which also cancels its open holds.
The SDK re-reads the seller's 402 after approval and aborts with BAIT_AND_SWITCH_DETECTED if amount, recipient or asset changed. Independently, __check_auth requires the transfer's seller and amount to equal the approved hold.
Every agent signature binds the network ID and the wallet address, so it can't be reused on Mainnet or on another wallet. Each request_id is stored for 7 days and rejected if seen again. Hold and rejection intents also carry a max_ledger expiry and a domain tag (KW_HOLD1, KW_REJ1) so one kind can't be passed off as another.
__check_auth accepts exactly one auth context, a USDC transfer, and rejects sub-invocations (SubInvocationsNotAllowed, 112).
Soroban transactions are atomic. If the USDC transfer fails, for example because the seller has no trustline, the spend counter, hold status and request ID all roll back.
At most 8 open holds per agent on-chain, and per-agent rate limits plus a daily fee cap on the relayer.
Contract foundations
The wallet uses OpenZeppelin Stellar Contracts v0.8.0:
- Ownable: owner-only functions.
renounce_ownershipis disabled (RenounceDisabled, 128), so a wallet can't be left without an owner. - Pausable: the wallet-wide kill switch.
- Upgradeable: the owner can upgrade the wallet's code.
Release WASMs are built in CI and attested with SEP-55, so you can check that the deployed hash matches the source.
Known limits (Phase 1)
- Testnet only. Not audited for Mainnet. The repo's
docs/SECURITY_MAINNET_CHECKLIST.mdlists what must happen first. - Rejection records are best-effort. Soroban drops events from a failed transaction, so a refused payment is logged by the SDK through the relayer. An agent that skips the SDK still can't spend, but its refused attempts won't appear in the audit log.
- Amounts are public. Balances and transfers are visible on-chain.
- One relayer account. Submissions are serialised, at about one transaction per ledger (roughly every 5 seconds).
- RPC event history is short. Public Soroban RPC keeps events for about 7 days. The indexer stores them permanently, but it must run at least once within that window to see them.