Skip to content

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

Draft
kasia-kittel with Copilot wants to merge 2 commits into
wipfrom
copilot/update-query-count-situations
Draft

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

Conversation

CopilotAI commented Feb 25, 2026

Copy link
Copy Markdown

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>
CopilotAI changed the title [WIP] Change query to return count for malicious and reachable vulnerabilitiesAdd security-query.sql returning count of malicious and reachable vulnerability situationsFeb 25, 2026
Sign up for freeto 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

@kasia-kittel