Commit 95d207b
committed
security: harden backend (CORS, trustProxy, rate-limit, upload validation, nosniff)
- Fix refresh-token invalidation bug: invalid tokens no longer wipe
all sessions globally (auth.ts)
- Replace wildcard CORS with config-driven origin allowlist.
Default: no CORS headers. Configurable via allowedOrigins in
backend-config.json or ALLOWED_ORIGINS env var (comma-separated)
- Add trustProxy config flag (default false). x-forwarded-*
headers are now ignored unless explicitly opted in
- Add in-memory brute-force rate limiting for login and groupLogin:
7 failed attempts → 15-minute block (HTTP 429)
- Validate image uploads by magic bytes (PNG/JPEG/WEBP), not just
file extension
- Add X-Content-Type-Options: nosniff to all static file responses
Signed-off-by: Mike Lischke <mike@lischke-online.de>1 parent fdfd0a0 commit 95d207b
2 files changed
Lines changed: 253 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
266 | | - | |
267 | | - | |
268 | 266 | | |
269 | 267 | | |
270 | 268 | | |
| |||
0 commit comments