Skip to content

fix(security): auth on internal APIs, secure UUID, SSRF blocklist (#10 #12 #14)#20

Merged
willamhou merged 2 commits intomainfrom
fix/security-hardening
Apr 6, 2026
Merged

fix(security): auth on internal APIs, secure UUID, SSRF blocklist (#10 #12 #14)#20
willamhou merged 2 commits intomainfrom
fix/security-hardening

Conversation

@willamhou
Copy link
Copy Markdown
Member

Summary

Three security fixes for the server:

#10 — Internal APIs now require authentication

  • /api/search, /api/content, /api/compress were publicly accessible
  • Added apiGuard(request, { tier: 'billable' }) to all three
  • Load API's internal calls now forward the Authorization header

#12 — Cryptographically secure UUIDs

  • generateUUID() replaced Math.random() with crypto.randomUUID()
  • Affects payment records, API key IDs, usage records

#14 — SSRF private IP blocklist

  • /api/content blocks localhost, 127.0.0.1, ::1, 10.x, 172.x, 192.168.x, 169.254.x, .internal, .local
  • Webhook delivery validates endpoint URLs before sending
  • Only http/https schemes allowed

Test plan

  • /api/search without auth → 401
  • /api/content with auth → works
  • /api/content with private IP URL → 400 blocked
  • /api/context/load end-to-end still works (internal calls forward auth)
  • Webhook to localhost endpoint → silently blocked
  • generateUUID() returns valid v4 UUID format
  • CI passes

Closes #10, closes #12, closes #14.

🤖 Generated with Claude Code

willamhou and others added 2 commits April 6, 2026 16:46
#10 — Add apiGuard to /api/search, /api/content, /api/compress
  Previously publicly accessible with no authentication. Now require
  API key or JWT like all other billable endpoints. Internal calls from
  Load API now forward the Authorization header.

#12 — Replace Math.random() UUID with crypto.randomUUID()
  Payment records, API key IDs, and usage records now use
  cryptographically secure UUIDs.

#14 — Add private IP blocklist for SSRF prevention
  /api/content URL validation now blocks localhost, 127.0.0.1, ::1,
  10.x, 172.x, 192.168.x, 169.254.x, .internal, .local.
  Webhook delivery also validates endpoint URLs before sending.

Closes #10, closes #12, closes #14.

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
Copy seed data from closed-source repo. On server startup,
ensureSeedGenesInTable() loads these into the database (idempotent).

- seed-genes.json: 28 core genes (repair, optimize, innovate)
- seed-genes-external.json: 17 extended genes
- seed-genes.schema.json: JSON schema for validation

Categories: repair (21), optimize (14), innovate (10)

Self-host users now see a populated Evolution Map immediately
after docker compose up, and evolve analyze returns recommendations
from day one.

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
@willamhou willamhou merged commit f642eb9 into main Apr 6, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant