Skip to content

fix(security): verify Meta webhook HMAC signature (Batch B) - #6

Merged
sathyaprakash000 merged 1 commit into
mainfrom
fix/webhook-hmac
May 25, 2026
Merged

fix(security): verify Meta webhook HMAC signature (Batch B)#6
sathyaprakash000 merged 1 commit into
mainfrom
fix/webhook-hmac

Conversation

@sathyaprakash000

@sathyaprakash000 sathyaprakash000 commented May 25, 2026

Copy link
Copy Markdown
Contributor

Batch B — webhook authenticity (REVIEW.md P0 #2, lane 06 CRITICAL). The POST webhook accepted any forged JSON. Now verifies Meta's X-Hub-Signature-256 (HMAC-SHA256 over the raw body with META_APP_SECRET, timingSafeEqual) and rejects mismatches with 403; warns when unconfigured. Verify-token compares are now constant-time. Meta-direct topology per your choice.

…y-token

Batch B (Meta-direct). The webhook POST accepted any forged JSON. Now:
- Capture the raw request body (express.json verify hook) and verify
  X-Hub-Signature-256 (HMAC-SHA256 with META_APP_SECRET) using timingSafeEqual;
  reject with 403 on mismatch. When META_APP_SECRET is unset, log a warning
  (unverified) rather than breaking existing deployments.
- Make the GET verify-token comparisons constant-time (safeEqual) to remove the
  timing oracle.

Audit ref: REVIEW.md P0 #2 (lane 06 CRITICAL + HIGHs).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: KingArthur000 <sathyaprakashelango@gmail.com>
@sathyaprakash000
sathyaprakash000 merged commit 6c3ef75 into main May 25, 2026
9 checks passed
@sathyaprakash000
sathyaprakash000 deleted the fix/webhook-hmac branch May 25, 2026 03:18
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