lucidAGENTS
Operate

Threat model and shared responsibility

Protect signing authority, payment admission, discovery, durable state, tasks, tenants, and evidence.

Lucid coordinates sensitive systems but does not make them trustworthy. Model the buyer, seller, wallet, facilitator/provider, discovery document, network, storage, adapter, handler, and LLM as separate trust zones.

Payment proves that the configured verifier accepted a credential for one requirement. It does not make input safe, prove fulfillment quality, establish a human identity, or authorize unrelated application actions.

Assets to protect

  • buyer and operator signing keys;
  • hosted-wallet and facilitator bearer tokens;
  • Stripe/Tempo/provider secrets;
  • payment credentials, receipts, and transaction identifiers;
  • idempotency keys and retained successful responses;
  • SIWX nonces and entitlements;
  • task access tokens, task contents, and subscriber streams;
  • tenant-specific payment totals, policies, schedules, and identity records;
  • registration metadata, Agent Cards, catalogs, and OASF documents;
  • application inputs/outputs and any personal or confidential data they carry.

Trust boundaries

Untrusted caller / discovered service
              ↓ validate URL, schema, identity, price, recipient
Lucid HTTP + authorization runtime
       ↙                     ↘
wallet/signer              facilitator/provider/network
       ↘                     ↙
 policy + durable stores + idempotency

handler / model / external tools

settlement, task, result, and audit evidence

Never let an LLM cross a payment, mandate, wallet, URL, or authorization boundary without deterministic code enforcing policy. Prompt-injection resistance is not a substitute for a verifier.

Threat and control matrix

ThreatEntry point / attackerRequired controlResidual risk and test
Signing-key theftLogs, source, browser bundle, CI, compromised hostServer-only secret manager or remote signer; least balance/authority; rotation and revocationHost compromise can still sign; test secret scans and emergency rotation
Malicious payment requirementCompromised seller/discovery/proxy changes price, payee, networkBuyer allowlists recipient and origin; caps request/total; validates canonical URL/network/amount before signingApproved seller can still overcharge within limits; test wrong recipient/network/amount
Confused deputyLLM or user convinces buyer to pay an unrelated endpointBind policy to business intent, exact endpoint, recipient, maximum amount, and approval tierIntent classification can be wrong; test prompt-injected URLs and recipients
Credential replay / duplicate chargeNetwork retry, attacker, concurrent workersProtocol nonce/expiry; one business idempotency key; atomic shared stores; provider-side dedupeExternal settlement may precede local record; inject concurrent and crash retries
Body or target substitutionProxy/caller reuses credential for different payload/routeVerify method, canonical URL, request/body binding, entrypoint, mode, price, and subjectProtocol subsets differ in body binding; test same credential against changed body/route
False payer identityRequest body/header asserts walletUse only facilitator/verifier-recovered payer; normalize chain/addressVerifier/provider compromise remains; test spoofed body and Origin/Referer
Settlement ambiguityTimeout/crash between settlement and local commitNon-expiring staged accounting, retained idempotency claim, provider/chain reconciliationNo packaged reconciler; run crash-window drills and manual recovery
Handler side effect without settlementInvoke handler writes externally before settlement failsDownstream idempotency/compensation; defer irreversible effects where possibleSome effects cannot roll back; fault-inject settlement after handler success
SSRF and unsafe discoveryAgent Card/interface URL, registration URI, OASF, catalog locatorAllow schemes/hosts/IP ranges; block loopback/link-local/metadata; redirect and size/time limitsDNS rebinding/proxy paths remain; test private IPs and redirect chains
Task-token disclosureURL/log/analytics/browser history/operator outputKeep Task-Access-Token in a secret header; persist hash only; redact everywhereToken remains bearer authority; test wrong-token indistinguishability and log sinks
Cross-tenant data/spend leakageShared database/store keysNamespace by trusted tenant/agent ID; tenant in every primary/unique key and policy scope; row-level access controlsA missing predicate can leak; run adversarial two-tenant contract tests
SIWX nonce race or broad entitlementConcurrent requests, weak scope/expiryRandom single-use nonce; atomic consume; bind domain/URI/chain/resource; short expiryWallet control is not business permission; test wrong scope and double consume
Custom MPP verifier bypassDecode-only or caller-controlled payer/receiptCryptographically verify full challenge, payment, settlement, amount, recipient, target, payer; fail closedCustom provider semantics remain yours; negative-test every omitted field
Schema/output injectionCaller or model outputZod input/output validation, size/time limits, contextual output encodingValid structured content may still be malicious; test downstream rendering/commands
Log and telemetry exfiltrationErrors, traces, CSV exports, support bundlesField allowlist and structured redaction before serialization; access/retention controlsDerived metadata can identify users; inspect real exported payloads
Supply-chain compromisenpm packages, CI action, skill/plugin, generated templateLockfile, provenance/signature policy, minimal install scripts, dependency review, secretless buildsTrusted dependencies can update; rehearse rollback and compromised-release response
Stale or false protocol metadataSelf-declared Agent Card/AP2/ERC registrationPin versions; verify authoritative source/signature/on-chain owner; revalidate freshnessIdentity/reputation does not prove safety or uptime; test stale/rotated metadata

Shared responsibility

ControlLucid providesYou or the provider must provide
Input/output shapeZod validation hooks and canonical handlersCorrect schemas, semantic validation, size/time limits, safe rendering
x402/MPP credential processingDocumented protocol subset and shared gateTrusted facilitator/verifier, provider account, supported asset/network, incident escalation
Buyer policyRecipient/sender lists, amount/total/rate policy portsCorrect identities, approval workflow, durable shared store, policy review
IdempotencyInvoke claim/fingerprint/response portDurable atomic implementation, retention/capacity, downstream dedupe
Payment accountingReservations and staged settlement recordsBackups, migrations, tenant isolation, reconciliation, refunds, finance ledger
Wallet connectorSigning/challenge abstractionCustody, transaction policy, balance limits, rotation, recovery
SIWXVerification and nonce/entitlement portDurable atomic store, business authorization mapping, lifecycle/revocation
Tasks and schedulesOwnership tokens, state/lease store interfacesDurable implementations, capacity, worker isolation, recovery, user-visible SLAs
Agent Card/ERC/AP2 metadataGeneration/parsing for documented subsetAuthenticity/freshness verification and correct interoperability claims
Framework adapterCanonical route bindingTLS, proxy limits, auth middleware composition, headers, shutdown, host hardening
ObservabilityIDs and analytics over payment trackerSecure logs/traces, redaction, SLOs, alerts, incident response

Wallet and secret policy

  • Use distinct buyer, seller, identity-owner, and deployer roles unless a reviewed custody model requires consolidation.
  • Give autonomous wallets the minimum balance and contract/network authority.
  • Do not expose private keys or provider secrets to browser code, prompts, model tools, build logs, stack traces, or support bundles.
  • Rotate bearer tokens without restarting into an inconsistent signer state; revoke hosted wallet sessions after compromise.
  • Pin chain IDs and contract/recipient addresses from trusted configuration, never from an untrusted request alone.

Storage and tenant isolation

Production stores must be atomic across every worker that shares a budget, nonce, task, schedule, or idempotency namespace. A local SQLite file does not coordinate separate hosts. A Postgres connection alone does not provide tenant isolation unless every table/key/query is scoped and tested.

Encrypt backups and sensitive columns according to the data model, restrict operator access, define retention/deletion, and test restore before launch. Task contents and retained idempotent responses may contain the full application output.

Logging and evidence policy

Record stable correlation metadata, not credentials. Safe fields usually include sanitized run/task IDs, idempotency hash or internal reference, entrypoint/mode, normalized network, verified payer/recipient, decimal amount, policy group/result, status/error code, settlement evidence reference, and duration.

Never record private keys, bearer tokens, PAYMENT-SIGNATURE, raw Authorization: Payment, SIWX signatures, task access tokens, cookies, full wallet challenges, or unredacted request/output bodies by default.

Required security tests

Before production, automate:

  1. wrong recipient, price, network, chain, body, route, signer, and payer;
  2. expired, malformed, unknown, and concurrently replayed credentials;
  3. same idempotency key with the same and different subject/body;
  4. crash before settlement, after settlement, and before result/accounting commit;
  5. discovery URLs targeting loopback, private, link-local, metadata, DNS rebound, oversized, and redirect-loop destinations;
  6. cross-tenant reads, budget reservations, task access, and subscriptions;
  7. SIWX double-consume, wrong domain/URI/chain, expiry, and entitlement scope;
  8. task token leakage through logs/traces/errors and wrong-token behavior;
  9. secret rotation, wallet revocation, compromised facilitator/provider, and dependency rollback;
  10. a redaction test over real logs, traces, analytics export, and support bundle output.

Incident response minimum

When signing or payment authority may be compromised: stop new paid admission, revoke/rotate credentials, freeze or restrict the wallet/provider policy, retain immutable evidence, enumerate unsettled/staged/idempotent operations, reconcile provider/chain outcomes, notify affected tenants, and resume through a low-limit canary. Do not delete staged records merely to clear an alert.

Next, implement the durable storage contract, the observability model, and the payment recovery transaction.

On this page