Skip to content

Security: Rate limiting, prototype pollution, registration hardening#10

Open
kai-agent-free wants to merge 5 commits intomainfrom
security/hardening-fixes
Open

Security: Rate limiting, prototype pollution, registration hardening#10
kai-agent-free wants to merge 5 commits intomainfrom
security/hardening-fixes

Conversation

@kai-agent-free
Copy link
Owner

Security Hardening

Changes

  1. Auth rate limiting — 5 req/min on /auth/register and /auth/login
  2. Prototype pollution — sanitizeBody() middleware strips dangerous keys recursively
  3. Password policy — min length 8→12, require number + special character
  4. Email enumeration — generic error instead of 'Email already registered'
  5. JWT secret — startup check already in place (verified)

All 733 tests pass. Build passes.

- ReputationProvider interface for pluggable DID reputation sources
- CoinPayReputationProvider stub (7-dimension trust vector)
- ReputationAggregator that converts to ExternalAttestation format
- 3 passing tests
- Spec at specs/coinpay-did-reputation.md
- Add /reputation/* API routes (get reputation, trust vector, badge proxy,
  submit receipt, claim DID, register platform issuer)
- Update CoinPayReputationProvider in core to use real SDK API paths
  (Authorization: Bearer, /reputation/agent/:did/reputation, etc.)
- Install @profullstack/coinpay@0.6.10 in api-server
- Fix pre-existing TS build errors (trust.ts unused var, captcha-service,
  aggregator import path)

Routes require COINPAY_API_KEY env var. Public endpoints:
  GET /reputation/:did
  GET /reputation/:did/trust
  GET /reputation/:did/badge
Auth-protected:
  POST /reputation/receipt
  GET  /reputation/did/me
  POST /reputation/did/claim
  POST /reputation/issuer
- Added CoinPayDID section with live trust score from CoinPay API
- Shows DID, trust tier, score, and trust vector dimensions
- Added 'Trust Score' nav link in header
- Section placed between Architecture and MCP Tools sections
- Strip version and uptime from /health endpoint (info leak)
- Remove hardcoded IP 38.49.210.10 from landing page demo
- Update health endpoint tests to verify no data leakage

Note: vault.ts exec() is better-sqlite3 Database.exec() (SQL DDL),
not child_process.exec() — no RCE risk (false positive).
…tion hardening

- Add strict rate limit (5 req/min) on /auth/register and /auth/login
- Add sanitizeBody middleware to strip __proto__, constructor, prototype keys
- Increase password minimum length from 8 to 12, require number + special char
- Replace 'Email already registered' with generic 'Registration failed' to prevent enumeration
- JWT secret startup check already present (warn in dev, throw in prod)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant