Metrics and Queries for Security
This lesson explains how to measure exposure and response, and where each platform reports it.
Learning outcomes
After completing this lesson, you will be able to:
- Identify meaningful security measures.
- Explain why alert counts need coverage data.
- Identify where security data is reported.
- Distinguish a report from a security gate.
Measuring exposure and response
A raw count of alerts is a weak measure on its own, because it rises when scanning improves. The useful questions are how serious the findings are, how long they stay open, and how much of the estate is being scanned at all.
Open alerts by severity and age
Grouping alerts by severity shows what needs attention, and alert age shows whether the team is keeping up. A critical alert that has been open for 200 days is more informative than a total count.
Mean time to remediate
Mean time to remediate (MTTR, in a security context) measures the time from when a finding is detected until it is fixed. Organizations often set targets by severity, for example seven days for critical vulnerabilities, and report the percentage of findings fixed within target.
Coverage
Scanning coverage is the share of repositories with code, secret and dependency scanning enabled. A repository that is not scanned reports zero alerts, so a low alert count means little without this measure.
Prevention
Prevention measures show issues stopped before they arrived, such as secrets blocked by push protection and vulnerable dependencies blocked by dependency review. Rising prevention with falling new alerts shows that security has shifted left. It is also useful to record bypasses, which show when people override a control.
The following diagram compares a security dashboard whose open-vulnerability count misled before and after the change.

Security measures worth reporting
Where the data is found
The following table shows where each platform reports security data.
| Tool | What it shows |
|---|---|
| GitHub security overview | Alerts and scanner enablement across an organization's repositories, with trends |
| Repository Security tab | Code scanning, secret scanning and Dependabot alerts |
| Azure DevOps Advanced Security overview | Alerts by repository, and enablement across an organization |
| Microsoft Defender for Cloud DevOps security | Findings across Azure DevOps, GitHub and GitLab in one place |
| GitHub REST API and Azure DevOps Advanced Security APIs | Alert data for custom reports |
Security metrics should also be built into pipelines as gates. For example, the AdvancedSecurity/NewHighAndCritical status check in Azure Repos can block pull requests that introduce high or critical alerts. This is a stronger control than a report, as the lesson on quality gates explains.
Choosing the security view
A misleading trend
A chief information security officer reports a 40% fall in open vulnerabilities this quarter. You discover that 60 repositories were archived from scanning during a platform migration, and that the mean age of critical alerts has risen. How should the dashboard change?
The dashboard should show scanning coverage beside the alert count, because the fall partly results from less scanning. It should also show alert age or mean time to remediate by severity, which reveal that response has become slower. Showing only the count created a false sense of progress.
Why should scanning coverage appear beside alert counts?
Show answer
A repository that is not scanned reports no alerts, so a low count could simply mean less scanning.
Exam Tips
Remember for the exam
- A low alert count means little without scanning coverage.
- Track time to remediate by severity.
- Security overview summarizes alerts across a GitHub organization.
- Defender for Cloud gives one view across DevOps platforms.
- A status check on new high and critical alerts is stronger than a report.