Repository navigation
fix(service): the webhook route refuses an unsigned or oversized delivery before it reads the body, and a rate limit guards it - #2553
Conversation
…very before it reads the body The route checked the X-Hub-Signature-256 header only after it read the body. The check of the signature header, and the check of a declared length above the size cap, now run in _refuse_before_reading with the other checks of the headers. Each refusal counts under the outcome rejected. Refs #2476
The Middleware devops/roadmap-service-rate-limit lets 60 requests a minute through, with a burst of 60, in one bucket for the host. Both copies of the Ingress devops/roadmap-service name it, and the native devops stack applies it before the Ingress. Refs #2476
The rule group roadmap-service-webhooks, apart from roadmap-service, holds RoadmapServiceWebhooksRejected: more than 20 deliveries rejected in 15 minutes, with a label set that starts in the window counted from zero. k8s/README.md says how to check the hooks and that each hook sends the Issues event only. Refs #2476
|
Fail-to-pass:
The pinned promtool 3.15.0 ran the unit tests of both groups locally. One part of the premise did not hold: the route already refused a Evidence for the limit (2026-10-28): in 2 days the Service counted at most 36 |
|
Fail-to-pass check run of CI: https://github.com/dan-petty/devops-cli/actions/runs/40776584565/job/123127352384 (success). All checks pass on 49c0ef6. The three code-scanning checks waited because GitHub did not process the first SARIF upload, so the Static Analysis job ran again, and its new upload completed them. |
…rate limit The subsection Webhook route of k8s/README.md counted the answers of the route with traefik_service_requests_total. Traefik counts that series only around its proxy to the pods, after the middlewares of the router, so a request that the rate limit refuses with 429 did not count there. The query now reads traefik_router_requests_total, which Traefik counts before the middlewares of the router (Traefik v3.7.13, pkg/server/router/router.go and pkg/server/service/service.go). The folder tree of k8s/README.md now lists middleware.yaml of k8s/devops/roadmap-service/. Two tests in tests/test_k8s_roadmap_service.py pin the tree and the query. The comment of the rule group roadmap-service-webhooks now says that the scrape reads the deliveries counter each minute, so the 15-minute window reads only a new label set as new. A promtool case pins that a label set that is quiet for 40 minutes and then rejects one delivery does not fire the alert. Refs #2476
|
Review fixes on 6efa4eb. All checks pass. Fail-to-pass check run: https://github.com/dan-petty/devops-cli/actions/runs/40782083997/job/123146067808 (success). An earlier run on the same commit was cancelled when the body edit started this run.
The change folder was opened again for these fixes and archived again in the last commit. The push was a fast-forward, so the branch history holds the old archive commit and its revert. |
🤖 I have created a release *beep* *boop* --- ## [0.12.0](v0.11.3...v0.12.0) (2026-10-29) ### Features * **ai:** constrain structured replies on the openai and claude providers ([#2550](#2550)) ([4f7390a](4f7390a)) * **argo:** retire the Helm release records of the charts that Argo CD renders ([#2568](#2568)) ([cabfcd4](cabfcd4)) * **k8s:** devops k8s tunnel keeps the cloudflared forward to k8s.<domain> running ([#2567](#2567)) ([f9493fa](f9493fa)), closes [#1641](#1641) * **monitoring:** alert when the otel collector fails to export spans, metric points or log records ([#2565](#2565)) ([4fc8ff7](4fc8ff7)) * **telemetry:** the roadmap Service counts its GitHub writes, budget holds, Firecrawl searches and own deliveries, and caps refine's comments on one item ([#2556](#2556)) ([9819877](9819877)), closes [#2475](#2475) ### Bug Fixes * **git:** report a worktree that a run in parallel removed as removed, not a failed reclaim ([#2557](#2557)) ([a556984](a556984)), closes [#2408](#2408) * **k8s:** the devops perimeter opens only the collector's OTLP/HTTP port, 4318 ([#2549](#2549)) ([d156ce7](d156ce7)) * **sandbox:** devops sandbox logs reads each line with its stream from a real engine ([#2546](#2546)) ([e7216d5](e7216d5)), closes [#2520](#2520) * **service:** the webhook route refuses an unsigned or oversized delivery before it reads the body, and a rate limit guards it ([#2553](#2553)) ([40efcd4](40efcd4)), closes [#2476](#2476) ### Performance Improvements * **ai:** price a request with one load of the settings ([#2555](#2555)) ([5d86538](5d86538)), closes [#1420](#1420) ### Code Refactoring * **config:** a default that backs a settings field is read only through the settings ([#2561](#2561)) ([0702d13](0702d13)) * **exceptions:** each exception class declares its error_code and exit_code ([#2558](#2558)) ([410dece](410dece)) * **review:** render the review report from one input, outside the orchestrator ([#2563](#2563)) ([9e73e6d](9e73e6d)), closes [#1008](#1008) * **security:** src has no unreviewed Bandit findings, and the gate scans src at low severity ([#2560](#2560)) ([45261dd](45261dd)), closes [#1538](#1538) * **security:** the scanners stop looking for mocks, and their tests run on the scanner fake ([#2551](#2551)) ([2b7f37a](2b7f37a)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
The webhook route of the roadmap Service read the body of a delivery before it checked that the delivery had a signature header. Nothing limited the requests to the route, and no alert showed a burst of refused deliveries.
X-Hub-Signature-256header, or an empty one, with 401missing signaturebefore it reads the body. The check of a declaredContent-Lengthabove 25 MiB (413) moves to the same function,_refuse_before_reading. That check already ran before the read, so its behavior does not change. Each refusal counts under the outcomerejected.devops/roadmap-service-rate-limit(k8s/devops/roadmap-service/middleware.yaml) lets 60 requests a minute through, with a burst of 60, in one bucket for the host. Both copies of the Ingressdevops/roadmap-servicename it, and the nativedevopsstack applies it before the Ingress.roadmap-service-webhooks, separate fromroadmap-service, holds the warning alertRoadmapServiceWebhooksRejected: more than 20 rejected deliveries in 15 minutes. A label set that starts in the window counts from zero (fix(monitoring): the roadmap Service alerts count the first value of a new series and see a lane of a new pod #2505).k8s/README.md, Roadmap service: step 8 says how to check the hooks (uv run devops gh api repos/<owner>/<name>/hooks) and that each hook sends the Issues event only. The new subsection Webhook route gives the rate limit, the refusals, and a query oftraefik_router_requests_totalthat counts each answer of the route, the 429 of the rate limit included. Traefik countstraefik_service_requests_totalonly for the requests that get to the Service, so that series does not show a 429 of the rate limit. The folder tree listsmiddleware.yaml.devopsgets no command that changes a hook.Closes #2476