Add optional API token auth and validation tests

This commit is contained in:
Rbanh committed 2026-02-18 20:59:18 -05:00
1 parent f65e4d9876
commit bfb8275b2f
5 files changed
+69

No files matched your search

+7
View File
@@ -15,6 +15,10 @@ This runbook covers baseline production operation for Schemeta API + UI.
- Hard limit for request body size on `POST` endpoints.
- `MAX_REQUESTS_PER_MINUTE` (default `120`)
- Per-client IP rate limit window for `POST` endpoints.
- `SCHEMETA_AUTH_TOKEN` (optional)
- When set, all `POST` API routes require either:
- `Authorization: Bearer <token>`
- `x-api-key: <token>`
- `CORS_ORIGIN` (optional)
- If set, CORS is enabled for this origin only.
@@ -41,6 +45,9 @@ This runbook covers baseline production operation for Schemeta API + UI.
- post same sample to `/analyze`.
4. Verify rate limiting:
- exceed `MAX_REQUESTS_PER_MINUTE` with repeated `POST` and confirm `429`.
5. Verify auth (if enabled):
- request `POST /compile` without token and confirm `401`.
- request with valid token and confirm `200`.
## Incident Playbook
+1
View File
@@ -31,6 +31,7 @@ Use this checklist before cutting a release tag.
- [ ] `PORT`
- [ ] `MAX_BODY_BYTES`
- [ ] `MAX_REQUESTS_PER_MINUTE`
- [ ] `SCHEMETA_AUTH_TOKEN` (if hosted deployment requires auth)
- [ ] `CORS_ORIGIN`
- [ ] Rate limiting behavior manually validated.
- [ ] Health endpoint checked in target environment.