markhoerth opened a new issue, #14304:
URL: https://github.com/apache/gravitino/issues/14304
### Version
main branch (2.0.0-SNAPSHOT, eb988d1)
### Describe what's wrong
Any request that names a metadata object with the wrong number of
dot-separated parts for its
type (a 2-part name for a table, a 3-part name for a schema) fails during
authorization with 500
and the message "Authorization failed due to system internal error. Please
contact
administrator." It is a malformed request and should get 400. The message
also sends the user to
an administrator who cannot help.
Code path:
- `ParameterUtil.java:94`
(`server/src/main/java/org/apache/gravitino/server/web/filter/`) calls
`MetadataObjects.parse(fullName, type)`.
- `MetadataObjects.java:118-120` (`api/src/main/java/org/apache/gravitino/`)
throws a plain
`IllegalArgumentException`: "If the type is TABLE, the length of names
must be 3".
- `GravitinoInterceptionService.java:296` catches
`IllegalMetadataObjectException` (#12727 made
an invalid *type* return 400), but a wrong-length *name* is a plain
`IllegalArgumentException`,
which falls into the general `catch (Exception ex)` at `:303` and returns
500 at `:313`.
### Error message and/or stacktrace
```
HTTP 500 {"code":1002,"type":"RuntimeException","message":"Authorization
failed due to system internal error. Please contact administrator."}
```
### How to reproduce
With authorization enabled, each of these returns 500:
```
GET /api/metalakes/{metalake}/objects/table/a.b/tags
GET /api/metalakes/{metalake}/objects/schema/a.b.c/policies
GET /api/metalakes/{metalake}/objects/table/a.b/secrets
GET /api/metalakes/{metalake}/owners/table/a.b
```
### Additional context
Requirement: a name that does not fit its object type returns 400 with the
parse message.
Related: #12727.
--
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]