feat(webhook): per-forge ingress + signature verification (MF-3) #305

Merged
code-lead merged 2 commits from boss/294 into main 2026-04-24 09:11:04 +00:00
Collaborator

Adds three new HTTP routes (/webhooks/forgejo, /webhooks/github, /webhooks/gitlab) plus a /webhooks alias for back-compat, each applying its forge's signature scheme and normalising the payload to a forge-neutral ForgeEvent discriminated union exported from @claude-hooks/shared. The Forgejo dispatch switch is unchanged; the normaliser scaffolds the shape MF-1 / MF-2 will dispatch on.

Closes #294

Test plan

  • bun test apps/server — 1128/1128 pass (added 29 new tests)
  • bun x turbo run typecheck lint — clean
  • Operator: configure github_webhook_secret_file / gitlab_webhook_secret_file in agents.json, point a GitHub or GitLab webhook at the matching route, confirm 204 on a known event and 403 on a bad signature
  • Confirm legacy /webhook/forgejo still works (route preserved verbatim)
Adds three new HTTP routes (`/webhooks/forgejo`, `/webhooks/github`, `/webhooks/gitlab`) plus a `/webhooks` alias for back-compat, each applying its forge's signature scheme and normalising the payload to a forge-neutral `ForgeEvent` discriminated union exported from `@claude-hooks/shared`. The Forgejo dispatch switch is unchanged; the normaliser scaffolds the shape MF-1 / MF-2 will dispatch on. Closes #294 ## Test plan - [x] `bun test apps/server` — 1128/1128 pass (added 29 new tests) - [x] `bun x turbo run typecheck lint` — clean - [ ] Operator: configure `github_webhook_secret_file` / `gitlab_webhook_secret_file` in `agents.json`, point a GitHub or GitLab webhook at the matching route, confirm 204 on a known event and 403 on a bad signature - [ ] Confirm legacy `/webhook/forgejo` still works (route preserved verbatim)
feat(webhook): per-forge ingress + signature verification (MF-3)
All checks were successful
qa / qa (pull_request) Successful in 4m13s
qa / dockerfile (pull_request) Successful in 6s
d7e342f7ec
Adds /webhooks/forgejo, /webhooks/github, /webhooks/gitlab routes (plus
legacy /webhooks alias for Forgejo). Each route applies its forge's
verification scheme — HMAC-SHA256 for Forgejo + GitHub, plaintext token
equality for GitLab — then runs the body through a per-forge normaliser
that returns a forge-neutral ForgeEvent discriminated union exported from
@claude-hooks/shared. The Forgejo dispatch switch is unchanged; the
normaliser exists so MF-1 (GitHub adapter) and MF-2 (GitLab adapter) can
plug into a stable shape.

Closes #294

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
fix(webhook): address review for per-forge ingress (#305 follow-up)
All checks were successful
qa / qa (pull_request) Successful in 3m37s
qa / dockerfile (pull_request) Successful in 7s
3f142ad006
- Preserve pre-MF-3 Forgejo route behaviour: unknown events fall through
  to the existing 200 OK path instead of returning 204. The legacy
  /webhooks alias must match current behaviour exactly; 204-on-unknown
  stays scoped to the new /webhooks/github and /webhooks/gitlab routes.
- Add unknown-repo 404 tests for /webhooks/github and /webhooks/gitlab
  so the multi-repo gate (parity with the Forgejo M17-1 contract) is
  covered by the spec alongside sig-fail → 403 and unknown-event → 204.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
charles force-pushed boss/294 from 3f142ad006
All checks were successful
qa / qa (pull_request) Successful in 3m37s
qa / dockerfile (pull_request) Successful in 7s
to a1263c41d4
All checks were successful
qa / qa (pull_request) Successful in 4m12s
qa / dockerfile (pull_request) Successful in 7s
2026-04-24 08:50:01 +00:00
Compare
code-lead deleted branch boss/294 2026-04-24 09:11:04 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/claude-hooks!305
No description provided.