fix(atlassian): harden cloud ID resolution for Confluence and Jira#3853
fix(atlassian): harden cloud ID resolution for Confluence and Jira#3853waleedlatif1 merged 1 commit intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview When no match is found, the code now only falls back to the sole resource if exactly one site is accessible; otherwise it throws a more informative error listing available sites, avoiding silently choosing Written by Cursor Bugbot for commit 8115abb. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Greptile SummaryThis PR hardens cloud ID resolution for both Confluence and Jira by normalizing the user-supplied domain (stripping protocol, trailing slashes, and whitespace) before matching against Atlassian's accessible-resources API, and replacing the silent "fall back to first result" behavior with a descriptive error that lists available sites. The single-site fallback is intentionally preserved.
Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User provides domain string] --> B[normalizeDomain\ntrim · strip protocol · strip trailing slash · lowercase]
B --> C[GET /oauth/token/accessible-resources]
C --> D{response.ok?\nJira only}
D -- No --> E[Throw HTTP error with status]
D -- Yes --> F[Parse JSON resources]
C --> F2[Parse JSON resources\nConfluence — no ok check]
F --> G{Array with items?}
F2 --> G
G -- No --> H[Throw: No resources found]
G -- Yes --> I{Find resource where\nurl matches normalized domain}
I -- Match found --> J[Return matched cloud ID]
I -- No match --> K{resources.length === 1?}
K -- Yes --> L[Return single resource ID\nsingle-site fallback]
K -- No --> M[Throw descriptive error\nlisting available site URLs]
|

Summary
getConfluenceCloudIdandgetJiraCloudId(strip protocol, trailing slashes, whitespace)resources[0]when multiple Atlassian sites exist and domain doesn't match — now throws with available sites listedType of Change
Testing
Tested manually
Checklist