You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[SECURITY] Fail-closed webhook defaults and rate limiting for credential endpoints #64
Hi @OkiriGabriel, #173 covered the rate limiting and IP allowlist parts of this. I'd like to pick up what's left, in small PRs like #18:
Startup warning (non-breaking). Log a warning at startup when WEBHOOK_SECRET or SLACK_SIGNING_SECRET is unset, the same way API_AUTH_DISABLED is already flagged in lifespan.
Fail closed (breaking). Reject webhook and Slack requests with 401/503 when no secret is configured, unless an explicit opt-out such as WEBHOOK_AUTH_DISABLED=true is set, mirroring API_AUTH_DISABLED.
Questions before step 3:
Are you OK with fail-closed by default plus an opt-out, or would you rather keep fail-open and only warn?
If it fails closed: reject per request (the server still starts, /health still works), or refuse to start?
Fail closed by default, with an explicit opt-out. With no WEBHOOK_SECRET / SLACK_SIGNING_SECRET, reject the request unless WEBHOOK_AUTH_DISABLED=true / SLACK_AUTH_DISABLED=true is set. Mirror API_AUTH_DISABLED: log a startup warning when an opt-out is active, and make sure a configured secret is always verified even if the opt-out is also set (the opt-out only applies while the secret is absent).
Reject per request, don't refuse to start. The server should still start so /health, /metrics and the queue worker keep working. Return 503 with a message naming the env var to set ("not configured"), and keep 401 for a configured secret with a missing or bad signature. That's the same split the management API uses (fix: require bearer tokens for org config, docs and audit API routes (#59) #127).
A few things to cover in that PR, since it's breaking:
docker-compose.yml: fail at docker compose up without the secret, e.g. WEBHOOK_SECRET=${WEBHOOK_SECRET:?set WEBHOOK_SECRET in .env}.
middleware/README.md: AGENT_WEBHOOK_SECRET becomes required (the middleware forwards signed requests).
Your step 2: the CI integration job should set WEBHOOK_SECRET and sign its requests (Alertmanager and Grafana can use Authorization: Bearer).
A "Breaking change" section in the PR and a line in .env.example.
Assigning this to you; go ahead with steps 2 and 3.
Activity
OpeyemiAdeniji commentedon Nov 21, 2026
Hi @OkiriGabriel, #173 covered the rate limiting and IP allowlist parts of this. I'd like to pick up what's left, in small PRs like #18:
WEBHOOK_SECRETorSLACK_SIGNING_SECRETis unset, the same wayAPI_AUTH_DISABLEDis already flagged inlifespan.tests/test_api.pysetWEBHOOK_SECRETand sign requests by default, keeping one explicit test for the no-secret path. Update the integration-test job inci.yml(test(ci): assert status codes and response shape for /webhook/manual in integration job #107/test(ci): assert status codes and response shape for the remaining /webhook/* routes #176) to sign its requests too.WEBHOOK_AUTH_DISABLED=trueis set, mirroringAPI_AUTH_DISABLED.Questions before step 3:
/healthstill works), or refuse to start?feat(api): warn at startup when webhook or Slack secrets are unset
OkiriGabriel commentedon Nov 21, 2026
Thanks @OpeyemiAdeniji, and thanks for #176 and #177. Answers for step 3:
WEBHOOK_SECRET/SLACK_SIGNING_SECRET, reject the request unlessWEBHOOK_AUTH_DISABLED=true/SLACK_AUTH_DISABLED=trueis set. MirrorAPI_AUTH_DISABLED: log a startup warning when an opt-out is active, and make sure a configured secret is always verified even if the opt-out is also set (the opt-out only applies while the secret is absent)./health,/metricsand the queue worker keep working. Return 503 with a message naming the env var to set ("not configured"), and keep 401 for a configured secret with a missing or bad signature. That's the same split the management API uses (fix: require bearer tokens for org config, docs and audit API routes (#59) #127).A few things to cover in that PR, since it's breaking:
docker-compose.yml: fail atdocker compose upwithout the secret, e.g.WEBHOOK_SECRET=${WEBHOOK_SECRET:?set WEBHOOK_SECRET in .env}.middleware/README.md:AGENT_WEBHOOK_SECRETbecomes required (the middleware forwards signed requests).WEBHOOK_SECRETand sign its requests (Alertmanager and Grafana can useAuthorization: Bearer)..env.example.Assigning this to you; go ahead with steps 2 and 3.
test: sign webhook requests in test_api.py and the CI integration job (…