jerryshao commented on code in PR #14669:
URL: https://github.com/apache/gravitino/pull/14669#discussion_r4489621285
##########
server/src/main/java/org/apache/gravitino/server/web/filter/GravitinoInterceptionService.java:
##########
@@ -302,6 +302,9 @@ public Object invoke(MethodInvocation methodInvocation)
throws Throwable {
} catch (IllegalNameIdentifierException ex) {
LOG.warn("Invalid metadata object identifier during authorization",
ex);
return Utils.illegalArguments(ex.getMessage(), ex);
+ } catch (IllegalArgumentException ex) {
Review Comment:
[Major] This catch surrounds authorizer construction,
`executor.execute(...)`, and `methodInvocation.proceed()`, not just request
validation. Any raw `IllegalArgumentException` from those paths now becomes
HTTP 400 / code 1001 with the raw exception message, and bypasses
`ServerHealth.recordFailure`.
For example, the previous
`testUnexpectedIllegalArgumentExceptionRemainsInternalError` required
`getGravitinoAuthorizer()` throwing `IllegalArgumentException("Invalid
authorizer configuration")` to remain HTTP 500 with the generic authorization
error. This PR renames that test and expects 400 instead. Direct
executor/backend failures are also caught, whereas authorizer failures wrapped
by OGNL still return 500, so the classification now depends on wrapping rather
than whether the client caused the error.
The whitespace-name case is a genuine client error: `MetadataObjects.parse`
rejects it before OGNL. Could you convert only that input-parsing failure
through `RequestValidation.parse` or `BadRequestException` /
`IllegalMetadataObjectException`, which are already handled as 400, and remove
this broad catch? Please restore the unexpected-authorizer-exception regression
test, including the generic HTTP 500 response and health-failure recording.
This also preserves RequestValidation's documented boundary excluding
authorizer construction, configuration, expression evaluation and backend calls
from bad-request conversion.
--
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]