feat(api): track Jira issues per finding and skip already-ticketed findings

New RLS table jira_issues keyed on (integration, provider, finding uid) that
stores the Jira issue key, URL and last observed status for every finding
sent to Jira. send_findings_to_jira() pre-checks the batch in bounded
chunks, refreshes the status of linked issues in bulk, skips findings whose
issue is still open (reported as skipped_count / skipped), creates a
replacement issue when the linked one is closed or deleted in Jira, and
reserves the slot before calling Jira so concurrent runs cannot duplicate.
Read-only GET /api/v1/jira-issues exposes the links with provider-scoped
visibility. Rows are removed with the provider.
This commit is contained in:
Daniel Barranquero committed 2026-08-25 16:58:40 +02:00
1 parent 53be73c2ac
commit 8097b8e012
18 files changed
+1741 -61

No files matched your search

@@ -134,6 +134,15 @@ Every Jira issue created from a single Finding carries a stable reference back t
Prowler Cloud always includes the Finding URL. In a self-hosted Prowler App, set `DJANGO_UI_BASE_URL` in the API environment (for example, `https://prowler.example.com`) to enable it. When the variable is empty, the issue is created without the link.
### Sending a Finding That Already Has a Jira Issue
Prowler remembers the Jira issue created for each Finding, keyed by the Finding UID, so sending the same Finding again does not create a duplicate issue:
* If the linked issue is still open in Jira, the Finding is skipped and the existing issue key is reported in the task result (`skipped_count`, `skipped`).
* If the linked issue is closed (any Jira status in the **Done** category) or was deleted, a new issue is created and becomes the linked issue for that Finding.
The link, and the last status observed in Jira, are available through the API at `GET /api/v1/jira-issues` (filter by `finding_uid`, `finding_uid__in`, `provider_id`, `integration` or `issue_key`). Each Jira integration keeps its own links, so the same Finding can have one issue per integration.
## Integration Status
Monitor and manage your Jira integrations through the management interface: