internal/middleware has two tests, both on security headers: TestSecurityHeaders and TestSecurityHeaders_PreservesExistingHeaders.
Untested:
MetricsAuth (middleware.go:135-144) — the basic-auth gate on /metrics. This is an access control check with no test. Metrics can leak upstream hostnames, traffic volumes, and cache behavior; if this gate regresses, nothing catches it.
CORS (middleware.go:114) — currently hardcoded to []string{"*"}. Becomes configurable via the access_control_allow_origin work; that change should land on top of a test that pins current behavior first.
Logging (middleware.go:82-109) — including that it does not log secrets. Worth an explicit assertion that the signing key never appears in a log line, given it can arrive as a form value on POST /.
Metrics (middleware.go:124-132).
Definition of done
MetricsAuth tests: no credentials returns 401 with a WWW-Authenticate challenge; wrong credentials returns 401; correct credentials passes through. Also assert the comparison is constant-time if it is not already (and make it so if not — a timing-attackable metrics password is a small but free win).
CORS tests pinning the current * behavior, written so they extend naturally when the config key lands.
A logging test asserting that a POST / body containing the signing key does not put that value into the log output.
A test that the metrics recorder middleware is installed when expected — see the separate issue about metrics only being collected when credentials are configured.
New tests only. make check green.
Verified against `main` at `61f42e6`.
`internal/middleware` has two tests, both on security headers: `TestSecurityHeaders` and `TestSecurityHeaders_PreservesExistingHeaders`.
Untested:
- **`MetricsAuth` (`middleware.go:135-144`)** — the basic-auth gate on `/metrics`. This is an access control check with no test. Metrics can leak upstream hostnames, traffic volumes, and cache behavior; if this gate regresses, nothing catches it.
- **`CORS` (`middleware.go:114`)** — currently hardcoded to `[]string{"*"}`. Becomes configurable via the `access_control_allow_origin` work; that change should land on top of a test that pins current behavior first.
- **`Logging` (`middleware.go:82-109`)** — including that it does not log secrets. Worth an explicit assertion that the signing key never appears in a log line, given it can arrive as a form value on `POST /`.
- **`Metrics` (`middleware.go:124-132`)**.
## Definition of done
1. `MetricsAuth` tests: no credentials returns 401 with a `WWW-Authenticate` challenge; wrong credentials returns 401; correct credentials passes through. Also assert the comparison is constant-time if it is not already (and make it so if not — a timing-attackable metrics password is a small but free win).
2. CORS tests pinning the current `*` behavior, written so they extend naturally when the config key lands.
3. A logging test asserting that a `POST /` body containing the signing key does not put that value into the log output.
4. A test that the metrics recorder middleware is installed when expected — see the separate issue about metrics only being collected when credentials are configured.
5. New tests only. `make check` green.
clawbot
added this to the 1.0.0 milestone 2026-08-09 03:48:37 +02:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Verified against
mainat61f42e6.internal/middlewarehas two tests, both on security headers:TestSecurityHeadersandTestSecurityHeaders_PreservesExistingHeaders.Untested:
MetricsAuth(middleware.go:135-144) — the basic-auth gate on/metrics. This is an access control check with no test. Metrics can leak upstream hostnames, traffic volumes, and cache behavior; if this gate regresses, nothing catches it.CORS(middleware.go:114) — currently hardcoded to[]string{"*"}. Becomes configurable via theaccess_control_allow_originwork; that change should land on top of a test that pins current behavior first.Logging(middleware.go:82-109) — including that it does not log secrets. Worth an explicit assertion that the signing key never appears in a log line, given it can arrive as a form value onPOST /.Metrics(middleware.go:124-132).Definition of done
MetricsAuthtests: no credentials returns 401 with aWWW-Authenticatechallenge; wrong credentials returns 401; correct credentials passes through. Also assert the comparison is constant-time if it is not already (and make it so if not — a timing-attackable metrics password is a small but free win).*behavior, written so they extend naturally when the config key lands.POST /body containing the signing key does not put that value into the log output.make checkgreen.