cred402/SECURITY.md
caelum0x 2d43618725 feat: real integrations (Casper Testnet, x402/EIP-712, MCP, RealFi, cross-chain), wallet sign-in, branding
Replace the design-note docs (p1–p7) with the implemented "make it real" phase
docs (p8–p10) and wire production-grade, env-gated real integrations:

- p8 Casper Testnet: byte-exact deploys + WASM install via casper-js-sdk; live
  node reads (node.testnet.casper.network); CRED402_CHAIN=sim|testnet transport.
- p9 x402 + data + MCP: real EIP-712 typed-data digests (@casper-ecosystem/
  casper-eip-712); casper-x402 facilitator client (x402 V2); live Open-Meteo GHI;
  official @modelcontextprotocol/sdk server; casper-sidecar SSE event feed.
- p10 RealFi + cross-chain: real Stripe test-mode webhooks (HMAC-verified) and
  Plaid sandbox → privacy-preserving on-chain envelopes; Base Sepolia EVM deploy
  (Foundry); reachable via /api/realfi/* and /api/x402/facilitator routes.
- Sign-in with Casper Wallet: real extension provider + challenge/ed25519/session
  flow (/v1/auth/wallet/*), console connect + sign-in button.
- Branding: Cred402 logo mark, favicon, OG image; Vercel config for the console.

All env-gated with sim/free-API fallbacks; full suite green, all toolchains
(TS/Rust/Go/Solidity) build.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 00:37:36 +03:00

27 lines
1.5 KiB
Markdown

# Security
Cred402 is hackathon/research software. Do not use it with real funds or real
KYC/lending without an audit. The implemented mitigations are below.
## Implemented mitigations
| Threat | Mitigation in this repo |
| --------------- | ----------------------- |
| Fake x402 revenue / collusion rings | `FraudService` — reciprocal-loop, operator-linkage, revenue-concentration and velocity detection; gates credit underwriting (`lib/services/fraud_service.ts`). |
| Payment replay | Nonce uniqueness per payer + payment-proof dedupe + expiry rejection in `X402ReceiptRegistry` and the Odra contract; `verifyPayment` rejects expired challenges. |
| Falsified RWA evidence | WatchdogAgent cross-checks against an independent source → DisputeCourt → DisputeJudge → SlashingVault. |
| Unauthorized parameter changes | Admin-gated privileged methods in every Odra contract; off-chain governance writes are logged with a public parameter history. |
| Over-exposure / risky draws | `max_agent_exposure` cap, `min_reputation_to_draw` floor, open-dispute draw block, emergency pause flags. |
| Signature forgery | ed25519 verification against the payer's Casper public key on every x402 payment. |
## Reporting
This is a demo repository. For the production protocol, security reports would go
to a dedicated channel with coordinated disclosure.
## Secrets
No secrets are committed. Live Testnet deploys read `CRED402_SECRET_KEY` /
`CRED402_NODE` from the environment (see `scripts/deploy_testnet.ts`). Keep keys
out of source control (`.gitignore` covers `.env`).