Skip to content

fix pat impersonation for datalake#5

Merged
AbhishekGedela merged 1 commit intomasterfrom
pat_user_impersonation
Apr 14, 2026
Merged

fix pat impersonation for datalake#5
AbhishekGedela merged 1 commit intomasterfrom
pat_user_impersonation

Conversation

@AbhishekGedela
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts Starburst/Trino session-user impersonation behavior to handle PAT-based authentication for a specific “datalake” database case.

Changes:

  • Fetches the current database from the metadata provider during execution.
  • Introduces a force-pat-user? path that sets/clears Trino sessionUser for PAT auth even when the existing impersonate:true clientInfo flag is not present.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +165 to +168
(let [database (lib.metadata/database (qp.store/metadata-provider))
impersonation-enabled? (clojure.string/includes? (.getProperty (.getClientInfo conn) "ClientInfo" "") "impersonate:true")
force-pat-user? (and (= api/*current-auth-type* :pat)
(contains? #{39} (:id database)))]
Comment on lines +179 to +182
(let [database (lib.metadata/database (qp.store/metadata-provider))
impersonation-enabled? (clojure.string/includes? (.getProperty (.getClientInfo conn) "ClientInfo" "") "impersonate:true")
force-pat-user? (and (= api/*current-auth-type* :pat)
(contains? #{39} (:id database)))]
Comment on lines +167 to 174
force-pat-user? (and (= api/*current-auth-type* :pat)
(contains? #{39} (:id database)))]
(if
(or impersonation-enabled? force-pat-user?)
(let [session-user (if (= api/*current-auth-type* :pat)
"pat_user"
(get (deref api/*current-user*) :email))]
(.setSessionUser (.unwrap conn TrinoConnection) session-user))
@AbhishekGedela AbhishekGedela merged commit b05d458 into master Apr 14, 2026
6 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants