markhoerth opened a new issue, #12727:
URL: https://github.com/apache/gravitino/issues/12727

   An unrecognised `{type}` path parameter on the metadata object endpoints 
returns HTTP 500 with an internal-error message, rather than rejecting the 
request as malformed.
   
   Reproduce, against a server with authorization enabled:
   
   ```
   curl -s -w '\n%{http_code}\n' \
     'http://<server>:8090/api/metalakes/zz/objects/bogusType/a.b.c/tags'
   ```
   
   Response:
   
   ```json
   {"code":1002,"type":"RuntimeException",
    "message":"Authorization failed due to system internal error. Please 
contact administrator.",
    "stack":["java.lang.IllegalArgumentException: No enum constant 
org.apache.gravitino.MetadataObject.Type.BOGUSTYPE",
             "\tat java.base/java.lang.Enum.valueOf(Enum.java:273)",
             "\tat 
org.apache.gravitino.MetadataObject$Type.valueOf(MetadataObject.java:35)"]}
   ```
   
   `MetadataObject$Type.valueOf` is called inside 
`GravitinoInterceptionService$MetadataAuthorizationMethodInterceptor`, so the 
failure happens in the authorization interceptor before the resource method 
validates its own arguments.
   
   A malformed path parameter is a client error. The endpoint must return 400 
with an error code naming the rejected value, and must not report a client 
input error as a system internal error directing the caller to contact an 
administrator.
   
   Affected families:
   
   - `/metalakes/{metalake}/objects/{type}/{fullName}/tags`
   - `/metalakes/{metalake}/objects/{type}/{fullName}/policies`
   - `/metalakes/{metalake}/objects/{type}/{fullName}/statistics`
   - `/metalakes/{metalake}/objects/{type}/{fullName}/statistics/partitions`
   - `/metalakes/{metalake}/objects/{type}/{fullName}/credentials`
   - `/metalakes/{metalake}/owners/{metadataObjectType}/{fullName}`
   - `/metalakes/{metalake}/tags/{type}/{fullName}`
   
   `/metalakes/{metalake}/objects/{type}/{fullName}/roles` returns 400 on the 
same input, so the correct handling already exists in one handler and can be 
applied to the rest.
   
   Found by a REST contract sweep over all 130 `/metalakes` endpoints on build 
1.3.0-SNAPSHOT, commit 6d9d432df18a9bd124c162ea50a296f436549980.
   
   Required: fixed upstream in apache/gravitino and present in the enterprise 
tree before RC2 on September 4.
   


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