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

   ### Version
   
   main branch
   
   ### Describe what's wrong
   
   `PUT /api/idp/users/{user}/enabled` must reject a null request body with 
HTTP **400** (`Request body cannot be null`), the same contract as the other 
built-in IdP write APIs (`addUser`, `changePassword`, `addGroup`, 
`changeGroupMembership`) and metalake user create.
   
   When the null-body guard is missing, the handler dereferences the request 
and returns HTTP **500** with `NullPointerException` on 
`UpdateUserEnabledRequest.validate()` instead of **400**.
   
   ### Error message and/or stacktrace
   
   ```
   RuntimeException: Failed to operate built-in IdP user [admin] operation 
[UPDATE],
   reason [Cannot invoke 
"org.apache.gravitino.idp.dto.requests.UpdateUserEnabledRequest.validate()"
   because "request" is null]
   
   NullPointerException: Cannot invoke
   "org.apache.gravitino.idp.dto.requests.UpdateUserEnabledRequest.validate()"
   because "request" is null
     at 
org.apache.gravitino.idp.web.rest.IdpUserOperations.lambda$updateEnabled$3(IdpUserOperations.java)
   ```
   
   ### How to reproduce
   
   1. Use the `basic` authenticator with a configured service admin.
   2. `PUT /api/idp/users/{existingUser}/enabled` with `Content-Type: 
application/json` and body `null` (or empty body).
   3. Observe HTTP **500** NPE instead of **400** `Request body cannot be null`.
   
   ### Additional context
   
   - Expect: **400** via `IdpRESTUtils.rejectNullRequestBody`, consistent with 
the other IdP write endpoints.
   - Related: #14579 (broader IdP null-body fix). This issue tracks the 
`updateEnabled` path specifically so it stays aligned with that contract.


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