apache/gravitino

[Improvement] Invalid metadata object type causes authorization interceptor to return internal error

Open

#10 626 ouverte le 1 avr. 2026

Voir sur GitHub
 (1 commentaire) (0 réactions) (1 assigné)Java (887 forks)auto 404
good first issueimprovement

Métriques du dépôt

Stars
 (3 058 stars)
Métriques de merge PR
 (Métriques PR en attente)

Description

What would you like to be improved?

When a request includes an unsupported metadataObjectType path value, Gravitino can fail during authorization context construction and return an internal server error instead of a clean client-facing validation error.

The problem happens before the REST handler runs:

  • ParameterUtil.java converts the path parameter with MetadataObject.Type.valueOf(...)
  • GravitinoInterceptionService.java catches that exception in the authorization interceptor
  • the interceptor then returns Authorization failed due to system internal error

This makes invalid user input look like a server-side authorization failure.

How should we improve?

Handle invalid metadata object types explicitly during authorization parameter extraction.

Options:

  • Catch IllegalArgumentException around MetadataObject.Type.valueOf(...) in ParameterUtil.extractNameIdentifierFromParameters and convert it to a normal invalid-argument path.
  • In GravitinoInterceptionService, treat invalid request-parameter parsing errors as bad requests instead of internal authorization failures.
  • Add tests covering unsupported metadataObjectType values for object-based endpoints to verify they return a clean 4xx response rather than 500.

Guide contributeur