Use dependency risk arithmetic without inventing independence
Compare union bounds and independent-event models while preserving shared identities, common causes, and execution context.
On this page
The question for today
What you’ll understand
- Define the adverse event and relevant dependency identities before counting.
- Distinguish an independence calculation from a general union bound.
- Explain why exposure and impact cannot be reduced to dependency count alone.
A service imports twenty packages directly and hundreds transitively. Multiplying an assumed per-package risk can make the graph look precise, but shared maintainers, common build systems, and one registry incident can correlate failures. A useful model states what event is being counted and which probabilities are assumptions. The arithmetic should help inspect a decision, not turn unknown adversarial behavior into a measured probability simply because a spreadsheet can multiply numbers.
Define an event and a graph boundary
An adverse dependency event might mean a known exploitable defect in the deployed path, unauthorized bytes entering a build, or a compromised package script executing during installation. These are different events with different conditions and consequences. A vulnerability identifier in a package does not alone establish reachable exploitation in one deployment, while absence of a known identifier does not prove safety. Specify package-version-artifact identities, target, execution phase, privileges, and the time period considered before assigning any probability or priority to the graph.
Deduplicate shared identities when counting components, but retain their edges and contexts. One parser used by ten services is one component identity with a broad impact path, not ten independent chances of that same component being compromised. Conversely, two versions or platform artifacts can need separate analysis. Build-time tools matter even if absent from the runtime image: a compromised generator can affect produced code. A small direct manifest can therefore conceal a substantial transitive input set. Closure and influence evidence help locate relevant surfaces; they do not establish that every component has the same likelihood or impact.
Independence is an extra assumption
If adverse events are independent with a common probability p, the chance of at least one is one minus the chance that all are absent. This familiar expression can illustrate accumulation but should not be applied to a real supply chain merely because the components have different names. Shared publisher credentials, source hosts, compiler images, or update automation introduce common causes. An adversary may also choose targets based on their influence, violating a uniform random-event picture. Record hypothetical values as hypothetical; do not label the resulting percentage a measured security posture.
Expected counts and probability of any event are also different quantities. Linearity of expectation permits adding event probabilities for an expected number without requiring independence, but that does not determine how events cluster or the impact of one. Two graph designs can share the same expected count while one has a single common failure capable of affecting every output. Use the model to ask which shared dependencies or authorities dominate the recovery problem. Combine inventory and exposure evidence with control effectiveness, rather than optimizing solely for a smaller component count.
Use the model to choose evidence and containment
Review the permissions and effects of the build and runtime contexts. A package limited to an isolated transformation differs from a script holding release credentials. Separate input approval, build isolation, artifact verification, and deployment policy because they constrain different paths. A control can reduce one modeled event while leaving a common compromised builder untouched. Check downstream artifact bindings and recovery procedures so a detected problem can be scoped and replaced. Numerical ranking can support prioritization, but its assumptions and uncertainty belong beside the number, especially when component identities and known advisories are incomplete.
The probability lab displays the independent equal-p model exactly. For each separate view, Reset, set both p=0.01 and n to 10 or 30, predict the zero-event bar, then inspect. Interpret the complement as the model's chance of at least one adverse event. No compromises are sampled and no package is analyzed. Shared-source or shared-builder failures can invalidate the independence interpretation, so the diagram is useful as a conditional calculation rather than proof that a particular dependency graph has the displayed risk.
Work it through
Compare a fictional product model with its union bound
For arithmetic only, suppose 20 distinct dependency events are independent and each has probability 0.001 during one specified release period. These invented probabilities are not measurements of any package or product.
The chance of no event in the stated independent model is 0.999²⁰≈0.9801889.
Its complement is approximately 0.0198111, or 1.9811%, for at least one event. The expected event count is 20×0.001=0.02.
Without independence, the same marginal probabilities still give a union bound of at most 0.02, or 2%, capped by 1. Neither result supplies real probabilities or describes the impact of a common builder compromise.
The independent model yields about 1.9811%, while the general union bound gives at most 2% for those supplied marginals. The assumptions are part of both claims.
The living notebook
Explore the model
Interactive lab · probability
Inspect a conditional accumulation model
For each view: Reset, set both p=0.01 and n, predict the zero-event bar, then inspect. Compare n=10 and n=30. These exact binomial bars assume independent equal-probability indicators, not observed package compromises or a supply-chain scanner.
- Mean · np
- 5
- Variance · np(1−p)
- 2.5
- Total probability
- 1
These are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forThe complement of the zero bar describes at least one event only within this hypothetical model. Shared authorities and build infrastructure can create dependencies the model omits.
Pause & reason
Check your understanding
Your turn
Try it yourself
Four explicitly defined events each have marginal probability 0.02 in a hypothetical period. What upper bound follows for at least one event without independence? Can you infer their impact from that bound?
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Add marginals for the union bound and keep event frequency separate from consequences.
Compare with the solution
The union bound is at most 0.08, or 8%. It may be loose and does not determine clustering or impact; those depend on relationships and the effects each event can produce.
Keep the idea
Take it with you
- Risk arithmetic requires defined events, identities, contexts, and time scope.
- The union bound and an independent product calculation make different assumptions.
- Common causes and effect privileges matter beyond raw dependency counts.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.