KNOX-3396: Return 4xx for type-mismatched register bodies and issuer-limit-reached instead of 500#1328
Merged
Merged
Conversation
…limit-reached instead of 500
Contributor
Author
|
Cc. @hsheinblatt |
Test Results46 tests 46 ✅ 7s ⏱️ Results for commit 5ef0b01. ♻️ This comment has been updated with latest results. |
hanicz
approved these changes
Jul 24, 2026
hsheinblatt
approved these changes
Jul 24, 2026
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.
KNOX-3396 - Fix trusted-OIDC-issuer register API returning 500 for client-actionable errors
What changes were proposed in this pull request?
Follow-up to KNOX-3368 (#1327), hardening the
POSTregister endpoint of the trusted-OIDC-issuer admin API so that client-actionable conditions return the correct4xxstatus instead of a misleading500:registerIssuernow deserializes the body into a newRegisterIssuerRequestDTO instead of a genericMap<String, Object>with blind casts.IllegalStateExceptionwhen the configuredMAX_TRUSTED_ISSUERSlimit is reached: an operator-facing capacity condition. This is now caught separately and mapped to409 issuer_limit_reached, so it is distinguishable from a genuine storage failure (still500 storage_error).Parsing remains inside the
tryblock, so the audit-on-every-path behavior and the malformed-JSON handling are unchanged. Validation ordering, the SSRF/HTTPS gate, the error-response contract, and the other endpointsGET/DELETE/refresh-jwks) are untouched.How was this patch tested?
Automated unit tests in
TrustedOidcIssuersResourceTest(modulegateway-service-knoxidf). Two cases were added:testRegisterWrongTypeFieldReturnsBadRequest: an array-valuedclusterNamenow returns400 invalid_request(was500before the fix).testRegisterIssuerLimitReached: the service throwingIllegalStateExceptionnow returns409 issuer_limit_reached.Integration Tests
N/A
UI changes
N/A