Phase 1: encryption hardening (logging, transport, secrets, storage)
From the PR description
Summary
Phase 1 of the encryption review - hardening that ships before the envelope-encryption work in Phase 2.
- Logging: strip PII from request/error logs; no key prefixes or auth headers.
- Transport:
helmet+ HSTS on the backend;apiBaseenv gate so the frontend can't fall back to a hardcoded host. - Secrets: new
DOWNLOAD_SIGNING_SECRET(Secrets Manager:mike/download-signing-secret) decoupled fromSUPABASE_SECRET_KEY, so future Supabase key rotations don't invalidate chat-rendered download links. - Storage: SSE on every
PutObject(falls back to SSE-S3 today; KMS lands in Phase 2). - API surface:
/system/llm-providersreturns booleans only - no key-prefix leak. - Test scaffold + ESLint guard (Phase 0, prerequisite).
- Dead code: drop
frontend/src/lib/supabase-server.ts(unreferenced service-role helper) - let us stripSUPABASE_SECRET_KEYfrom the Amplify env.
Infra changes already made (out-of-band, in prod)
- New Secrets Manager entry
mike/download-signing-secret(32-byte hex). - New ECS task def
mike-backend:6, service rolled to:6(addsDOWNLOAD_SIGNING_SECRETtosecrets[]). - Rotated
SUPABASE_SECRET_KEYto the newsb_secret_*format. - Removed
SUPABASE_SECRET_KEYfrom prod Amplify app env.
Deferred to follow-ups
- Download-token TTL + userId binding - chat-rendered links live in
chat_messages.contentforever; needs a refactor ofchatTools.tslink-rendering to a fetch-on-demand stub first. - 36 pre-existing ESLint errors / 68 warnings - separate branch.
Test plan
- Staging-validated end-to-end against a live Supabase project + MinIO (throwaway harness in
scripts/staging/). - Both pre-merge checks passed:
NEXT_PUBLIC_API_BASE_URLset on prod Amplify;SUPABASE_SECRET_KEYwired in prod ECS task def. - After merge: confirm Amplify build succeeds and ECS rolls forward with no health-check flaps.
Our analysis
Phase 1 encryption hardening across logging, transport, and storage — read the full analysis →
Think the analysis missed something the PR description covers?
Capture this PR into my fork
Download a Markdown prompt that tells Claude how to port every
commit in this PR into your working tree. Run it via
claude -p < capture-pull-4.md from
inside the repo you want the changes in.