CORS middleware, body size limits, audit roles cleanup — 2026-03-20
actix-cors into main.rs via config.build_cors().
Configured from CORS_ALLOWED_ORIGINS env var. Allows GET, POST, PATCH, DELETE, OPTIONS.
Permits headers: Authorization, Content-Type, X-Tenant-Id, X-Correlation-Id, X-Source-Service.
Empty origins = deny all cross-origin (secure default).
max_body_size via JsonConfig and PayloadConfig in main.rs.
Configurable via MAX_BODY_SIZE_BYTES env var (default: 1 MiB).
roles::AUDIT_ROLES from the centralized module instead of a local AUDIT_ROLES constant. Single source of truth for RBAC.
| File | Change | Delta |
|---|---|---|
Cargo.toml |
Added actix-cors dependency |
+1 |
Cargo.lock |
Resolved actix-cors + transitive deps | +16 |
src/config.rs |
build_cors() method + 2 unit tests |
+67 |
src/main.rs |
CORS wrap, JsonConfig + PayloadConfig limits | +7 |
src/api/audit.rs |
Use centralized roles::AUDIT_ROLES |
+2 / -3 |