nevzheng opened a new pull request, #13059:
URL: https://github.com/apache/gravitino/pull/13059

   ### What changes were proposed in this pull request?
   
   Treat an unsupported metadata-object `{type}` parsed by the authorization 
interceptor as malformed client input. Affected object endpoints now return the 
standard HTTP 400 illegal-argument response instead of an authorization-related 
HTTP 500.
   
   The change uses `IllegalMetadataObjectException` as a narrow internal signal 
at the enum-parsing boundary. The interceptor handles only that typed exception 
as client input, while unrelated authorization failures continue to return HTTP 
500. Valid metadata-object types continue through the existing authorization 
flow unchanged.
   
   This pull request adds focused interceptor tests and a raw HTTP integration 
test with authorization enabled.
   
   ### Why are the changes needed?
   
   With authorization enabled, 
`ParameterUtil.extractNameIdentifierFromParameters` calls 
`MetadataObject.Type.valueOf` before the resource method runs. An unknown type 
throws `IllegalArgumentException`, which the interceptor's generic handler 
currently reports as a system authorization failure. This misclassifies client 
input and affects the endpoint families documented in #12727.
   
   The earlier diagnosis in #10626 and implementation attempts #10634 and 
#10635 identified the same failure mode. Those pull requests conflict with 
current `main`; this pull request carries a narrowly typed correction forward 
against current `main` and acknowledges that prior work.
   
   Fix: #12727
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. With authorization enabled, an unsupported metadata-object type now 
returns HTTP 400 with error code `1001` and a message identifying the rejected 
value, instead of HTTP 500 with error code `1002` and a generic 
internal-authorization message.
   
   Valid requests, public APIs, and configuration remain unchanged.
   
   ### How was this patch tested?
   
   - `./gradlew :server:test --tests 
'org.apache.gravitino.server.web.filter.TestGravitinoInterceptionService' 
-PskipITs -PskipWeb=true` — passed 19 tests with no failures or errors.
   - `./gradlew :clients:client-java:test --tests 
'org.apache.gravitino.client.integration.test.authorization.InvalidMetadataObjectTypeAuthorizationIT'
 -PskipWeb=true` — passed the raw HTTP authorization integration test.
   - `./gradlew :server:spotlessApply :clients:client-java:spotlessApply 
-PskipWeb=true` — passed.
   - `git diff --check` — passed.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to