markhoerth commented on issue #14417:
URL: https://github.com/apache/gravitino/issues/14417#issuecomment-6697634124

   One route still fails on main at commit 
463296caca4082133bf12bad2bd4ed5d2572933e (2.0.0-SNAPSHOT) when authorization is 
enabled: `POST .../namespaces/{namespace}/register` with no body returns 500. 
The other 10 routes in the suite's no-body check and the three routes in its 
missing-fields check return 400. The 2.0 OSS test suite check 
`test_request_without_body_is_400[register_table]` fails. The earlier 
verification used Jersey unit tests against the resource classes, which do not 
run the authorization interceptor where the failure occurs.
   
   ```
   curl -s -X POST -H "Authorization: Basic $(printf admin:x | base64)" -H 
'Content-Type: application/json' \
     http://127.0.0.1:9001/iceberg/v1/namespaces/repro_ns/register
   
   HTTP 500
   {"error":{"message":"Authorization failed due to system internal error, 
User: 'admin', Operation: 
'registerTable'","type":"RuntimeException","code":500,"stack":[
     "java.lang.RuntimeException: Authorization failed due to system internal 
error, User: 'admin', Operation: 'registerTable'",
     "at 
org.apache.gravitino.server.web.filter.BaseMetadataAuthorizationMethodInterceptor.authorizeMethodInScope(BaseMetadataAuthorizationMethodInterceptor.java:404)",
     ...
     "Caused by: java.lang.NullPointerException: Cannot invoke 
\"org.apache.iceberg.rest.requests.RegisterTableRequest.overwrite()\" because 
\"request\" is null",
     "at 
org.apache.gravitino.server.web.filter.RegisterTableAuthzHandler.<init>(RegisterTableAuthzHandler.java:88)",
   ```
   
   Cause: `IcebergMetadataAuthorizationMethodInterceptor.java:176` builds 
`RegisterTableAuthzHandler`, whose constructor dereferences the null request at 
`RegisterTableAuthzHandler.java:87-88`. The body check in 
`IcebergNamespaceOperations.java:328` (`IcebergRESTUtils.validateRequest`) runs 
only after the interceptor, so it is never reached. Both filter classes are 
under 
`iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/server/web/filter/`,
 and the resource is under 
`iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/rest/`.


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