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

   ### Version
   
   main branch
   
   ### Describe what's wrong
   
   `GET /api/metalakes/{metalake}/objects/{type}/{fullName}/secrets` accepts 
parseable metadata object types that are **not** in the secrets allowlist 
(`metalake, catalog, schema, fileset, table, topic, view, model` per OpenAPI / 
`MetadataObjectSecretOperations`).
   
   For `COLUMN`, `ROLE`, `TAG`, and `POLICY`, the handler throws 
`javax.ws.rs.NotSupportedException` ("Doesn't support secret property 
operations for metadata object type"). `SecretExceptionHandler` does not map 
that exception, so the client sees HTTP **500** `RuntimeException` instead of a 
client **400** (or documented 4xx).
   
   Invalid types such as `user` / `group` already correctly return **400** 
`IllegalArgumentException: Invalid metadata object type`.
   
   ### Error message and/or stacktrace
   
   HTTP 500 `RuntimeException`:
   `Failed to get secrets under object […], reason [Doesn't support secret 
property operations for metadata object type]`
   
   ### How to reproduce
   
   1. Against an auth-enabled cluster, as admin:
   2. `GET /api/metalakes/test/objects/column/hive.<schema>.<table>.id/secrets` 
with `Accept: application/vnd.gravitino.v1+json`
   3. Or `GET …/objects/tag/whatever/secrets` (same for `role`, `policy`)
   4. Observe HTTP 500; expect 400 naming the unsupported type.
   
   ### Additional context
   
   - OpenAPI `secrets.yaml` lists supported types; clients that mistype `type` 
should not get a server error.
   - Fix sketch: throw `IllegalArgumentException` (already mapped to 400 by 
`SecretExceptionHandler`) instead of `NotSupportedException`, or map 
`NotSupportedException` in `SecretExceptionHandler` to **400**.
   - Related enterprise report: 
https://github.com/datastrato/gravitino-enterprise/issues/3326


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