Designing a Security and Compliance Scanning Strategy
This lesson explains the main types of scanning, and where to place them.
Learning outcomes
After completing this lesson, you will be able to:
- Distinguish code, dependency, secret and licence scanning.
- Place scans in the delivery path.
- Explain why scheduled scans are needed.
- Plan a gradual rollout.
Types of scanning
Code scanning
Static application security testing (SAST) analyses source code for flaws such as SQL injection, without running it. CodeQL treats code as data and queries it for vulnerable patterns. Because it sees the source, it can point to the exact line, and it can run early. It may raise false positives, and it cannot find problems that appear only at run time.
Dependency scanning
Software composition analysis (SCA) lists the open-source components that an application uses, directly and transitively, and compares them with vulnerability databases. Most application code is third-party code, so this covers a large share of risk. Dependabot and GitHub Advanced Security dependency scanning do this.
Secret scanning
Secret scanning searches content and history for credentials that match known patterns. Finding a secret after it is committed requires rotation, so push protection goes a step further, and it blocks the push.
Licence scanning
Licence scanning identifies the licence of each dependency, so that legal policy can be applied. Some copyleft licences may not suit proprietary products. Dependency review in GitHub can fail a pull request that adds a package with a disallowed licence.
Other scanning
Container scanning examines image layers for vulnerable packages, and IaC scanning finds insecure settings in templates, such as a publicly accessible storage account. Dynamic application security testing (DAST) probes a running application from outside.
Which kind of scan finds it?
Placing scans in the pipeline
A scan helps most when its results reach the developer who can act, while the change is still fresh. The following table shows a typical placement.
| Point | Scan | Effect |
|---|---|---|
| Editor and pre-commit | Linters, local secret checks | Immediate warning |
| Push | Push protection | Blocks known secrets |
| Pull request | Code scanning, dependency review, IaC checks | Blocks new high-severity findings |
| Main branch build | Full dependency and container scans | Blocks the artifact |
| Before production | DAST and image policy checks | Blocks the release |
| Scheduled | Full code and dependency rescans | Finds newly disclosed vulnerabilities |
| Runtime | Defender for Cloud and registry scans | Monitors what is deployed |
Scheduled scans are essential. A library that was safe when it was deployed may have a vulnerability disclosed six months later, and a code change is not needed for the risk to appear.
The following diagram shows where dependency review blocks a risky change in a pull request.

Where each scan belongs
Rolling out without blocking delivery
Turning on all scanners in blocking mode generally produces thousands of old findings, and teams quickly ask for it to be turned off. A gradual approach works better.
-
Inventory
Enable scanning in report-only mode, and measure the baseline.
-
Stop the bleeding
Block new high-severity findings on pull requests.
-
Burn down
Fix existing findings by severity, with time set aside.
-
Tighten
Lower the severity threshold over time.
Triage matters too. A finding can be a true problem, a false positive, or a real problem with low risk in context, so a process for dismissing findings with a reason is required. Software bills of materials (SBOMs) record what an artifact contains, which makes it possible to answer quickly whether a new vulnerability affects you.
Rolling out scanning
Matching a scan to a need
A company's legal team must block any pull request that adds a dependency under a licence that it has not approved. Security also wants to prevent vulnerable versions from being added. The code is on GitHub. What should you configure?
Use dependency review with the dependency-review action, as a required status check. It can fail on chosen vulnerability severities, and on licences outside an allow list, at the point when a dependency changes. Code scanning looks for flaws in your own code, and not licences. Dependabot alerts report on existing dependencies after the fact, rather than blocking additions.
Why run a dependency scan on a schedule if no code has changed?
Show answer
New vulnerabilities are disclosed in existing packages, so a safe dependency can become unsafe.
Exam Tips
Remember for the exam
- SAST reads code; SCA reads dependencies; DAST probes a running app.
- Run scheduled scans, as new vulnerabilities appear with no code change.
- Begin in report-only mode, then block new high-severity findings.
- Dependency review can block vulnerable or disallowed-licence packages.
- An SBOM shows what an artifact contains.