Rate limit password attempts on /metrics (closes #104)
check / check (push) Successful in 3m26s

Each client address may make 60 requests to /metrics a minute,
through the same httprate middleware and TRUSTED_PROXIES
resolution the report route uses, with an allowance of its own.
The limit runs before the basic auth, so past it the answer is 429
and the password is not checked. backend/README.md says so; a test
uses up one client's allowance on wrong passwords, gets 429 with
the right one, and checks that another client behind the same
nginx still gets in.

Model: opus-5-5
This commit is contained in:
2026-10-04 04:01:37 +00:00
parent dc2d240725
commit 5f39597eae
5 changed files with 77 additions and 4 deletions
+4
View File
@@ -12,6 +12,10 @@ func (s *Server) Router() *chi.Mux {
// external tests.
const MaxRequestBodyBytes = maxRequestBodyBytes
// MetricsRequestsPerMinute exposes the /metrics rate limit to the
// external tests.
const MetricsRequestsPerMinute = metricsRequestsPerMinute
// ListenAddr exposes the address the server listens on to the
// external tests.
func (s *Server) ListenAddr() string {