Skip to content

Threat And Abuse Model

ModelFaucet 0.8.0 hardens the source beta before hosted pilots. This document tracks the highest-risk misuse paths and the controls that must remain intact in every release.

Security Invariants

  1. Provider API keys stay server-side only.
  2. BYOK behavior is explicit; hidden BYOK markup is not allowed.
  3. Cloud services must not access localhost, metadata services, or private LAN URLs.
  4. Local Bridge access to localhost/LAN is allowed only because it runs inside the user's local trust boundary.
  5. Money movement must be auditable before payout transitions.

Threat Model

ThreatImpactCurrent controls
Client bundle contains provider credentialsProvider account compromiseProvider keys are accepted only by server routes, encrypted before persistence, masked in responses, and scanned by pnpm verify:secrets.
BYOK base URL targets private networkSSRF against local, LAN, or metadata servicesShared CloudSafeBaseUrlSchema blocks localhost, private IPv4, carrier NAT, link-local, private IPv6, IPv4-mapped IPv6, and known metadata hostnames.
Production CORS defaults to wildcardCross-site abuse of token/session APIsAPI_CORS_ORIGINS and GATEWAY_CORS_ORIGINS are required in production and cannot be *.
Stolen session token is replayedUnauthorized model usageTokens are short-lived, stored hashed, and validated against active app/developer/session records.
Provider failure leaks secrets in responsesSecret disclosureGateway provider attempt metadata includes status/error class only, not bearer credentials.
Payout marked paid without reviewUnapproved money movementmark-paid requires prior payout approval through processing; all transitions write audit logs.
Dependency with known high vulnerability shipsSupply-chain exposureCI runs pnpm security:audit at high severity and pnpm verify:secrets.

Abuse Model

Abuse caseDetection signalsControls
Credit farming through many usersHigh session creation rate, repeated IP/device pattern, wallet failuresIP+route rate limits, wallet balance checks, future device/app-level velocity limits.
Developer creates abusive appNew app traffic spike, high provider error rate, suspicious feature metadataDeveloper admin review, audit logs, app status controls, roadmap tenant isolation checks.
BYOK used to hide platform costsUnexpected route/cost mismatchBYOK records zero platform upstream cost and explicit route mode.
Provider-key budget exhaustionDeveloper-key spend approaches limitGateway budget checks before developer-key routing.
Webhook replay duplicates creditRepeated Stripe event/session IDsTop-up crediting is idempotent by Stripe event/session state.
Payout fraudPayout velocity, mismatched ledger reconciliation, unreviewed statusLedger reconciliation, payout approval gate, audit logs, pending/processing status review.

Release Regression Requirements

Before tagging a release:

  • Run pnpm verify:secrets.
  • Run pnpm security:audit.
  • Run lint, typecheck, and tests.
  • Run docs build and app builds.
  • Run local smoke with ledger reconciliation.
  • Confirm no API response or dashboard surface returns raw provider keys.
  • Confirm production CORS cannot boot without explicit allowlists.
  • Confirm cloud provider URL paths reject localhost, private LAN, metadata, and IPv4-mapped private hosts.

Hosted Pilot Gaps

These remain required before hosted beta:

  • Real secret manager integration.
  • Tenant/app isolation tests against hosted data stores.
  • WAF or edge rate limits in front of API and Gateway.
  • Provider and Stripe test accounts with alerting.
  • KYC/AML workflow for real payouts.
  • Incident response contacts and key-rotation runbook.

Released under the Apache-2.0 license.