Skip to content

Commit 31e166f

Browse files
authored
fix(jira): add classic JSM scopes to close granular scope-set gap (#5005)
* fix(jira): add classic JSM scopes to close granular scope-set gap * fix(jira): note read:user:jira requirement for granular-only tokens in docs
1 parent 0c2dbac commit 31e166f

4 files changed

Lines changed: 28 additions & 2 deletions

File tree

apps/docs/content/docs/en/integrations/atlassian-service-account.mdx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,20 @@ The service account inherits permissions from the project/space roles you grant
6464
<Step>
6565
Select the scopes the token needs. The minimum set Sim's Jira and Confluence blocks expect is:
6666

67-
**Jira (granular):**
67+
**Jira (classic):**
6868
```
6969
read:jira-user
7070
read:jira-work
7171
write:jira-work
7272
```
7373

74+
**Jira Service Management (classic):**
75+
```
76+
read:servicedesk-request
77+
write:servicedesk-request
78+
manage:servicedesk-customer
79+
```
80+
7481
**Confluence (granular):**
7582
```
7683
read:confluence-content.all
@@ -82,6 +89,10 @@ The service account inherits permissions from the project/space roles you grant
8289

8390
Add more scopes only if you need the corresponding operations (delete, manage webhooks, etc.). The full list of scopes Sim's blocks may use is documented in [Atlassian's developer reference](https://developer.atlassian.com/cloud/jira/platform/scopes-for-oauth-2-3LO-and-forge-apps/).
8491

92+
<Callout type="warn">
93+
Prefer the classic scopes above over granular equivalents. Atlassian enforces an endpoint's granular scope list as all-or-nothing, so a token built from a partial granular set fails with `Unauthorized; scope does not match` even though each individual scope was granted. The classic scopes each cover their product's endpoints on their own. If your organization only permits granular scopes, include every scope listed for each endpoint in Atlassian's reference — Jira Service Management request operations also require `read:user:jira`.
94+
</Callout>
95+
8596
<div className="flex justify-center">
8697
<Image
8798
src="/static/credentials/atlassian/admin-scope-picker.png"

apps/sim/connectors/jsm/jsm.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,12 @@ export const jsmConnector: ConnectorConfig = {
334334
mode: 'oauth',
335335
provider: 'jira',
336336
requiredScopes: [
337+
/**
338+
* Atlassian enforces granular scope sets all-or-nothing; the classic scope
339+
* alone authorizes the request read endpoints, so require it to flag stale
340+
* credentials that predate it in the provider scope list.
341+
*/
342+
'read:servicedesk-request',
337343
'read:servicedesk:jira-service-management',
338344
'read:request:jira-service-management',
339345
'read:request.comment:jira-service-management',

apps/sim/lib/oauth/oauth.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,12 +515,18 @@ export const OAUTH_PROVIDERS: Record<string, OAuthProviderConfig> = {
515515
'read:me',
516516
'offline_access',
517517
'read:issue.vote:jira',
518+
'read:user:jira',
518519
'delete:issue:jira',
519520
'delete:comment:jira',
520521
'delete:attachment:jira',
521522
'delete:issue-worklog:jira',
522523
'delete:issue-link:jira',
523-
// Jira Service Management scopes
524+
// Jira Service Management scopes. The classic scopes are required: Atlassian
525+
// enforces an endpoint's granular scope set as all-of, and several JSM request
526+
// endpoints include scopes outside this list in their granular sets.
527+
'read:servicedesk-request',
528+
'write:servicedesk-request',
529+
'manage:servicedesk-customer',
524530
'read:servicedesk:jira-service-management',
525531
'read:requesttype:jira-service-management',
526532
'read:request:jira-service-management',

apps/sim/lib/oauth/utils.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,9 @@ export const SCOPE_DESCRIPTIONS: Record<string, string> = {
168168
'delete:issue-link:jira': 'Delete links between Jira issues',
169169

170170
// Jira Service Management scopes
171+
'read:servicedesk-request': 'View service desk requests',
172+
'write:servicedesk-request': 'Create and update service desk requests',
173+
'manage:servicedesk-customer': 'Manage service desk customers and organizations',
171174
'read:servicedesk:jira-service-management': 'View service desks and their settings',
172175
'read:requesttype:jira-service-management': 'View request types available in service desks',
173176
'read:request:jira-service-management': 'View customer requests in service desks',

0 commit comments

Comments
 (0)