Skip to content

Commit 982b203

Browse files
Maffoochclaude
andcommitted
docs(jira): Pro Jira integrator guide - auth methods, minimum scopes, OAuth setup
- Document the Basic, PAT, OAuth 2.0 (3LO), and service-account token auth methods. - Absolute-minimum classic and granular scopes. - OAuth app setup: Resource-level access type and 3LO callback registration. - Behavioral notes: internal gateway API base vs public browse URL. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 8cd4fdb commit 982b203

2 files changed

Lines changed: 108 additions & 0 deletions

File tree

docs/content/issue_tracking/pro_integration/integrations.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Supported Integrations:
1313
- [Azure Devops](/issue_tracking/pro_integration/integrations/#azure-devops-boards)
1414
- [GitHub](/issue_tracking/pro_integration/integrations/#github)
1515
- [GitLab Boards](/issue_tracking/pro_integration/integrations/#gitlab)
16+
- [Jira](/issue_tracking/pro_integration/integrations/#jira)
1617
- [ServiceNow](/issue_tracking/pro_integration/integrations/#servicenow)
1718

1819
## Opening the Integrations page
@@ -71,6 +72,7 @@ For the complete list of requirements, please open the vendor specific pages bel
7172
- [Azure Devops](/issue_tracking/pro_integration/integrations/#azure-devops-boards)
7273
- [GitHub](/issue_tracking/pro_integration/integrations/#github)
7374
- [GitLab Boards](/issue_tracking/pro_integration/integrations/#gitlab)
75+
- [Jira](/issue_tracking/pro_integration/integrations/#jira)
7476
- ServiceNow (Coming Soon)
7577

7678
## Error Handling and Debugging

docs/content/issue_tracking/pro_integration/integrations_toolreference.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,112 @@ By default, GitLab has statuses of 'opened' and 'closed'. Additional status lab
125125
- **False Positive Mapping**: `closed`
126126
- **Risk Accepted Mapping**: `closed`
127127

128+
## Jira
129+
130+
The Jira integration pushes DefectDojo Findings and Finding Groups to a Jira project as issues, keeps each issue's status in sync with the Finding, and links the Finding back to the created issue. Both Jira **Cloud** and **Data Center / Server** are supported. Jira Service Management is not supported.
131+
132+
### Choosing an authentication method
133+
134+
Set **Jira Deployment** first, then pick an **Authentication Method**:
135+
136+
**Jira Cloud**
137+
- **API Token (email + token)** — HTTP Basic auth using an Atlassian account email and an [API token](https://id.atlassian.com/manage-profile/security/api-tokens). Calls go directly to your site URL.
138+
- **OAuth 2.0 (recommended)** — a one-time browser consent; DefectDojo obtains and refreshes the tokens for you.
139+
- **Service Account Token** — a scoped API token created for an Atlassian [service account](https://support.atlassian.com/user-management/docs/manage-api-tokens-for-service-accounts/).
140+
141+
**Jira Data Center / Server**
142+
- **Personal Access Token (recommended)**
143+
- **Username + Password**
144+
145+
> **How Cloud auth reaches Jira:** OAuth 2.0 and Service Account both authenticate as a Bearer token against Atlassian's gateway — `https://api.atlassian.com/ex/jira/{cloudId}` — which is a *different host* than your `https://your-site.atlassian.net` site URL. DefectDojo uses the gateway for every API call but always builds the ticket link shown on a Finding from your **site URL**, so the link a user clicks is a normal, browsable `.../browse/{ISSUE-KEY}` link. (API Token and Data Center auth call the site URL directly, so there is no split.)
146+
147+
### Instance Setup
148+
149+
- **Label** should be the label you want to use to identify this integration.
150+
- **Location** should be set to your Jira **site URL**, for example `https://your-organization.atlassian.net`. This is used for the browsable ticket links, and — for API Token and Data Center auth — as the API base URL.
151+
- The remaining fields depend on the method you chose above (email + API token, OAuth client credentials, service-account token, PAT, or username + password).
152+
153+
### OAuth 2.0 setup (Cloud)
154+
155+
Create a dedicated app in the [Atlassian developer console](https://developer.atlassian.com/console/myapps/), then connect from DefectDojo.
156+
157+
1. Choose **Create → OAuth 2.0 integration**. It must be an *OAuth 2.0 integration* — a Connect or Forge app cannot use the 3LO authorization-code grant (you'd get `grant_type is not enabled for client`).
158+
2. When prompted for **Access type**, choose **Resource-level**. This scopes the token to the single Jira site the user authorizes, which is exactly what one DefectDojo connection targets. (**Account-level** grants access to every site in the Atlassian account — broader than needed.)
159+
3. Under **Permissions**, add the **Jira platform REST API** and grant the scopes listed below. Note: `offline_access` is *not* listed here — it is a standard OAuth scope DefectDojo requests in the authorization URL, not something you add on this screen.
160+
4. Under **Authorization**, next to **OAuth 2.0 (3LO)** click **Configure** and set the **Callback URL** to `https://<your-defectdojo-host>/integrators/jira/oauth/callback` — it must match your DefectDojo site URL exactly. Enabling this is what turns on the authorization-code grant and refresh tokens; skipping it causes the `grant_type is not enabled` / `Client is not allowed to use offline_access` errors.
161+
5. Copy the **Client ID** and **Client Secret** into the DefectDojo form and **Submit** to save the connection.
162+
6. Click **Connect with Jira** and approve the consent screen. Atlassian redirects back to DefectDojo, which stores the tokens and resolves your `cloudId` automatically. A "Connected" indicator appears when it succeeds.
163+
164+
> The callback host is your DefectDojo `SITE_URL`. Atlassian must be able to redirect the browser there, and the value must match what DefectDojo sends exactly — so use the real hostname your users reach DefectDojo at, not a value only reachable from inside the network.
165+
166+
#### Minimum OAuth scopes
167+
168+
DefectDojo requests these four classic scopes by default, and they are also the **absolute minimum** required — each one backs a specific behavior:
169+
170+
| Scope | Required for |
171+
|-------|--------------|
172+
| `read:jira-work` | Reading the project, issues, and available transitions (connection validation and status sync). |
173+
| `write:jira-work` | Creating and editing issues, and executing status transitions. |
174+
| `read:jira-user` | The connection's identity check — DefectDojo calls `/myself` when validating access. |
175+
| `offline_access` | Issuing a **refresh token**. Without it the access token expires (~1 hour after you connect) and the connection stops working, because DefectDojo can no longer refresh it. |
176+
177+
Atlassian recommends classic scopes over granular ones; the four above keep the app's footprint minimal and are sufficient for everything the integration does.
178+
179+
##### Granular scope alternative
180+
181+
If your organization requires **granular** scopes instead of classic, the minimum equivalent set is:
182+
183+
| Granular scope | Required for |
184+
|----------------|--------------|
185+
| `read:user:jira` | The `/myself` identity check. |
186+
| `read:project:jira` | Validating the target project exists. |
187+
| `read:issue:jira` | Reading an issue's current status during sync. |
188+
| `write:issue:jira` | Creating and editing issues **and executing status transitions** — there is no separate transition-write scope; a transition is a write to the issue. |
189+
| `read:issue.transition:jira` | Listing the transitions available on an issue. |
190+
| `offline_access` | The refresh token (same as classic). |
191+
192+
Depending on your site's field configuration, an endpoint may also require companion read scopes to expand fields — most commonly `read:status:jira` and `read:field:jira` (and `read:issue-meta:jira` for create). If a push fails with a `403` "scope does not match" error, add the exact scope named in the error. This companion-scope sprawl is precisely why classic scopes are recommended.
193+
194+
For the **Service Account Token** method, grant the token `read:jira-work` and `write:jira-work` (plus `read:jira-user`) — or the granular equivalents above without `offline_access`. `offline_access` does not apply — a service-account token is long-lived and is not refreshed by DefectDojo.
195+
196+
### Issue Tracker Mapping
197+
198+
- **Project Key**: the key of the Jira project to create issues in, for example `SEC`.
199+
- **Issue Type**: the issue type to create, for example `Bug` or `Task`. Defaults to `Bug`.
200+
201+
### Severity Mapping Details
202+
203+
Defaults match Jira's default priority scheme. Edit them to match the priority names in your project:
204+
205+
- **Severity Field Name**: `priority`
206+
- **Info Mapping**: `Lowest`
207+
- **Low Mapping**: `Low`
208+
- **Medium Mapping**: `Medium`
209+
- **High Mapping**: `High`
210+
- **Critical Mapping**: `Highest`
211+
212+
### Status Mapping Details
213+
214+
Statuses vary per project workflow, so these defaults are meant to be edited to **your** workflow's status names:
215+
216+
- **Status Field Name**: `status`
217+
- **Active Mapping**: `To Do`
218+
- **Closed Mapping**: `Done`
219+
- **False Positive Mapping**: `Done`
220+
- **Risk Accepted Mapping**: `Done`
221+
222+
### Custom Fields (optional)
223+
224+
You can map additional Jira fields (for example a required `resolution` on close, or `labels`) in the mapping's **Custom Fields** step. Each mapping specifies where the value comes from (a static value or an attribute of the Finding/Test/Engagement/Asset), the Jira field to set, and an **application point** that controls *when* the field is sent — on ticket creation, on every update, or as part of a specific status transition (for example, sending a Jira `resolution` alongside the transition that closes the issue).
225+
226+
### How it works
227+
228+
- **Create / Update / Delete:** creating pushes a new issue and records the link on the Finding; updating edits the existing issue; deleting a Finding force-closes its issue (nothing is deleted in Jira). Pushes can be manual ("Push to Integrators") or automatic per the Issue Tracker Assignment.
229+
- **Status reconciliation:** after creating (and on every update) DefectDojo reads the issue's current status and, if it differs from the mapped target, finds a single workflow transition that reaches it and applies it. If no such transition exists, the mapping records an error rather than failing silently. Any transition-scoped custom fields are sent with that transition.
230+
- **Ticket link:** the link surfaced on the Finding is `https://your-site.atlassian.net/browse/{ISSUE-KEY}` — always your public site URL, never the internal gateway.
231+
- **Token lifecycle (OAuth):** DefectDojo owns the whole flow — it performs the authorization-code exchange, stores the access and refresh tokens, and refreshes on demand before a push, persisting the new refresh token each time (Atlassian rotates it on every refresh).
232+
- **Credential storage:** all connection credentials (passwords, tokens, client secrets, OAuth tokens) are encrypted at rest and are never returned through the API — editing a connection shows a "leave blank to keep" placeholder for stored secrets.
233+
128234
## ServiceNow
129235

130236
The ServiceNow Integration allows you to push DefectDojo Findings as ServiceNow Incidents.

0 commit comments

Comments
 (0)