They should do both, but pipeline security usually deserves the earlier investment because it blocks malicious artefacts before they spread. Runtime detection remains essential because static review cannot prove behaviour in production. The right sequence is to stop obvious trust-path abuse, then add behavioural confirmation where execution risk remains.
Why the right order is usually pipeline security first
When an organisation is deciding what to fund first, pipeline security usually earns the earlier investment because it changes what gets released in the first place. If build, signing, dependency, and publishing paths are weak, a malicious artefact can reach many environments before runtime controls ever have a chance to see it. This is why supply-chain trust deserves attention alongside detection, not after it.
That does not mean runtime detection is secondary in importance. It means the first dollar often goes further when it reduces the chance that a compromised build or poisoned dependency can become a production incident. A disciplined pipeline gives you provenance, stronger trust boundaries, and fewer opportunities for attackers to turn CI/CD into a delivery channel.
Pipeline hardening is especially valuable when teams reuse tokens, trust unpinned actions, allow broad publish rights, or let secrets flow into jobs that do not need them. SLSA is a useful reference point for thinking about provenance and integrity because the central question is whether the artefact can be trusted before it is deployed.
Why runtime detection still matters after the pipeline is hardened
Even a strong pipeline cannot prove how software will behave once it is executing with live data, real permissions, and production dependencies. Runtime detection exists for the cases that static review cannot settle, such as unexpected network calls, process injection, privilege abuse, or a legitimate component behaving in an unsafe way after deployment. It is the behavioural backstop when preventive controls miss something.
This matters because modern compromise often unfolds after initial delivery. An artefact may pass checks but still trigger suspicious actions only in production, or a trusted component may be abused later through configuration drift, stolen credentials, or a newly discovered weakness. A detection strategy that only watches the build side will miss that phase entirely.
For defenders, the practical goal is not to choose one control family and ignore the other. It is to place preventive trust controls in front of release and behavioural controls around execution, so a failure in one layer does not become a silent compromise. MITRE D3FEND is useful here because it frames defensive measures by the attack behaviours they are meant to disrupt.
How to sequence investment without creating a false trade-off
The best sequence is usually to remove obvious trust-path abuse first, then build runtime confirmation where execution risk remains. In practice, that means hardening the pipeline enough that you can trust what reaches production, then using detection to answer the question the pipeline cannot answer: what is this workload doing once it is live?
A good prioritisation rule is simple. If the weakness can let an attacker change what gets shipped, it belongs in the first wave. If the risk is that approved software may still misbehave, get abused, or reveal compromise only after deployment, runtime detection belongs in the second wave. These are complementary controls, not interchangeable ones.
That sequence also keeps teams from overspending on alerting while leaving release paths porous. NIST SP 800-190 Container Security is a good reminder that image, registry, orchestrator, and runtime risks need different controls, while NIST SP 800-53 Rev 5 Security and Privacy Controls reinforces the value of combining integrity, access control, and audit coverage rather than relying on a single safeguard.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
SLSA, NIST SP 800-53 Rev 5 and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| SLSA | Supply-chain Levels for Software Artifacts | Pipeline trust and artefact integrity are central to the question. |
| Recommendation — Adopt provenance checks before release and require trusted build lineage for deployable artefacts. | ||
| NIST SP 800-53 Rev 5 | SI-7 — Software, Firmware, and Information Integrity | The question turns on preventing malicious artefacts from entering production. |
| AU-6 — Audit Record Review, Analysis, and Reporting | Runtime detection depends on reviewing execution evidence and suspicious events. | |
| AC-6 — Least Privilege | Both pipeline and runtime risk are reduced when release paths and workloads have minimal privilege. | |
| Recommendation — Verify release integrity before deployment and reject artefacts that cannot be trusted. Correlate production telemetry and review anomalies quickly enough to confirm unsafe behaviour. Limit build, publish, and runtime permissions to the smallest necessary set. | ||
| NIST CSF 2.0 | PR.DS-08 — Integrity checks are performed on software, firmware, and information | This question is fundamentally about trusting what is shipped before execution. |
| Recommendation — Use integrity checks to stop altered artefacts before they reach production. | ||
Practitioner Guidance
What to prioritise: Put the first investment into controls that prevent untrusted code, dependencies, or release tokens from reaching production, because that reduces blast radius before you start tuning detection.
What to verify: Confirm that the pipeline has explicit trust boundaries for build signing, secret exposure, and publish permissions, then verify that runtime telemetry can still detect abnormal process, network, and privilege behaviour if something slips through.
Decision rule: If the control reduces the chance of a malicious artefact being deployed, fund it first; if it only tells you that a deployed artefact is already acting badly, treat it as a necessary second layer rather than the starting point.
What good looks like: Releases are only produced from controlled, attributable paths, and production monitoring can still surface suspicious execution even when the source artefact looked clean.
Practitioner takeaway: The mature posture is not pipeline security or runtime detection, it is a staged defence where release trust is tightened first and runtime visibility confirms that nothing unsafe escaped that gate.
Related resources from NHI Mgmt Group
- Should organisations prioritise runtime detection or pre-production controls first?
- Should organisations prioritise runtime protection or shift-left application security first?
- Should organisations prioritise CI/CD security or runtime cloud monitoring first?
- Should organisations prioritise IGA or identity security first?