You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(notification): return 400 for webhook validation failures - #5278
Return HTTP 400 for webhook validation failures in legacy and V3 channel/rule APIs. Public messages use an explicit allowlist: HTTPS and channel-limit constraints get fixed descriptions; unknown failures get a generic message. Provider error text stays private. Generic encoders and input validation are unchanged.
Notes for reviewer
HTTP and Svix adapter tests cover mapped and unknown failures, diagnostic-text disclosure prevention, wrapped errors, and provider outages that remain 500s. Original provider causes remain available for internal diagnostics.
Focused notification tests and lint passed.
Confidence Score: 5/5
The reviewed changes appear safe to merge.
Summary
Notification APIs return HTTP 400 for webhook validation failures while keeping provider details private.
Webhook validation errors now return HTTP 400 with safe details.
No new actionable issues were found. Previous review threads were not supplied and could not be retrieved, so no previous-finding determinations are recorded.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Provider error] --> B{Webhook validation error?}
B -->|Yes| C{Approved reason?}
C -->|Yes| D[HTTP 400 with fixed message]
C -->|No| E[HTTP 400 with generic message]
B -->|No| F[Existing error response]
Webhook validation failures now return HTTP 400 with clear, sanitized messages instead of generic server errors.
Known HTTPS and channel-limit constraints receive specific messages; other validation failures use a generic message. Provider details remain private, and outages continue to return server errors.
Documentation
Documented validation error responses for channel and rule mutation APIs.
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.
📝 Walkthrough
Walkthrough
Webhook validation errors now return HTTP 400 with approved public messages in notification mutation APIs. Svix maps the recognized HTTPS URL constraint to a webhook validation error. Tests cover v1 and v3 routes, and the README documents the response behavior.
ValidationError.PublicMessage() returns specific messages for HTTPS and channel-limit errors, and a generic message for other validation errors. Svix maps only the exact HTTPS URL constraint and retains provider error details.
Return validation errors as HTTP 400 openmeter/notification/httpdriver/errors.go, api/v3/handlers/notification/channels/error_encoder.go, api/v3/handlers/notification/rules/error_encoder.go
The error encoders return HTTP 400 with the validation error’s public message. Other error mappings remain in place.
Verify and document API responses openmeter/notification/httpdriver/error_responses_test.go, openmeter/notification/README.md, AGENTS.md
Tests cover v1 and v3 mutation routes, including validation and provider failures. The README documents response status and message behavior. Go conventions require approved public messages and preservation of the original cause for diagnostics.
sequenceDiagram
participant Svix
participant SvixError
participant WebhookValidationError
participant NotificationErrorEncoder
Svix->>SvixError: Return validation response
SvixError->>WebhookValidationError: Map recognized HTTPS URL constraint
WebhookValidationError->>NotificationErrorEncoder: Provide public message
NotificationErrorEncoder->>NotificationErrorEncoder: Return HTTP 400 problem
Loading
Suggested reviewers:borosr, chrisgacsal
Merge Risk:⚪ Minimal · up to f285f
Webhook validation failures now return HTTP 400 with approved messages instead of HTTP 500. Provider details are not exposed. No actionable merge-blocking risk remains.
Pre-merge checks | 4
✅ Passed checks (4 passed)
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title clearly and concisely describes the main change: webhook validation failures now return HTTP 400.
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
Commit to this branch
Create a new PR
📝 Generate docstrings
Commit to this branch
Create a new PR
🧪 Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
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
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.
Overview
Return HTTP 400 for webhook validation failures in legacy and V3 channel/rule APIs. Public messages use an explicit allowlist: HTTPS and channel-limit constraints get fixed descriptions; unknown failures get a generic message. Provider error text stays private. Generic encoders and input validation are unchanged.
Notes for reviewer
HTTP and Svix adapter tests cover mapped and unknown failures, diagnostic-text disclosure prevention, wrapped errors, and provider outages that remain 500s. Original provider causes remain available for internal diagnostics.
Focused notification tests and lint passed.

Confidence Score: 5/5
The reviewed changes appear safe to merge.Summary
Notification APIs return HTTP 400 for webhook validation failures while keeping provider details private.
No new actionable issues were found. Previous review threads were not supplied and could not be retrieved, so no previous-finding determinations are recorded.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Provider error] --> B{Webhook validation error?} B -->|Yes| C{Approved reason?} C -->|Yes| D[HTTP 400 with fixed message] C -->|No| E[HTTP 400 with generic message] B -->|No| F[Existing error response]Reviews (2) · Last reviewed commit: "fix(notification): expose only approved ..." · Reviewed by Greptile
Summary by CodeRabbit
Bug Fixes
Documentation