Fix kyuubi sessions to return 404 for non-existent sessions and add security improvements #7319
+66
−10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why are the changes needed?
This PR addresses two important issues with the Kyuubi sessions API:
Incorrect HTTP status codes: When attempting to delete a non-existent session, the API currently returns HTTP 500 (Internal Server Error), which is misleading. A non-existent resource should return HTTP 404 (Not Found) to properly indicate the resource doesn't exist.
Security and privacy concerns:
/api/v1/sessionsendpoint returns all sessions for all users, potentially exposing sensitive information about other users' sessionsHow was this patch tested?
Unit tests were added to verify both changes:
Test for 404 response on delete non-existent session: Added
delete_non-existent_admin_session_returns_404test inAdminResourceSuite.scalathat verifies deleting a non-existent session returns HTTP 404 instead of 500.Test for config redaction: Added
get /sessions returns redacted spark confstest inSessionsResourceSuite.scalathat:spark.password)/api/v1/sessionsWas this patch authored or co-authored using generative AI tooling?
No