server: limit wildcard CORS to the public routes (closes #100)
check / check (push) Successful in 1m13s
check / check (push) Successful in 1m13s
The CORS wildcard was global, so it also covered the Basic-Auth protected /metrics, which REPO_POLICIES.md forbids, and it allowed POST, PUT and DELETE, which no route serves, plus the Authorization and X-CSRF-Token headers. CORS now sits on a router holding only the public routes and allows GET and OPTIONS with the Accept and Content-Type headers. /metrics gets no CORS at all. Both are mounted routers rather than a Group: chi answers OPTIONS on a Group's route with 405 before its middleware runs, and any method /metrics does not register would otherwise fall through to the public router. So every method on /metrics now meets Basic Auth first, and /metrics/ is served like /metrics. Model: opus-5-5
This commit was merged in pull request #172.
This commit is contained in:
@@ -19,6 +19,8 @@ Rationale, Design, TODO, License, Author) if any are still missing.
|
||||
|
||||
# Completed Steps
|
||||
|
||||
- 2026-10-01: wildcard CORS now applies only to the public routes, not to
|
||||
`/metrics`, and allows only the methods they serve (closes #100).
|
||||
- 2026-10-01: `internal/state` and `internal/watcher` no longer export test-only
|
||||
constructors: two moved to `export_test.go`, one is deleted (closes #111).
|
||||
- 2026-10-01: notify shutdown tests use one timing constant per meaning, name
|
||||
|
||||
Reference in New Issue
Block a user