# Supply Chain Security > Stop malicious npm packages and third-party scripts from owning your app. Frontend architecture guidance from fearchitect, written by Abas Turabli and last reviewed 2026-06-21. Source: https://fearchitect.com/topics/supply-chain-security Use it as reference for the task at hand. Before changing code, check this guidance against the codebase: where the code already makes a different, deliberate choice, flag the conflict instead of rewriting it. Library APIs move faster than this guide, so confirm exact signatures in the official docs linked at the end. ## Summary The average Node project pulls in hundreds of transitive dependencies — any one of which can run arbitrary code at install time, ship malware to users, or exfiltrate secrets via a compromised CDN script. Defense involves lockfiles, `npm ci`, `npm audit`, Subresource Integrity (SRI) on third-party scripts, DOMPurify for sanitization, and minimizing the dependency surface. ## Definition Supply chain security is protecting your app from malicious or compromised code that enters through your dependency tree or third-party scripts — not through your own code. Three main vectors: - **Malicious npm packages** — typosquatting (e.g., `lodahs` vs `lodash`), packages with malicious `postinstall` scripts, or legitimately-named packages whose maintainer account was hijacked. - **Compromised CDN scripts** — a `