Two complementary scanners belong in every secure pipeline. Static Application Security Testing, or SAST, analyses your own source code for insecure patterns such as SQL injection or unsafe deserialisation. Software Composition Analysis, or SCA, inspects the third-party dependencies you pull in, matching them against databases of known vulnerabilities. Together they cover both the code you wrote and the far larger body of code you inherited, and this lesson shows how to wire both into automated pipeline gates.
Analogy🏏Cricket
💪 Think of it like fitness: real strength needs two different kinds of training — you build your own muscles in the gym, but you also inspect the barbell, rack, and bench borrowed from the shared floor, because a cracked bar you did not forge can still drop the weight on you. SAST trains your own code, scanning the source you wrote for insecure patterns like SQL injection. SCA inspects the borrowed equipment, checking every third-party dependency against databases of known flaws. One without the other leaves half the risk untouched. This reveals security as covering both the code you built and the far larger body you inherited.
🏏 Showing the Cricket analogy — a Cricket version isn’t available for this concept yet.
SAST reads code without running it, tracing how untrusted data flows from an input to a dangerous operation. Because it needs no working environment, it can run early on every commit, giving developers fast feedback while the change is still fresh in mind. Its trade-off is false positives: it flags patterns that may be safe in context, so effective SAST depends on tuning rules and triaging findings rather than blindly failing every build on the first alert.
Analogy🏏Cricket
♟️ Think of it like chess: a strong player reads the board without moving a piece, tracing lines many moves ahead to see where an opponent's pawn could reach the king. SAST reads code the same way — statically, without executing it — following how untrusted data flows from an input to a dangerous operation. Because it needs no running environment, it can analyse every commit early, like calculating threats before touching a piece. Its cost is imagined threats that never materialise: false positives from lines that read dangerous yet are safe in context. This reveals SAST as foresight that must be triaged, not blindly obeyed on every alert.
🏏 Showing the Cricket analogy — a Cricket version isn’t available for this concept yet.
SCA takes a different angle, reading your dependency manifests and lock files to enumerate every library and version, then cross-referencing known vulnerability feeds. Since most application code today is inherited rather than written, SCA often surfaces the highest-impact issues, such as a critical flaw in a widely used framework. Pairing SCA with an SBOM, as covered in Module 1, lets a single disclosed vulnerability be traced instantly across every service in the organisation.
Analogy🏏Cricket
🍳 Think of it like cooking: before you plate anything you read every packaged ingredient's label and check it against the latest recall notices, because most of a modern dish is bought in rather than made from scratch, and one contaminated jar poisons the whole plate. SCA does this for software — it reads your dependency manifests and lock files to enumerate every library and version, then cross-references live vulnerability feeds. Since inherited code dwarfs what your team writes, SCA often surfaces the highest-impact flaws, like a critical hole in a popular framework. Paired with an SBOM, one recall traces across every dish you serve. This reveals dependencies as ingredients you must label and recall-check.
🏏 Showing the Cricket analogy — a Cricket version isn’t available for this concept yet.
bash
# SAST and SCA as blocking gates in CIsteps:-name:SAST(sourcecode)run:semgrepci--configauto# fails build on high-severity findings-name:SCA(dependencies)run:|syftdir:.-ocyclonedx-json>sbom.jsongrypesbom:sbom.json--fail-onhigh# blocks on known critical/high CVEs
Analogy🏏Cricket
⚽ Think of it like sports: a football club protects results on two fronts — a coach drills your own players' technique in training, while the medical staff inspect the boots, shin pads, and kit bought from outside suppliers for hidden defects. SAST is the coach, reviewing the source your team wrote for flawed technique. SCA is the medical staff, checking every inherited dependency for cracks. Flawless play collapses if a defective boot fails in the box; a flawless codebase collapses if it imports one dangerously vulnerable library. You need both fronts covered at once. This reveals SAST and SCA as complementary, never interchangeable, defences.
🏏 Showing the Cricket analogy — a Cricket version isn’t available for this concept yet.
Best practice runs both scanners on every commit but gates thoughtfully. Fail builds only on high-confidence, high-severity findings so developers keep trust in the pipeline, while lower findings are surfaced as warnings and tracked. Maintain a reviewed suppression list for accepted risks with expiry dates, tune SAST rules to your stack to cut noise, and treat the vulnerability database as living, rescanning existing artifacts as new disclosures arrive rather than only at build time.
Analogy🏏Cricket
💰 Think of it like finance: a good fraud team does not freeze every account that trips a rule — that would drive customers away — it blocks only high-confidence, high-value alerts, logs the rest for review, and keeps a documented list of accepted exceptions with expiry dates. Gate your scanners the same way: fail builds only on high-confidence, high-severity findings so developers keep trusting the pipeline, surface lower findings as tracked warnings, tune SAST rules to your stack, and maintain a reviewed suppression list. Treat the vulnerability database as living and rescan old artifacts as new disclosures land. This reveals a security gate as tuned risk management, not a blanket freeze.
🏏 Showing the Cricket analogy — a Cricket version isn’t available for this concept yet.
In the real world, a team might add SCA and immediately discover that a logging library buried three levels deep carries a remote-code-execution flaw. The gate blocks the release until the dependency is upgraded, preventing a vulnerable build from ever shipping. Meanwhile SAST catches a developer concatenating user input into a database query and flags it in the pull request, so the fix costs one comment rather than a post-launch breach investigation.
Analogy🏏Cricket
💼 Think of it like business: a diligent procurement team catches a defective part buried three tiers down the supply chain before it ships in your product, while your own quality inspector flags a worker splicing wires unsafely on the line before the unit leaves the floor. SCA plays procurement: it can discover that a logging library three levels deep carries a remote-code-execution flaw and block the release until it is upgraded. SAST plays the floor inspector: it catches a developer concatenating user input straight into a database query and flags it in the pull request. The fix costs one comment, not a post-launch breach. This reveals early gates as cheap insurance against expensive incidents.
🏏 Showing the Cricket analogy — a Cricket version isn’t available for this concept yet.
SAST scans your own source; SCA scans inherited third-party dependencies.
SAST runs without executing code, giving fast per-commit feedback but some false positives.
SCA cross-references dependency manifests against known-vulnerability feeds.
Gate builds only on high-confidence, high-severity findings to preserve developer trust.
Rescan existing artifacts as new vulnerabilities are disclosed, not only at build time.