Skip to content

fix(vcs): verify the GitHub webhook signature before fanning the event out - #14771

Merged
ArnabChatterjee20k merged 1 commit into
mainfrom
security/vcs-fanout-after-verify
Oct 23, 2026
Merged

ArnabChatterjee20k merged 1 commit into
mainfrom
security/vcs-fanout-after-verify

Conversation

@ArnabChatterjee20k

Copy link
Copy Markdown
Member

What

preprocessEvent() ran before the x-hub-signature-256 HMAC check in the GitHub webhook action. The base hook is a no-op, but Cloud overrides it to fan the event out to every region — so an unauthenticated POST /v1/vcs/github/events triggered N cross-region HTTPS forwards (coroutine batch, 20s timeout, up to 5 redirects) and relayed arbitrary caller headers between regions, all before any signature validation. Receivers re-verify, so this is an unauthenticated amplification / header-relay vector, not an auth bypass.

Moves the preprocessEvent() call to after the signature-valid check, so only validly-signed deliveries are fanned out. The base preprocessEvent is a no-op, so only Cloud's fan-out timing changes.

Tracked in appwrite-labs/cloud#6767.

🤖 Generated with Claude Code

…t out

preprocessEvent() ran before the x-hub-signature-256 HMAC check. The base hook is
a no-op, but Cloud overrides it to fan the event out to every region, so an
unauthenticated POST triggered N cross-region forwards (and relayed arbitrary
caller headers) before any signature validation. Move the call to after the
signature-valid check so only validly-signed deliveries are preprocessed.

Refs appwrite-labs/cloud#6767

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@luxor-code-review

luxor-code-review Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Review complete. No issues found — approved ✅.


The change reorders the GitHub webhook event handler so that the x-hub-signature-256 HMAC verification runs before preprocessEvent, ensuring that on Cloud the cross-region forwarding side effect only executes for requests that pass signature validation. The move preserves the existing event routing and payload parsing; verification found no correctness or security regressions introduced by the reorder, and all candidate concerns were adjudicated as pre-existing mechanisms untouched by this diff.

Files Change
src/Appwrite/Platform/Modules/VCS/Http/GitHub/Events/Create.php Moved preprocessEvent call after signature verification to gate fan-out on authenticated payloads.

Reviewed commit: aa64cf3

@ghost

ghost commented Oct 22, 2026 •

Copy link
Copy Markdown

🟢 Tier S · Ready to merge

The GitHub webhook action now verifies x-hub-signature-256 before invoking preprocessEvent(). This prevents invalidly signed deliveries from triggering Cloud’s cross-region fan-out while leaving event parsing and handling after preprocessing.

Verdict New comments Fixed Still open
✅ Approved 0 0 0
📂 Walkthrough · 1
File Change
src/Appwrite/Platform/Modules/VCS/Http/GitHub/Events/Create.php Moved webhook preprocessing to run only after signature validation succeeds.

Reviewed aa64cf3 · Details · Comment @hansi-codes review to re-run, or mention @hansi-codes with a question.

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Tier S · Looks good to merge. Summary

@github-actions

Copy link
Copy Markdown

Security rules

No new WARNING or ERROR findings from security rules.

6 existing findings tracked in .semgrep/baseline.json
  • php.appwrite.guest-write-without-abuse-limit (3)
  • php.appwrite.secret-compare-timing (1)
  • php.appwrite.weak-secret-env-default (2)

Posted by Checks / Rules. Re-runs update this comment in place. Rule details and baseline: .semgrep/README.md.

@github-actions

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → security/vcs-fanout-after-verify (after).

Metric Before After Change
🚀 Requests/sec 156.4 175.75 🟢 +12.4%
⏱️ Latency P50 112.67 ms 99.46 ms 🟢 -11.7%
⏱️ Latency P95 254.66 ms 233.09 ms 🟢 -8.5%
Per-scenario breakdown & investigation details

Metrics below reflect the current branch (after). Δ P95 compares against the base.

Scenario P50 (ms) P95 (ms) Requests RPS Δ P95 (ms)
API total 99.46 233.09 11,400 175.75 -21.57
Account 187.83 350.23 600 9.94 -17.3
TablesDB 96.82 186.03 6,200 98.29 -11.39
Storage 90.25 218.35 3,000 49.57 -21.66
Functions 131.24 268.26 1,600 27.13 -34.83

Top API waits (after)

API request Max wait (ms)
account.name.update 551.99
account.prefs.update 537.06
storage.files.create 527.42
storage.buckets.create 440.12
tablesdb.rows.decrement 407.63

@ArnabChatterjee20k
ArnabChatterjee20k merged commit 518749a into main Oct 23, 2026
38 checks passed
ChiragAgg5k pushed a commit that referenced this pull request Oct 24, 2026
Tapraj-Pathak pushed a commit to Tapraj-Pathak/appwrite that referenced this pull request Oct 24, 2026
…fter-verify

fix(vcs): verify the GitHub webhook signature before fanning the event out

(cherry picked from commit 518749a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant