honor webhook http 422 as unconditional deny#4703
Open
Sanskarzz wants to merge 1 commit intostacklok:mainfrom
Open
honor webhook http 422 as unconditional deny#4703Sanskarzz wants to merge 1 commit intostacklok:mainfrom
Sanskarzz wants to merge 1 commit intostacklok:mainfrom
Conversation
Signed-off-by: Sanskarzz <sanskar.gur@gmail.com>
JAORMX
approved these changes
Apr 9, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4703 +/- ##
==========================================
+ Coverage 68.72% 68.74% +0.02%
==========================================
Files 515 515
Lines 53590 53602 +12
==========================================
+ Hits 36829 36850 +21
+ Misses 13919 13912 -7
+ Partials 2842 2840 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Summary
This PR fixes webhook HTTP 422 handling to match RFC THV-0017.
Both validating and mutating webhook middleware now treat an HTTP 422 response from a webhook as an unconditional deny, regardless of whether the webhook
failure_policyisfailorignore.Fixes #4663
Changes
pkg/webhook/errors.goto detect webhook errors that must always deny.pkg/webhook/validating/middleware.goto deny on webhook HTTP 422 before applying failure policy.pkg/webhook/mutating/middleware.goto deny on webhook HTTP 422 before applying failure policy.failandignorepolicies.Why
Per RFC THV-0017, webhook HTTP 422 is a semantic rejection and should not be treated like a normal operational error. Previously,
failure_policy: ignorecould allow the request to continue even when the webhook returned 422.Test plan
task test)task test-e2e)task lint-fix)