Skip to content

🔒 security: enforce Twilio webhook signature validation#2

Merged
warengonzaga merged 4 commits into
mainfrom
claude/codebase-review-xIAcO
Apr 14, 2026
Merged

🔒 security: enforce Twilio webhook signature validation#2
warengonzaga merged 4 commits into
mainfrom
claude/codebase-review-xIAcO

Conversation

@warengonzaga

@warengonzaga warengonzaga commented Apr 14, 2026

Copy link
Copy Markdown
Member

Security fixes

Twilio webhook signature validation

Wire up the existing validateTwilioSignature() helper as express middleware on the Twilio webhook router. Every incoming request is now verified against the X-Twilio-Signature header before any message processing occurs, preventing forged webhook calls.

Requires a new TWILIO_WEBHOOK_URL env var (the full public-facing URL Twilio posts to), documented in .env.example.

Also centralizes the repeated <Response></Response> TwiML string into a shared sendEmptyTwiML(res, status?) helper.

Dependency security overrides

Added overrides in package.json to force safe versions of vulnerable transitive dependencies (bun audit confirmed 5 vulnerabilities resolved):

Package Was Now Severity
axios (via twilio) 1.13.5 1.15.0 2× Critical
path-to-regexp (via express/router) 8.3.0 8.4.2 1× High, 1× Moderate
follow-redirects (via axios) 1.15.11 1.16.0 1× Moderate

GitHub Actions updates

  • wgtechlabs/container-build-flow-action v1.3.1 → v1.7.1
  • wgtechlabs/release-build-flow-action v1.6.0 → v1.7.0

https://claude.ai/code/session_01KnaWLH6KQiPH5yzDK5hbX7

claude added 2 commits April 14, 2026 20:15
Wire up the existing validateTwilioSignature() helper as express
middleware on the Twilio webhook router. Every incoming request is now
verified against the X-Twilio-Signature header before any message
processing occurs, preventing forged webhook calls.

Requires a new TWILIO_WEBHOOK_URL env var (the full public-facing URL
Twilio posts to), documented in .env.example.

https://claude.ai/code/session_01KnaWLH6KQiPH5yzDK5hbX7
Add package overrides to force safe versions of three vulnerable
transitive dependencies:

- axios ^1.15.0 (was 1.13.5 via twilio) — fixes critical SSRF via
  NO_PROXY bypass and cloud metadata exfiltration via header injection
- follow-redirects ^1.16.0 (was 1.15.11 via axios) — fixes moderate
  auth header leakage on cross-domain redirects
- path-to-regexp ^8.4.0 (was 8.3.0 via express/router) — fixes high
  ReDoS via sequential optional groups and multiple wildcards

All 5 vulnerabilities confirmed resolved via bun audit.

https://claude.ai/code/session_01KnaWLH6KQiPH5yzDK5hbX7
Copilot AI review requested due to automatic review settings April 14, 2026 20:18
- wgtechlabs/container-build-flow-action v1.3.1 → v1.7.1
- wgtechlabs/release-build-flow-action v1.6.0 → v1.7.0

https://claude.ai/code/session_01KnaWLH6KQiPH5yzDK5hbX7

Copilot AI 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.

Pull request overview

This PR enforces Twilio webhook authenticity by validating the X-Twilio-Signature header via the existing validateTwilioSignature() helper before processing inbound WhatsApp messages.

Changes:

  • Add Express middleware on the Twilio webhook router to reject requests with missing/invalid X-Twilio-Signature.
  • Introduce required TWILIO_WEBHOOK_URL config/env var used during signature verification.
  • Update dependency versions and add package.json overrides (axios/follow-redirects/path-to-regexp).

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/routes/twilio-webhook.ts Adds signature-validation middleware ahead of webhook processing.
src/config.ts Adds required twilio.webhookUrl sourced from TWILIO_WEBHOOK_URL.
package.json Bumps core deps/devDeps and adds overrides affecting transitive deps.
bun.lock Lockfile updates reflecting dependency bumps/overrides.
.env.example Documents TWILIO_WEBHOOK_URL for signature validation.

Comment thread package.json
Comment thread src/routes/twilio-webhook.ts
@github-actions

github-actions Bot commented Apr 14, 2026

Copy link
Copy Markdown

🔥 Container Build Complete - Patch Build

Build Status: ✅ Success
Flow Type: patch
Description: Hotfix for production


📦 Pull Image

Docker Hub: docker pull wgtechlabs/unthread-whatsapp-bot:patch-61be7ed
GHCR: docker pull ghcr.io/wgtechlabs/unthread-whatsapp-bot:patch-61be7ed

📋 Build Details

Property Value
Flow Type patch
Commit 46674ad
Registry Docker Hub + GHCR

🏷️ Image Tags

wgtechlabs/unthread-whatsapp-bot:patch-61be7ed
ghcr.io/wgtechlabs/unthread-whatsapp-bot:patch-61be7ed


🔍 Testing Your Changes

  1. Pull the image using one of the commands above
  2. Run the container with your test configuration
  3. Verify the changes work as expected
  4. Report any issues in this PR

🚀 Quick Start

# Pull and run the container
Docker Hub: docker pull wgtechlabs/unthread-whatsapp-bot:patch-61be7ed
docker run <your-options> <image>


🔒 Security Scan Results

📋 Pre-Build Security Checks

Source Code Scan: 0 vulnerabilities found
Dockerfile Scan: 0 misconfigurations found

🐳 Container Image Vulnerabilities

Severity Count
Total 0

📊 Detailed Security Reports

View detailed vulnerability reports in the GitHub Security tab.


🤖 Powered by Container Build Flow Action vv1.7.1
💻 with ❤️ by Waren Gonzaga under WG Technology Labs, and Him 🙏

Replace four inline res...send('<Response></Response>') calls with a
shared sendEmptyTwiML(res, status?) helper to avoid drift and make
future response changes easier.

https://claude.ai/code/session_01KnaWLH6KQiPH5yzDK5hbX7
@warengonzaga warengonzaga merged commit a84a058 into main Apr 14, 2026
2 checks passed
@warengonzaga warengonzaga deleted the claude/codebase-review-xIAcO branch April 14, 2026 20:29
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.

3 participants