feat(ml): add API key authentication via FastAPI Depends() on all endpoints except /health
- Import Header, Depends, Security from fastapi - Add verify_api_key dependency: reads API_KEY env var, checks X-API-Key header, raises HTTP 401 if key mismatch; fail-open if env var not set - Apply Depends(verify_api_key) to all 14 non-health endpoints - /health endpoint remains unauthenticated for liveness probes - Mark task 3.2 as complete in tasks.md Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
577bb2e56e
commit
5f569d9134
2 changed files with 26 additions and 15 deletions
|
|
@ -20,7 +20,7 @@
|
|||
## 3. Authentication
|
||||
|
||||
- [x] 3.1 `[sonnet]` Create `src/middleware.ts` with API key auth middleware: read `API_KEY` env var, check `X-API-Key` header on all `/api/*` routes except `/api/health`, return 401 if invalid
|
||||
- [ ] 3.2 `[sonnet]` Add FastAPI `Depends()` API key dependency in `services/ml/app/main.py`: read `API_KEY` env var, check `X-API-Key` header, exempt `/health` endpoint
|
||||
- [x] 3.2 `[sonnet]` Add FastAPI `Depends()` API key dependency in `services/ml/app/main.py`: read `API_KEY` env var, check `X-API-Key` header, exempt `/health` endpoint
|
||||
- [ ] 3.3 `[sonnet]` Update all Next.js proxy routes to forward `X-API-Key` header to ML service
|
||||
- [ ] 3.4 `[haiku]` Add `API_KEY` to `.env.example` with placeholder value and instructions
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue