0%
Security Engineering for Software Teams
Thinking About Security
Cryptography You Will Actually Use
Identity
Vulnerability Classes
Infrastructure and Cloud
Detection and Response
Dependencies and SBOMs
Modern applications are mostly made of code written by other people. A typical service imports dozens of libraries directly, and those libraries import hundreds more. This code runs with the same privileges as the application, handles the same data and ships in the same artifact. When a dependency has a vulnerability or is deliberately compromised, every application that uses it is affected. This section explains the scale of dependency risk and why it is hard to manage.
How much code is borrowed
In a typical web service, the code the team writes is a small fraction of what runs in production. Frameworks, database drivers, serialisation libraries, logging, HTTP clients and their own dependencies make up the bulk. Studies of application inventories regularly find that open source components account for most of the code in a deployed artifact. This is a great productivity benefit, but it means most of the attack surface was written by people the team has never met.
Direct and transitive dependencies
Direct dependencies are the packages a team lists in its manifest. Transitive dependencies are the packages those packages depend on, and so on down the tree. Teams usually review direct dependencies when adding them, but transitive ones arrive silently and can change whenever a direct dependency is updated. Most vulnerabilities found in applications sit in transitive dependencies that nobody on the team knew were there.
Version ranges and resolution
Package managers resolve version ranges into specific versions at install time. A manifest that allows any compatible minor version may install a different version tomorrow than it did today. Without a lock file that pins exact versions and hashes, two builds of the same commit can contain different code. Lock files make builds reproducible and make dependency changes visible in code review.
Known vulnerabilities
Vulnerabilities in open source packages are published in public databases with identifiers, affected version ranges and severity scores. Once published, attackers can search for applications using affected versions. Widely used libraries with critical vulnerabilities, such as remote code execution in a logging or parsing library, have caused industry wide emergencies because they appear in thousands of applications, often deep in the dependency tree.
Abandoned and unmaintained packages
Many packages are maintained by one or two volunteers. Some are abandoned, receiving no fixes even when vulnerabilities are reported. An application depending on an abandoned package cannot get a fix by updating and must replace, fork or patch the component itself. Maintenance health, such as recent releases, responsiveness to issues and the number of maintainers, is part of dependency risk.
Malicious packages
Beyond accidental vulnerabilities, attackers publish malicious packages or compromise legitimate ones. Techniques include typosquatting names similar to popular packages, publishing internal package names to public registries and taking over maintainer accounts. Malicious code often runs at install time, stealing credentials from developer machines or build systems before the application ever runs.
Why updating is hard
Keeping dependencies current sounds simple but is hard in practice. Updates can break APIs, change behaviour or require updating other dependencies at the same time. Teams under delivery pressure postpone updates, and the gap grows until a security fix requires a large, risky upgrade across several major versions. Small, frequent updates are far cheaper than rare large ones.
Hidden dependencies
Not all dependencies appear in manifests. Code copied from other projects, binaries checked into repositories, packages installed in base images, tools downloaded by build scripts and libraries bundled inside other libraries all add code that manifest based scanners may miss. These hidden components often surface only during incident response.
Runtime and build time dependencies
Some dependencies are needed only at build time, such as compilers, test frameworks and code generators. Others ship in the runtime artifact. Build time dependencies still matter, because a compromised build tool can inject code into the artifact. Runtime dependencies matter more for exposure to attacker input. Distinguishing the two helps prioritise.
Language ecosystems differ
Ecosystems vary in how they handle dependencies. Some encourage many small packages, leading to deep trees with thousands of components. Others favour larger standard libraries and fewer dependencies. Some package managers run install scripts by default, while others do not. Understanding the habits of each ecosystem in use helps teams set appropriate controls.
Licences as a related risk
Dependencies also carry licences that impose obligations, such as attribution or releasing source code. Licence compliance is not a security issue in itself, but it uses the same inventory, so dependency programmes often handle both. Knowing exactly which components and versions are in each artifact supports both vulnerability response and licence review.
The cost of not knowing
When a critical vulnerability is announced in a widely used library, the first question is whether the organisation is affected, and where. Organisations without an accurate inventory spend days or weeks searching repositories, images and servers by hand. Those with good inventories answer in minutes and focus on fixing. The difference often decides whether attackers exploit the flaw first.
Shared responsibility for open source
Open source maintainers provide code for free, often without funding or security resources. Consumers benefit enormously and share responsibility for the health of what they use: reporting issues, contributing fixes, funding critical projects and choosing well maintained components. Treating open source as a free, perfectly maintained supply is unrealistic.
Dependencies as trust decisions
Every dependency is a trust decision. Adding a library means trusting its current maintainers, its future maintainers, the registry that hosts it, the accounts used to publish it and every dependency it brings along. Most of these trust decisions are made implicitly, by one developer in one pull request, with little visibility. Making the decision explicit for direct dependencies, with a short checklist, and making the transitive consequences visible through tooling turns an invisible choice into a deliberate one. This does not mean refusing to use open source. It means knowing what is being trusted and why.
Container images add another layer
Container images bundle an operating system userland with the application. A base image can contain hundreds of packages, such as shells, compression libraries, certificate bundles and package managers, most of which the application never uses. These packages carry their own vulnerabilities and are often the largest source of scanner findings. Minimal or distroless base images, which include only what the application needs to run, reduce this layer dramatically. Rebuilding images regularly, even when application code has not changed, picks up fixed versions of base packages.
The speed of exploitation
The time between public disclosure of a vulnerability and attempts to exploit it has shrunk. For widely used components, attackers often begin scanning for vulnerable systems within hours, sometimes before patches are widely available. Proof of concept code appears quickly and is incorporated into automated attack tools. This compresses the window in which defenders can find and fix affected systems. Organisations that need days just to determine where a component is used start every emergency already behind. Fast inventory and fast deployment pipelines are therefore security capabilities, not only engineering conveniences.
Dependency risk is uneven
Not all dependencies carry equal risk. A library that parses untrusted input from the internet, such as a file format parser, template engine or deserialisation library, is far more exposed than one that formats log timestamps. Libraries with native code, broad system access or install scripts add further risk. Concentrating review effort, update urgency and testing on the small set of high exposure dependencies gives better results than treating every package the same. Teams can maintain a short list of critical dependencies per service and watch them closely.
Applications contain far more third party code than first party code, and most of it arrives transitively. Known vulnerabilities, abandoned packages, malicious packages and hidden components all create risk. Lock files, small frequent updates and an accurate inventory are the foundations of managing it.