fix(webhook): fail-closed on missing secret; refresh CLAUDE.md module map #102
No reviewers
Labels
No labels
area:agents
area:dashboard
area:database
area:design
area:design-review
area:flows
area:infra
area:meta
area:security
area:sessions
area:webhook
area:workdir
security
type:bug
type:chore
type:meta
type:user-story
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
charles/claude-hooks!102
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/webhook-fail-closed"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Audit finding:
src/webhook.tswas silently fail-open when the webhook secret was missing.loadWebhookConfigswallows the secret-file read error (logs a warning, continues withsecret=""), andverifySignaturereturnedtrueon empty secret — so every unsigned payload was accepted without verification. The warning scrolls past in startup logs and then disappears.Also rolling in the CLAUDE.md module-map refresh since it's a one-file doc change and belongs in the same cleanup pass.
Changes
src/webhook.ts—verifySignaturenow returnsfalsewhen the secret is empty, with a[webhook] rejecting payload — no secret configuredwarning on each rejection so the operator sees the misconfig as loud 403s instead of silent acceptance.src/webhook.test.ts— point the test config at a real secret file and sign everymakeRequestbody. Added three tests:x-forgejo-signatureheader rejected (403)CLAUDE.md— drop the "Single-file service — everything insrc/main.ts" claim (dead since the refactor). Added a Modules table documenting the 16 production files and their responsibilities.Test plan
just qa— 276 pass, 0 failwebhook.test.tstests continue to pass with signingOut of scope
loadWebhookConfigthrow on missing secret file (would break local dev without a secret — current degrade-and-warn behaviour preserved)🤖 Generated with Claude Code
claude-desktop referenced this pull request2026-04-19 20:38:39 +00:00