fix: enforce owner auth on session endpoints + case-insensitive email#133
Merged
datasciencemonkey merged 2 commits intomainfrom Apr 16, 2026
Merged
Conversation
These endpoints were incorrectly exempted from the before_request authorization check, allowing any Databricks user to list sessions and read buffered terminal output. Also adds 17 new tests covering endpoint-level auth enforcement and case-insensitive email matching. Fixes #132
c4e3c1b to
d0bff8a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
/api/sessionsand/api/session/attachfrom auth exemption list — non-owners could list sessions and read terminal output (fixes Security: session endpoints bypass owner authorization check #132)What changed
app.pyget_token_owner(),get_request_user(), WS authutils.py_GATEWAY_RESOLVEDcachingtests/test_auth_enforcement.pytests/test_gateway_discovery.pytests/test_session_limit.pytests/test_clipboard_addon.pystatic/index.htmlSecurity checklist
/api/sessions(GET) denies non-owners with 403/api/session/attach(POST) denies non-owners with 403/api/session(POST create) denies non-owners with 403/api/session/close(POST) denies non-owners with 403/api/resize(POST) denies non-owners with 403connectdenies non-owners (existing coverage)app_owneris None on Databricks AppsOwner@Databricks.COMmatchesowner@databricks.comOWNER@DATABRICKS.COMmatchesowner@databricks.comget_request_user()returns lowercaseget_token_owner()returns lowercase from both Apps API and PAT pathsTest plan
tests/test_auth_enforcement.py— 17 tests (endpoint auth + case-insensitive)tests/test_ws_authorization.py— 16 tests (WS auth parity)tests/test_app_state.py— 8 tests (owner persistence)