Repository navigation
feat(api): warn at startup when webhook or Slack secrets are unset - #177
Merged
OkiriGabriel merged 1 commit intoNov 21, 2026
Conversation
With WEBHOOK_SECRET unset, /webhook/* requests are accepted without signature or token verification, and with SLACK_SIGNING_SECRET unset, /slack/action is accepted without signature verification. Nothing in the logs showed that, so a production misconfiguration was silent. Log a warning in lifespan for each missing secret, next to the existing API_AUTH_DISABLED warning. Request handling is unchanged. Document the warning in SECURITY_GUARANTEES.md and add tests for each combination of set/unset secrets and for lifespan calling the check. Part of open-devops-agent#64
OkiriGabriel
approved these changes
Nov 21, 2026
OkiriGabriel
left a comment
Collaborator
There was a problem hiding this comment.
Thanks @OpeyemiAdeniji, a clean, non-breaking step 1: one warning per missing secret, empty counts as unset (matching the getters), and test_lifespan_calls_the_check proves it's actually wired into startup. The SECURITY_GUARANTEES sentence is accurate. Approving.
OkiriGabriel
approved these changes
Nov 21, 2026
OkiriGabriel
left a comment
Collaborator
There was a problem hiding this comment.
Thank you for working on this
This was referenced Nov 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Step 1 of the plan in #64 (comment) (non-breaking).
When
WEBHOOK_SECRETis unset,/webhook/*requests are accepted without signature or token verification; whenSLACK_SIGNING_SECRETis unset,/slack/actionis accepted without signature verification. Nothing in the logs showed this, so a production misconfiguration was silent.This adds
_warn_missing_webhook_secrets()inapi/server.py, called inlifespanright after the existingAPI_AUTH_DISABLEDwarning. It logs one warning per missing secret:WEBHOOK_SECRET is not set: /webhook/* requests are accepted without signature or token verificationSLACK_SIGNING_SECRET is not set: /slack/action requests are accepted without signature verificationRequest handling is unchanged: nothing is rejected that was accepted before. An empty value counts as unset, matching how
get_webhook_secret()/get_slack_signing_secret()are already checked.SECURITY_GUARANTEES.mdgets one sentence documenting the warning next to the existing "accepts requests when the secret is unset" text.Part of #64 (does not close it: test alignment and the fail-closed decision are still open there)
Type of Change
Platform/Component
Testing
Unit tests added/updated
Integration tests pass
Manual testing performed
Tested with dummy data
Tested in production-like environment
New
tests/test_startup_warnings.py(6 tests, usingstructlog.testing.capture_logs): both secrets unset → two warnings; both set → none; each one unset on its own → only that warning; an emptyWEBHOOK_SECRETcounts as unset; and enteringlifespancalls the check (background-worker lock and legacy-review adoption patched out, so no queue worker starts).Related suites locally:
tests/test_startup_warnings.py,test_api.py,test_webhook_auth.py,test_security_middleware.py,test_api_auth.py, plustest_security.pyandtest_services.py(the other tests that enterlifespan): all pass.Full suite locally (Windows): 1068 passed, 30 skipped, 1 failed. The failure is
tests/test_nginx_bamboo.py::TestNginxTools::test_write_file_command_prevents_shell_expansion, which shells out topython3(not on my Windows PATH), the same unrelated failure noted in test(ci): assert status codes and response shape for /webhook/manual in integration job #107; it runs on Linux in CI.Blocking Flake8 check (
E9,F63,F7,F82) is clean on the changed files.CI result on this PR: all checks pass, including the three Test Agent jobs (3.10/3.11/3.12) and the Integration Test job; only
deployis skipped. The Test Agent log shows all 6test_startup_warnings.pytests running and passing.Test Configuration
Checklist
Screenshots (if applicable)
N/A
Breaking Changes
None. Deployments without the secrets will see two new warnings at startup; behavior is otherwise identical.
Additional Notes
WEBHOOK_SECRET, so its server log will now show the warning. That is expected; step 2 on [SECURITY] Fail-closed webhook defaults and rate limiting for credential endpoints #64 would have CI sign its requests.api/server.py#L...line anchors inSECURITY_GUARANTEES.mdalready point at the wrong lines onmain(e.g.#L264is no longer the webhook gate). I left them alone to keep this PR small; the new link I added points at the right line. Happy to fix the rest in a separate docs PR.Reviewer Checklist