lasdf1234 opened a new pull request, #14526:
URL: https://github.com/apache/gravitino/pull/14526

   ### What changes were proposed in this pull request?
   
   - In `RunJobAuthorizationExecutor`, treat a missing request body as a client 
error (`BadRequestException("Request body cannot be null")`) instead of `return 
false` (which became 403).
   - Wrap `JobRunRequest.validate()` failures as `BadRequestException` so the 
existing interceptor `catch (BadRequestException)` path returns **400**, 
instead of letting `IllegalArgumentException` fall into the catch-all and 
become **500**.
   - Add `TestRunJobAuthorizationExecutor` covering the executor and the 
interception path (null body / blank `jobTemplateName` → 400).
   
   ### Why are the changes needed?
   
   Fixes #14423
   
   `POST .../jobs/runs` with no body or a missing/blank `jobTemplateName` was 
answered as 403 or 500 during authorization, before `JobOperations.runJob` 
could return the usual 400. Same pattern as `LineageAuthorizationExecutor` (map 
invalid input to `BadRequestException`).
   
   Related: #10171, #14304.
   
   ### Does this PR introduce _any_ user-facing change?
   
   - Invalid run-job requests that previously returned 403/500 during 
authorization now return **400** with the validation message (aligned with the 
endpoint).
   
   ### How was this patch tested?
   
   - `./gradlew :server:test --tests 
org.apache.gravitino.server.web.filter.authorization.TestRunJobAuthorizationExecutor
 -PskipITs`
   
   
   Made with [Cursor](https://cursor.com)


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