Skip to content

Add security-query.sql returning count of malicious and reachable vulnerability situations#6

Draft
Copilot wants to merge 2 commits intowipfrom
copilot/update-query-count-situations
Draft

Add security-query.sql returning count of malicious and reachable vulnerability situations#6
Copilot wants to merge 2 commits intowipfrom
copilot/update-query-count-situations

Conversation

Copy link

Copilot AI commented Feb 25, 2026

The existing query returned individual vulnerability rows with a categorical reason label. The requirement is to instead return a count per situation type (malicious / reachable with high EPSS%).

Changes

  • New file security-query.sql — replaces the per-row result set with aggregated counts grouped by reason:
    • COUNT(*) AS count added to SELECT
    • GROUP BY reduced from 9 columns to just GROUP BY reason
    • QUALIFY clause removed (window function over project not meaningful when aggregating)
    • ORDER BY reason replaces ORDER BY LOWER(CVSS3_SEVERITY)
SELECT
  CASE WHEN MALICIOUS = true THEN 'Malicious code detected 🚩'
       WHEN REACHABILITY = 'REACHABLE' AND EPSS_PERCENTAGE >= 60 THEN 'Reachable vulnerability with high EPSS% 🔴'
  ELSE ''
  END as reason,
  COUNT(*) AS count
FROM (...)
WHERE ...
GROUP BY reason
ORDER BY reason;

Output shape is now 2 rows max — one per situation — each with its count for the filtered repo(s) and date range.


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: kasia-kittel <11980812+kasia-kittel@users.noreply.github.com>
Copilot AI changed the title [WIP] Change query to return count for malicious and reachable vulnerabilities Add security-query.sql returning count of malicious and reachable vulnerability situations Feb 25, 2026
Copilot AI requested a review from kasia-kittel February 25, 2026 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants