Skip to content

fix(notification): return 400 for webhook validation failures - #5278

Merged
GAlexIHU merged 2 commits into
mainfrom
codex/fix-notification-validation-status
Oct 13, 2026
Merged

GAlexIHU merged 2 commits into
mainfrom
codex/fix-notification-validation-status

Conversation

@GAlexIHU

@GAlexIHU GAlexIHU commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

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.

RetriggerConfidence 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]
Loading

Reviews (2) · Last reviewed commit: "fix(notification): expose only approved ..." · Reviewed by Greptile

Summary by CodeRabbit

  • Bug Fixes

    • 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.

@GAlexIHU
GAlexIHU requested a review from a team as a code owner October 12, 2026 14:42
@GAlexIHU GAlexIHU added the release-note/bug-fix Release note: Bug Fixes label Oct 12, 2026
@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: openmeterio/openmeter/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 70ec02a0-c207-43ac-9c3c-f945505a285a

📥 Commits

Reviewing files that changed from the base of the PR and between 13a351a and f285ff2.


📒 Files selected for processing (9)
  • AGENTS.md
  • api/v3/handlers/notification/channels/error_encoder.go
  • api/v3/handlers/notification/rules/error_encoder.go
  • openmeter/notification/README.md
  • openmeter/notification/httpdriver/error_responses_test.go
  • openmeter/notification/httpdriver/errors.go
  • openmeter/notification/webhook/errors.go
  • openmeter/notification/webhook/svix/internal/error.go
  • openmeter/notification/webhook/svix/internal/error_test.go

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.

Changes

Webhook validation responses

Layer / File(s) Summary
Map Svix validation details
openmeter/notification/webhook/errors.go, openmeter/notification/webhook/svix/internal/error.go, openmeter/notification/webhook/svix/internal/error_test.go
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.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Sequence Diagram(s)

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 | Passed 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: webhook validation failures now return HTTP 400.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@GAlexIHU
GAlexIHU marked this pull request as draft October 12, 2026 14:49
@GAlexIHU
GAlexIHU marked this pull request as ready for review October 12, 2026 15:09
@GAlexIHU
GAlexIHU enabled auto-merge (squash) October 12, 2026 15:16
@GAlexIHU
GAlexIHU merged commit 32ae353 into main Oct 13, 2026
@GAlexIHU
GAlexIHU deleted the codex/fix-notification-validation-status branch October 13, 2026 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note/bug-fix Release note: Bug Fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants