Fix credential collision when connecting two Server/Data Center sites with the same PAT username - #1933
Open
luisdat wants to merge 3 commits into
Open
Fix credential collision when connecting two Server/Data Center sites with the same PAT username#1933luisdat wants to merge 3 commits into
luisdat wants to merge 3 commits into
Conversation
saveDetailsForSite computed the stored credential ID's siteId as site.product.key (e.g. "jira") for PAT logins instead of the site host, unlike Basic Auth which already used the host. Two different Jira/Bitbucket Server or Data Center instances authenticated via PAT with the same username therefore hashed to the identical credential ID, so connecting a second such site silently overwrote the first site's stored token in both the in-memory store and SecretStorage. The first site would then fail with an auth error and appear disconnected. This method is only ever used for Server/DC (non-cloud) sites, so the credential ID is now always scoped to the site's host, matching the Basic Auth behavior.
luisdat
requested review from
Blastoplex,
amarg-at,
bwieger-atlassian-com,
cabella-dot,
ccallcottstevens,
cindy-atl,
dchiew-atl,
jwang19-atlassian,
leandrowd,
marcomura,
matt-lassian,
sdzh-atlassian and
teg-atlassian
as code owners
August 24, 2026 22:01
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
saveDetailsForSiteinsrc/atlclients/loginManager.tscomputed the stored credential ID'ssiteIdassite.product.key(e.g."jira") for PAT (Personal Access Token) logins, instead of the site host — unlike Basic Auth, which already used the host:Two different Jira or Bitbucket Server/Data Center instances authenticated via PAT with the same username therefore hash to the identical credential ID (
CredentialManager.generateCredentialIdismd5(siteId::username)), so connecting a second such site silently overwrites the first site's stored token — both in the in-memory credential store and in VS Code SecretStorage. The first site then fails auth on its next request and gets marked invalid/disconnected.This is easy to hit in practice: any organization running multiple on-prem Jira/Bitbucket instances where users authenticate with the same corporate/LDAP username on each.
saveDetailsForSiteis only ever used for Server/Data Center (non-cloud) sites, so the fix always scopes the credential ID to the site's host, matching the existing Basic Auth behavior:The OAuth/cloud shared-credential-per-account behavior (a separate, deliberate design for cloud accounts with multiple accessible resources) lives elsewhere and is untouched by this change.
Test plan
src/atlclients/loginManager.test.tsverifying two different Server/DC hosts sharing the same PAT username now produce distinct credential IDs.npm test -- src/atlclients/loginManager.test.ts src/atlclients/authStore.test.tspasses.(Reopened as a fresh PR to replace #1932, which had a CLA-check issue.)
Rovo Dev code review: Rovo Dev couldn't review this pull request
The pull request author does not have access to Rovo Dev.