Distributed systems and security · Part 33 of 36
Secure development and the supply chain (2024–2026)
Expert 20 min
SBOMs, dependency hygiene, secrets, passkeys, CSP and what the EU Cyber Resilience Act requires from software makers and when.
What you will learn
- You can set up basic supply-chain hygiene for a project.
- You can explain passkeys and why they resist phishing.
- You can state the key Cyber Resilience Act dates and obligations.
Before this: Web security: the OWASP Top 10:2025
Your code is mostly other people's code
A typical web project pulls in hundreds or thousands of packages, most of them indirectly. Each is code you run with full permissions. Attackers know this: typosquatted package names, hijacked maintainer accounts, malicious "postinstall" scripts and long-game backdoors such as the one discovered in XZ Utils in March 2024, inserted after years of building trust as a maintainer.

Supply-chain hygiene
- Fewer dependencies. Every package must earn its place. Ten lines of your own code can beat a dependency with its own dependency tree.
- Lock files (
package-lock.json,uv.lock/poetry.lock) pin exact versions and hashes; CI installs exactly those (npm ci). - Review updates instead of auto-merging them, and delay brand-new versions for a few days — many malicious releases are detected within hours.
- Disable install scripts where you can, and run builds with least privilege.
- SBOM (software bill of materials, in CycloneDX or SPDX format) lists every component and version, so you can answer "are we affected?" within minutes when a vulnerability is announced.
- Provenance and signing: frameworks such as SLSA describe how to prove where an artefact was built; npm and PyPI support provenance attestations and Sigstore-based signing.
- Monitor advisories (OSV, GitHub advisories, national databases) and patch promptly.
Secrets
Never put API keys, passwords or tokens in source code or logs. Use environment variables or a secrets manager, scan commits for secrets (pre-commit hooks, CI scanners), and rotate any secret that leaked — deleting the commit is not enough, because clones and caches keep it.
Passkeys
Passkeys are FIDO2/WebAuthn credentials: a key pair per website, the private key kept in your device or password manager and unlocked by fingerprint, face or PIN. The browser binds each passkey to the site's domain, so a phishing page on a look-alike domain simply cannot use it — unlike passwords and one-time codes, which users can be tricked into typing. Major platforms have supported passkeys since 2022–2023, and they are increasingly the default sign-in for big services.
Defence in depth in the browser
A strict Content-Security-Policy (e.g. script-src 'self', no inline scripts, no eval) stops most XSS from running even when an injection bug slips through. Add Strict-Transport-Security, frame-ancestors against clickjacking, cookies with Secure; HttpOnly; SameSite. This site itself runs with such a CSP — which is why the sandbox in these lessons uses a Web Worker instead of eval.
The EU Cyber Resilience Act
The Cyber Resilience Act (CRA), Regulation (EU) 2024/2847, entered into force on 10 December 2024. It applies to "products with digital elements" sold in the EU — software and connected hardware:
- From 11 September 2026, manufacturers must report actively exploited vulnerabilities and severe incidents to their CSIRT and ENISA (early warning within 24 hours).
- From 11 December 2027, the main requirements apply: security by design and by default, vulnerability handling, security updates for the support period, SBOM-style documentation and CE marking.
- Free and open-source software developed outside a commercial activity is largely exempt; "open-source stewards" (e.g. foundations) have lighter duties.
In the USA, the NIST SSDF (SP 800-218) plays a similar role for software sold to federal agencies. Whatever the jurisdiction, the practices are the same ones you've just read about. (This is an overview, not legal advice.)
Key points
- Most code you run is dependencies; attackers target them (typosquatting, hijacked accounts, XZ Utils 2024).
- Fewer deps, lock files, reviewed updates, SBOMs, provenance and advisory monitoring.
- Keep secrets out of code and logs; rotate leaked ones.
- Passkeys (WebAuthn) are domain-bound and resist phishing.
- CRA: in force 10 Dec 2024; vulnerability reporting from 11 Sep 2026; main obligations from 11 Dec 2027.
Flashcards
- Question: What is an SBOM?
- Answer: A software bill of materials: a list of all components and versions in a product.
- Question: Why can a phishing site not use your passkey?
- Answer: The passkey is bound to the real site’s domain by the browser.
- Question: What should you do when a secret was committed?
- Answer: Rotate (revoke and replace) it — deleting the commit is not enough.
- Question: From when does the CRA require reporting of actively exploited vulnerabilities?
- Answer: From 11 September 2026.
Check yourself
Think about your answer, then open it. In the app the quiz is interactive, earns points and brings back what you missed.
Match the CRA milestone with its date.
Show the answer
Entry into force = 10 December 2024; Reporting obligations apply = 11 September 2026; Main obligations apply = 11 December 2027
Dates from Regulation (EU) 2024/2847.
Source: Regulation (EU) 2024/2847
Why do passkeys resist phishing?
- They are bound to the website’s domain
- They are longer than passwords
- They change every 30 seconds
- They are stored on the server
Show the answer
They are bound to the website’s domain
WebAuthn credentials are scoped to the relying party’s domain.
Source: W3C WebAuthn Level 3
Which practices reduce supply-chain risk?
- Using lock files and npm ci
- Generating an SBOM
- Auto-merging every new dependency version immediately
- Reviewing and limiting dependencies
Show the answer
Using lock files and npm ci; Generating an SBOM; Reviewing and limiting dependencies
Immediate auto-merging gives malicious releases a direct path in.
Source: NIST SP 800-218 / SLSA
An API key was pushed to a public repository an hour ago. What is the most important step?
- Revoke and replace the key
- Delete the commit
- Make the repository private
- Add the file to .gitignore
Show the answer
Revoke and replace the key
Assume the key is compromised; only rotation makes it useless.
Source: OWASP Secrets Management Cheat Sheet
Sources
- NIST SP 800-218 Secure Software Development Framework (SSDF) 1.1, NIST, 2022
- Regulation (EU) 2024/2847 Cyber Resilience Act, EUR-Lex, 2024
- Web Authentication Level 3 (WebAuthn), W3C, 2025
- SLSA (Supply-chain Levels for Software Artifacts) v1.1, OpenSSF, 2025
Facts checked on 2026-11-30. Skillgrove lessons are free learning material — no certificate and no accreditation.