Vestige — Security
Vestige never needs custody, never executes trades and never asks for trading permissions. The only secret it holds that matters is the credential issuer key. This document lists the controls in place and the operational requirements for production.
Threat model (what matters most)
| Asset | Threat | Control |
|---|---|---|
| Issuer signing key | theft → forged credentials | KMS/HSM in production; rotation; compromise date invalidates later signatures; optional onchain issuer registry |
| Wallet claims | impersonation, replay | SIWE (EIP-4361) with single-use nonces, domain binding, expiry, signature verification |
| Sessions | theft, fixation | random 256-bit tokens, stored as SHA-256 hashes, httpOnly + SameSite=Lax (+ Secure on https), 24 h expiry, server-side revocation |
| Reputation integrity | flow games, cherry-picking, one-lucky-trade wallets, buying reputation | cash-flow-neutral returns, conservative denominators for flow-dominated intervals, minimum observation requirements, shrinkage, confidence caps, non-transferable credential subjects, soulbound passport NFT, methodology versioning |
| API | abuse, scraping, key leakage | per-IP and per-key rate limits, keys hashed at rest and shown once, usage logs |
| Webhooks | SSRF, spoofing | https only, DNS-resolved public IPs only, no redirects, 10 s timeout, HMAC-SHA256 signatures with timestamp |
| Database | injection, privilege | parameterized queries only (postgres.js tagged templates), least-privilege DB user, backups |
Wallet authentication
POST /api/auth/nonce {address, chainId}creates a 128-bit nonce (stored with address, expiry 10 min, IP hash) and returns an EIP-4361 message bound to the site's domain and URI. The statement says the signature proves wallet control only — not identity — and costs nothing.- The wallet signs (
personal_sign).POST /api/auth/verifyparses the message, validates domain + time window, consumes the nonce atomically (UPDATE … WHERE consumed_at IS NULL AND expires_at > now() RETURNING) so a replayed signature fails, checks the nonce was issued for that address, then verifies the signature. - On success: an ownership proof row (message + signature + nonce) is stored, the trader profile is claimed, a session is created and an audit log entry written. If another account held the claim, proven control of the key moves it (the previous proof is revoked).
- Seed phrases, private keys and trading/agent permissions are never requested. Ownership ≠ identity — the UI says so.
Credential issuer key
- Development:
VESTIGE_ISSUER_PRIVATE_KEYin.env.local(generated locally, never committed). - Production requirement: a secp256k1 key in a cloud KMS or HSM (e.g. AWS KMS
ECC_SECG_P256K1, GCP Cloud KMSEC_SIGN_SECP256K1_SHA256) exposed through theTypedDataSignerinterface inpackages/core/src/credentials/eip712.ts(sign the EIP-712 digest, convert the DER signature tor,s,v). The worker is the only component that signs; the web app never holds the key. - Rotation: register a new issuer id + address (
credential_issuers), point the worker at it, setvalid_untilon the old issuer. Old credentials stay valid because verification checks authorization at issuance time. With the registry deployed,addIssuer(new)thenretireIssuer(old). - Compromise: set
status = 'compromised'andcompromised_at; every credential signed at or after that time verifies as unknown issuer. Re-issue affected credentials with the new key and publish an incident note. - Methodology integrity: methodology parameters are hashed; the worker refuses to start if a published version's content changed (forces a version bump).
API & webhooks
- Anonymous: 60 requests/min per IP (hashed with a salt). API keys: 300/min by default. Standard
x-ratelimit-*headers; 429 withretry-after. - Keys are
vst_live_<192-bit random>; onlysha256(key)and a display prefix are stored; revocation is immediate. - Webhook payloads are signed:
vestige-signature: t=<unix>,v1=<hex HMAC-SHA256(secret, "<t>.<body>")>. Receivers should reject timestamps older than 5 minutes. Delivery retries: 1 m, 5 m, 30 m, 2 h, 6 h, 12 h, then dead. - SSRF guard on registration and every delivery: https only, no credentials in URLs, every resolved address must be public (RFC1918, loopback, link-local, CGNAT, multicast and IPv6 ULA/link-local are rejected), redirects not followed.
Web application
- Security headers:
X-Content-Type-Options: nosniff,Referrer-Policy: strict-origin-when-cross-origin,Permissions-Policy(camera only for the QR scanner),X-Frame-Options: SAMEORIGINeverywhere except/embed/*. - CORS
*only on the read-only/api/v1/*surface; session routes are same-origin with SameSite cookies. - Input validation on every route (addresses, aliases, URLs, sizes); profile text is length-limited and rendered as text.
- Privacy: the explorer hides unlisted profiles, the passport respects hidden credentials/fields, but the UI states clearly that hiding data in Vestige does not make public blockchain records private.
Smart contracts
- No upgradeability, no value handling, custom errors, two-step admin transfer (intended to be a Safe), issuer self-retire emergency brake, immutable anchors and methodology hashes, one-way revocation.
- 58 Foundry tests including fuzzing (512 runs) and an invariant suite asserting anchors never change except a single revocation write. No external audit has been performed — get one before mainnet deployment.
Operational checklist
- Issuer key in KMS/HSM; remove
VESTIGE_ISSUER_PRIVATE_KEYfrom all environments. - Least-privilege DB role for the web app (read + the few write tables it needs); separate role for the worker.
-
SESSION_SECRET/IP_HASH_SALTrotated per environment; HTTPS only (NEXT_PUBLIC_SITE_URLwith https enables Secure cookies). - Automated Postgres backups + restore drill; audit log retention policy.
- Dependency monitoring (Dependabot/Renovate),
pnpm auditin CI,forge testin CI. - Error monitoring (Sentry or similar) on web and worker; alert on worker heartbeat staleness (
system_kv.worker.heartbeat). - External smart-contract audit before deploying the registry to Elysium mainnet; Safe as registry admin.