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

   ### Version
   
   main branch
   
   ### Describe what's wrong
   
   `{version}` on the model version endpoints is a typed path parameter (a 
numeric
   type). A non-numeric value fails path matching in Jersey, so the request 
never
   reaches a resource method and Jetty serves its own default HTML error page
   instead of Gravitino's structured JSON error body.
   
   Every other error on the metadata API returns a structured body carrying a
   Gravitino error code and type. A caller that receives HTML on one input shape
   and JSON on every other has to special-case the parser, and the response
   identifies the servlet container and its version to anyone who sends a bad
   value.
   
   Affects at least:
   
   ```
   GET 
/metalakes/{metalake}/catalogs/{catalog}/schemas/{schema}/models/{model}/versions/{version}
   GET 
/metalakes/{metalake}/catalogs/{catalog}/schemas/{schema}/models/{model}/versions/{version}/uri
   ```
   
   Any other typed path parameter on the metadata API likely behaves the same 
way
   and should be covered by the same fix.
   
   ### Error message and/or stacktrace
   
   ```
   GET /api/metalakes/{ml}/catalogs/c1/schemas/s1/models/m1/versions/1
       403, Gravitino JSON error body
   
   GET /api/metalakes/{ml}/catalogs/c1/schemas/s1/models/m1/versions/abc
       404, text/html
   ```
   
   Response body for the second case:
   
   ```html
   <html>
   <head>
   <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
   <title>Error 404 Not Found</title>
   </head>
   <body><h2>HTTP ERROR 404 Not Found</h2>
   ...
   Powered by Jetty://
   ```
   
   ### How to reproduce
   
   Use the main branch and start a Gravitino server with a metalake, catalog,
   schema, and registered model in place, then request a model version with a
   non-numeric `{version}` path segment:
   
   ```shell
   curl -i 
'http://localhost:8090/api/metalakes/test/catalogs/c1/schemas/s1/models/m1/versions/abc'
   ```
   
   Expected:
   
   - A structured JSON `ErrorResponse`, consistent with every other error on the
     API
   - No Jetty default error page ever served on any `/api/*` path
   
   Actual:
   
   - HTTP 404 with `Content-Type: text/html`
   - Jetty's default HTML error page, which also discloses the servlet container
     and its version
   
   ### Additional context
   
   The numeric case confirms the routes exist and behave correctly, so this is
   input handling rather than a missing endpoint. The model registry ships in
   1.3.0; a scan of the endpoint inventory against the test corpus found no test
   referencing these paths, so nothing would have caught this.
   


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