SBOM, Dependency Risk and Secret Leaks
Software supply-chain security for defenders means knowing what you ship (SBOM), watching dependency risk (known CVEs, abandoned packages, typosquats), and stopping secret leaks (API keys in git, tokens in CI logs). SolarWinds and Log4Shell taught the industry that “our code is fine” is not enough when the library underneath is not.
Friends! npm install / pip install is convenient — but a dependency can hold a CVE. SBOM = the ingredient list of your software. Secret leak = AKIA key in a public GitHub commit — classic incident opener. Today defence pipeline: inventory, scan, block, rotate. No malicious package crafting / attack PoC. Own repos only.
मित्रांनो! npm install / pip install convenience – पण dependency मध्ये CVE असू शकते. SBOM = ingredient list तुमच्या software ची. Secret leak = AKIA key GitHub public commit – classic incident opener. आज defence pipeline: inventory, scan, block, rotate. Malicious package crafting / attack PoC नाही. Own repos only.
मित्रों! npm install / pip install convenience – लेकिन dependency में CVE हो सकता है. SBOM = ingredient list आपके software की. Secret leak = AKIA key GitHub public commit – classic incident opener. आज defence pipeline: inventory, scan, block, rotate. Malicious package crafting / attack PoC नहीं. Own repos only.
Quick answer
SBOM + dependency risk + secrets:
- Generate an SBOM for each release (CycloneDX or SPDX — pick one and stay consistent).
- Scan dependencies on every PR and on a schedule for new CVEs.
- Pin versions; review sudden major upgrades and unknown maintainers.
- Block merges on high/critical findings that have fixes — with a tracked exception process.
- Run secret scanning on pre-commit and on the remote (gitleaks / vendor secret scan).
- If a secret leaks: revoke first, then clean history, then post-mortem.
- Verify download integrity (checksums / signed artifacts) for critical tools.
Tiny mental model:
Code + deps → SBOM → CVE scan → secret scan → sign/attest → deploy
No inventory = cannot patch Log4Shell-class events quickly
Leaked key = assume abuse until revoked
What do I need before this guide?
- Vulnerability management — CVE / KEV.
- Optional: OWASP Top 10 (integrity / supply-chain themes).
- A toy git repo you own for practising scanners.
What is an SBOM and why care?
An SBOM lists components; scanners flag dependency CVEs and secret leaks before you ship.
SBOM components list करतो; scanners dependency CVEs आणि secret leaks ship करण्याआधी flag करतात.
SBOM components list करता है; scanners dependency CVEs और secret leaks ship करने से पहले flag करते हैं.
- SBOM — Software Bill of Materials: machine-readable list of components and versions in an artifact.
- SCA — Software Composition Analysis: tools that match those components to known vulnerabilities and licences.
- Pinning — lockfiles (
package-lock.json,Pipfile.lock,go.sum) so builds are reproducible. - Provenance / signing — prove which pipeline built the binary (advanced but growing baseline).
- Secret scanning — stop credentials from becoming public “dependencies” of your breach.
Educational warning: only scan and instrument repositories and images you own or are authorised to assess. No attacking package registries or other tenants.
Real incident: Log4Shell (2021) + SolarWinds (2020)
Two public lessons dominate beginner supply-chain talks:
- Log4Shell (CVE-2021-44228) — a library many teams did not realise they shipped became an internet fire drill; organisations with poor inventories took longest to answer “are we affected?”
- SolarWinds (2020) — a trusted update channel was weaponised; customers learned that vendor integrity and detection of odd software behaviour both matter.
Takeaways (vertical):
- What happened — dependency CVE at planetary scale; separate trusted-update compromise case.
- What went wrong (theme) — incomplete inventories; over-trust in upstream without verification layers.
- Care-take — SBOM + SCA so KEV/CVE questions get answers in hours.
- Care-take — vendor risk questionnaires are weak without technical controls (hash verify, least privilege for update agents).
- Care-take — CI secrets need the same rotation discipline as production keys.
- Bonus parallel — malicious typosquat packages regularly target popular language ecosystems — defend with careful install habits and allow-lists where possible.
Lockfiles, pins and “just install latest”
- Lockfiles record the exact tree you tested — commit them.
- “Latest” floating tags make yesterday’s green build mysteriously red (or quietly vulnerable).
- Renovate / Dependabot-style PRs are good when humans still review major bumps.
- For critical crypto / auth libraries, read changelogs before merging.
- Delete unused dependencies — every unused package is free attack surface and noise.
Red Team vs Blue Team (awareness only)
Red Team — what attackers try
- Compromise upstream libraries or build systems (high-level).
- Publish typosquat names near popular packages.
- Hunt public git history for still-valid cloud keys.
Blue Team — defend, detect, respond
- SBOM per artifact; continuous SCA.
- Protected branches; signed commits optional but useful.
- Mandatory secret scan; ephemeral CI OIDC to cloud.
- Runtime detection for odd child processes from admin tools (link to Sysmon / EDR guides).
- Patch SLAs for transitive dependencies — not only “our” code.
How do I build the pipeline step by step?
Step 1 — Inventory what you already ship
- List apps, languages, container base images.
- Ensure lockfiles are committed.
- Generate a first SBOM in lab (
syft,cdxgen, or ecosystem tooling — pick one documented path).
Step 2 — Scan dependencies
- Add SCA to PR checks (GitHub Dependabot / OSV-Scanner / commercial — org choice).
- Fail on fixable criticals for internet-facing apps.
- Track transitive deps — Log4Shell hid in nested trees.
Step 3 — Secret scanning
- Pre-commit hook on developer laptops for your org standard tool.
- Server-side scan on push; block on high confidence secrets.
- Educate:
.envnever committed; use secret managers. - Rotate any key that ever touched a public PR — do not argue “it was only 2 minutes”.
Step 4 — Harden installs and builds
- Prefer official registries; be suspicious of brand-new packages with almost no downloads.
- Pin base images by digest for production Dockerfiles when practical.
- Separate build roles from deploy roles (IAM least privilege).
- Keep package-manager cache hygiene on CI runners.
Step 5 — Respond when something explodes
- Query SBOM / SCA for the CVE ID across all services.
- Patch, rebuild, redeploy; verify versions.
- If a secret leaked: revoke → invalidate sessions → review cloud audit logs.
- Write the timeline; add a control so the same class cannot recur silently.
Step 6 — Talk to leadership in plain English
- “We can answer affected-or-not for critical CVEs within X hours.”
- “Secrets found public last quarter: N; median revoke time: Y.”
- Avoid fear slides without owners and dates.
Ravindra Bagale's Tip
💡 Students ignore npm audit because "the project is due". Then interviews ask Log4Shell inventory questions. Generating an SBOM once and showing it is strong. Putting secret scan in CI is stronger. If a key leaks, revoke first — rewrite git history later. Remember the order!
Ravindra Bagale's Tip – मराठी
💡 Students npm audit ignore करतात कारण "project due आहे". मग interview मध्ये Log4Shell inventory question येईल. SBOM एकदा generate करून दाखवणे = strong. Secret scan CI मध्ये लावणे = still stronger. Key leak झाला तर पहिला revoke – git history rewrite नंतर. क्रम लक्षात ठेवा!
Ravindra Bagale's Tip – हिंदी
💡 Students npm audit ignore करते हैं क्योंकि "project due है". फिर interview में Log4Shell inventory question आएगा. SBOM एक बार generate करके दिखाना = strong. Secret scan CI में लगाना = still stronger. Key leak हो तो पहले revoke – git history rewrite बाद में. क्रम याद रखो!
Care-take — supply chain without theatre
- One SBOM format per org; store next to the artifact.
- Exception register for unscannable legacy with expiry.
- Vendors: ask for their SBOM / vulnerability disclosure process.
- Open-source maintainers you rely on: track security advisories.
- Container registries: block
:latestin prod manifests. - Tabletop SolarWinds question: “how do we validate an update before wide deploy?”
- Keep a printed / wiki revoke checklist for the top five secret types you use (cloud, package registry, chatbot API, DB, webhook).
How do I fix common supply-chain mistakes?
Ghabru naka 😅 — these are the usual ones:
| Symptom | Likely cause | Fix |
|---|---|---|
| “Are we hit?” takes a week | No SBOM / inventory | Generate SBOM; map services |
| Audit noise ignored | No severity policy | Gate on fixable critical/high for prod paths |
| Key still valid after leak | Revoke delayed | Automate revoke runbook; practise |
| Lockfile absent | “Works on my machine” installs | Commit lockfiles; CI uses them |
| Base image 2 years old | No rebuild cadence | Scheduled rebuild + scan |
| Typosquat install | Manual mistype / malicious suggest | Careful names; private mirror allow-list |
Try it at home
On a private repo you own:
- Commit a lockfile for a tiny hello-world app.
- Generate an SBOM once; open it and find a component name you recognise.
- Enable a dependency alert feature on that private repo.
- Add a fake secret shaped like a key to a branch, confirm your scanner catches it, then remove and rotate the real key if you ever used one.
- Never push real production secrets “as a test”.
Learn it properly
Course lessons:
- Vulnerability, CVE, CWE and CVSS
- The rest — design, components, integrity, logging
- Protecting data — S3, encryption and secrets
- EC2 metadata, SSRF and a leaked key incident
- Reading results — false positives and prioritising
Related guides: CVE / KEV patching · Cloud IAM least privilege · OWASP Top 10 · Data breach response
Got it? SBOM = ingredient list; SCA = CVE risk; secret scan = key leak throttle. Log4Shell inventory pain + SolarWinds trust lesson. Pipeline: generate → scan → block/fix → revoke fast. No attack PoC — defender habits. Well done — batch 6a cyber guides complete.
समजलं का? SBOM = ingredient list; SCA = CVE risk; secret scan = key leak throttle. Log4Shell inventory pain + SolarWinds trust lesson. Pipeline: generate → scan → block/fix → revoke fast. Attack PoC नाही – defender habits. शाब्बास – batch 6a cyber guides complete.
समझ में आया? SBOM = ingredient list; SCA = CVE risk; secret scan = key leak throttle. Log4Shell inventory pain + SolarWinds trust lesson. Pipeline: generate → scan → block/fix → revoke fast. Attack PoC नहीं – defender habits. शाबाश – batch 6a cyber guides complete.
Frequently asked questions
What is an SBOM?
A Software Bill of Materials — a machine-readable inventory of components and versions you ship.
Why did Log4Shell hurt so many teams?
Transitive libraries were unknown; weak inventories delayed “are we affected?” answers.
What do I do if an API key hits GitHub?
Revoke/rotate immediately, review audit logs, then remediate history and add scanning.
Are lockfiles enough?
Necessary but not sufficient — you still need SCA, SBOM, and secret controls.
Is this about building malicious packages?
No. It is defensive inventory, scanning and revoke discipline on repos you control.
Where are deeper lessons?
Vulnerability management chapters, OWASP integrity themes and cloud secrets lessons.