-
Notifications
You must be signed in to change notification settings - Fork 672
Closed
Labels
Description
What would you like to be improved?
When I test the metalake not existed scenario for all tag apis. Some api response 403, some response 404. We should align these apis response in the authorization enable scenario.
For exampe:
List tag response 404, list objects for tag response 404, but other apis like create tag, get tag, associate tag ... response 403
URL: http://192.168.194.149:8090/api/metalakes/metaLakeNotExisted/tags/
Status code: 404
Content Type: application/json
Request Headers
Accept=application/vnd.gravitino.v1+json
Authorization=Basic YW5vbnltb3VzOnRlc3Q=
Content-Type=application/json
Response Headers
Server: Jetty(9.4.51.v20230217)
Transfer-Encoding: chunked
Date: Tue, 25 Nov 2025 04:06:19 GMT
Content-Type: application/json
Response Body
{
"code": 1003,
"type": "NoSuchMetalakeException",
"message": "Failed to operate tag(s) operation [LIST] under object [metaLakeNotExisted], reason [Metalake metaLakeNotExisted does not exist]",
"stack": [
"org.apache.gravitino.exceptions.NoSuchMetalakeException: Metalake metaLakeNotExisted does not exist",
"\tat org.apache.gravitino.metalake.MetalakeManager.metalakeInUse(MetalakeManager.java:124)",
"\tat org.apache.gravitino.metalake.MetalakeManager.checkMetalake(MetalakeManager.java:101)",
"\tat org.apache.gravitino.tag.TagManager.listTagsInfo(TagManager.java:77)",
"\tat org.apache.gravitino.tag.TagManager.listTags(TagManager.java:73)",
URL: http://192.168.194.149:8090/api/metalakes/metaLakeNotExisted/tags/moon1/objects
Status code: 404
Content Type: application/json
Request Headers
Accept=application/vnd.gravitino.v1+json
Authorization=Basic YW5vbnltb3VzOnRlc3Q=
Content-Type=application/json
Response Headers
Server: Jetty(9.4.51.v20230217)
Transfer-Encoding: chunked
Date: Tue, 25 Nov 2025 04:06:19 GMT
Content-Type: application/json
Response Body
{
"code": 1003,
"type": "NoSuchMetalakeException",
"message": "Failed to operate tag(s) operation [LIST] under object [moon1], reason [Metalake metaLakeNotExisted does not exist]",
"stack": [
"org.apache.gravitino.exceptions.NoSuchMetalakeException: Metalake metaLakeNotExisted does not exist",
"\tat org.apache.gravitino.metalake.MetalakeManager.metalakeInUse(MetalakeManager.java:124)",
"\tat org.apache.gravitino.metalake.MetalakeManager.checkMetalake(MetalakeManager.java:101)",
"\tat org.apache.gravitino.tag.TagManager.listMetadataObjectsForTag(TagManager.java:196)",
"\tat org.apache.gravitino.listener.TagEventDispatcher.listMetadataObjectsForTag(TagEventDispatcher.java:189)",
"\tat org.apache.gravitino.hook.TagHookDispatcher.listMetadataObjectsForTag(TagHookDispatcher.java:89)",
"\tat org.apache.gravitino.server.web.rest.TagOperations.lambda$listMetadataObjectsForTag$11(TagOperations.java:272)",
"\tat java.base/java.security.AccessController.doPrivileged(AccessController.java:712)",
"\tat java.base/javax.security.auth.Subject.doAs(Subject.java:439)",
URL: http://192.168.194.149:8090/api/metalakes/metaLakeNotExisted/tags/
Status code: 403
Content Type: application/json
Request Headers
Accept=application/vnd.gravitino.v1+json
Authorization=Basic YW5vbnltb3VzOnRlc3Q=
Content-Type=application/json
Content Body
{
"name": "testTagMetaLakeNotExisted",
"comment": "",
"properties": {
}
}
Response Headers
Server: Jetty(9.4.51.v20230217)
Date: Tue, 25 Nov 2025 04:06:19 GMT
Content-Length: 154
Content-Type: application/json
Response Body
{
"code": 1008,
"type": "ForbiddenException",
"message": "User 'anonymous' is not authorized to perform operation 'createTag' on metadata 'metaLakeNotExisted'"
URL: http://192.168.194.149:8090/api/metalakes/metaLakeNotExisted/tags/moon
Status code: 403
Content Type: application/json
Request Headers
Accept=application/vnd.gravitino.v1+json
Authorization=Basic YW5vbnltb3VzOnRlc3Q=
Content-Type=application/json
Response Headers
Server: Jetty(9.4.51.v20230217)
Date: Tue, 25 Nov 2025 04:06:19 GMT
Content-Length: 137
Content-Type: application/json
Response Body
{
"code": 1008,
"type": "ForbiddenException",
"message": "User 'anonymous' is not authorized to perform operation 'getTag' on metadata 'moon'"
}
URL: http://192.168.194.149:8090/api/metalakes/metaLakeNotExisted/tags/catalog/f1/
Status code: 403
Content Type: application/json
Request Headers
Accept=application/vnd.gravitino.v1+json
Authorization=Basic YW5vbnltb3VzOnRlc3Q=
Content-Type=application/json
Content Body
{
"tagsToAdd": [
"moon1",
"moon2",
"moon3",
"associateNotExistedTag"
],
"tagsToRemove": [
]
}
Response Headers
Server: Jetty(9.4.51.v20230217)
Date: Tue, 25 Nov 2025 04:06:19 GMT
Content-Length: 167
Content-Type: application/json
Response Body
{
"code": 1008,
"type": "ForbiddenException",
"message": "User 'anonymous' is not authorized to perform operation 'associateTagsForObject' on metadata 'metaLakeNotExisted'"
}
How should we improve?
No response