fix: enforce HTTPS for webhook URLs#2507
Open
jaffarkeikei wants to merge 2 commits intoboxyhq:mainfrom
Open
Conversation
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.
|
@jaffarkeikei is attempting to deploy a commit to the BoxyHQ Team on Vercel. A member of the Team first needs to authorize it. |
7645421 to
bb6c788
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #2506
Summary
Added validation to enforce HTTPS for webhook URLs, preventing sensitive data from being transmitted over insecure HTTP connections.
Changes
webhookUrlprimitive that only accepts HTTPS URLswebhookEndpointSchemato usewebhookUrlWhy?
Without HTTPS enforcement:
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