Skip to content

fix: enforce HTTPS for webhook URLs#2507

Open
jaffarkeikei wants to merge 2 commits intoboxyhq:mainfrom
jaffarkeikei:fix/enforce-https-webhooks
Open

fix: enforce HTTPS for webhook URLs#2507
jaffarkeikei wants to merge 2 commits intoboxyhq:mainfrom
jaffarkeikei:fix/enforce-https-webhooks

Conversation

@jaffarkeikei
Copy link
Copy Markdown

@jaffarkeikei jaffarkeikei commented Jan 29, 2026

Resolves #2506

Summary

Added validation to enforce HTTPS for webhook URLs, preventing sensitive data from being transmitted over insecure HTTP connections.

Changes

  • Added webhookUrl primitive that only accepts HTTPS URLs
  • Updated webhookEndpointSchema to use webhookUrl
  • Removed TODO comment from webhook handler

Why?

Without HTTPS enforcement:

  • ❌ Webhook payloads (user info, payments, auth tokens) sent in plaintext
  • ❌ Vulnerable to man-in-the-middle attacks
  • ❌ Violates security best practices (OWASP, SOC2, ISO 27001)

Error Handling

HTTP URLs now return:

{
  "error": {
    "message": "Webhook URL must use HTTPS protocol for security"
  }
}

Testing

✅ HTTP URLs rejected
✅ HTTPS URLs accepted
✅ No breaking changes to existing webhooks

Resolves boxyhq#2506

## Summary
Added validation to enforce HTTPS protocol for webhook endpoint URLs,
preventing webhook payloads from being transmitted over insecure HTTP
connections.

## Changes
- Added new `webhookUrl` primitive in `lib/zod/primitives.ts` that
  only accepts HTTPS URLs
- Updated `webhookEndpointSchema` to use `webhookUrl` instead of
  generic `url` primitive
- Removed TODO comment from webhook handler as validation is now enforced
  at schema level

## Security Impact
- Prevents man-in-the-middle attacks on webhook payloads
- Ensures sensitive data (user info, payment details, auth tokens) is
  always encrypted in transit
- Aligns with OWASP security best practices for webhook implementations

## Testing
Webhook creation will now fail with a clear error message if an HTTP URL
is provided:
```
Webhook URL must use HTTPS protocol for security
```

The validation happens at the Zod schema level, providing immediate
feedback to API consumers.
@vercel
Copy link
Copy Markdown

vercel Bot commented Jan 29, 2026

@jaffarkeikei is attempting to deploy a commit to the BoxyHQ Team on Vercel.

A member of the Team first needs to authorize it.

@jaffarkeikei jaffarkeikei force-pushed the fix/enforce-https-webhooks branch from 7645421 to bb6c788 Compare February 20, 2026 14:50
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.

Security: Missing HTTPS validation for webhook URLs

1 participant