Skip to content

Commit bae8381

Browse files
msukkariclaude
andcommitted
refactor: group CodeQL alerts by rule into single Linear issues
Multiple CodeQL alerts with the same rule ID (e.g., js/path-injection in different files) are now grouped into one finding with all locations and details included in the description. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f2d1985 commit bae8381

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

.github/workflows/trivy-vulnerability-triage.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ jobs:
341341
fi
342342
343343
EXTRACTED=$(echo "$BODY" | jq '[.[] | {
344-
id: ("codeql:" + (.rule.id // "") + "#" + ((.number // 0) | tostring)),
344+
id: ("codeql:" + (.rule.id // "")),
345345
number: .number,
346346
rule_id: (.rule.id // ""),
347347
rule_description: (.rule.description // ""),
@@ -402,7 +402,7 @@ jobs:
402402
403403
1. **Trivy scan results** in `trivy-alerts.json` — each entry has `id` (CVE ID, e.g., `CVE-2024-1234`)
404404
2. **Dependabot alerts** in `dependabot-alerts.json` — each entry has `id` (CVE ID or GHSA ID)
405-
3. **CodeQL alerts** in `codeql-alerts.json` — each entry has `id` (prefixed, e.g., `codeql:js/sql-injection#33`)
405+
3. **CodeQL alerts** in `codeql-alerts.json` — each entry has `id` (prefixed, e.g., `codeql:js/sql-injection`). Multiple entries may share the same `id` (same rule, different locations).
406406
407407
## Your Task
408408
@@ -419,19 +419,20 @@ jobs:
419419
- Include the affected package, severity, remediation steps, and whether it is direct or transitive.
420420
421421
4. For **CodeQL findings**:
422-
- Each CodeQL alert is a **separate finding** — do NOT group alerts by rule ID. Two alerts with the
423-
same rule but different files/locations must be separate entries.
424-
- Use the `id` field as `cveId` (e.g., `codeql:js/path-injection#18`).
422+
- **Group all alerts with the same `id` (rule ID) into a single entry.** Multiple alerts for
423+
the same rule in different files/locations should produce ONE finding, not separate ones.
424+
- Use the `id` field as `cveId` (e.g., `codeql:js/path-injection`).
425425
- Set `source` to `"codeql"`.
426-
- Set `affectedPackage` to the file path from `location_path`.
426+
- Set `affectedPackage` to a comma-separated list of affected file paths, or the primary one
427+
if there are many.
427428
- Normalize `security_severity_level` to uppercase (CRITICAL/HIGH/MEDIUM/LOW).
428-
- The `description` should include:
429+
- The `description` MUST include details for **every alert instance** in the group:
429430
- The rule ID and what it detects
430-
- The exact file path and line number(s) from the alert
431-
- A link to the alert URL (`html_url`)
432-
- An explanation of the specific code at that location and why it's flagged
431+
- For **each** alert: the exact file path, line number(s), and a link to its alert URL (`html_url`)
432+
- For **each** alert: an explanation of the specific code at that location and why it's flagged
433433
- Concrete remediation steps with code examples where possible
434434
- A link to the CodeQL rule documentation
435+
- A summary count (e.g., "This rule was triggered in 3 locations:")
435436
436437
5. For each finding, determine:
437438
- A short `title` suitable for a Linear issue title.

0 commit comments

Comments
 (0)