What Is DevSecOps? Building a Practical CI/CD Security Pipeline
A developer opens a pull request that introduces a vulnerable dependency.
When should the team discover the problem?
During code review? After deployment? During next month's security assessment?
The earlier the team receives useful feedback, the easier it is to address the vulnerability while the change is still fresh.
That's one of the practical ideas behind DevSecOps.
What DevSecOps means in practice
DevSecOps integrates security into software development, delivery and operations.
Instead of treating security as a separate review at the end of development, teams introduce automated controls throughout the delivery process.
Developers resolve application findings. Platform engineers maintain the delivery controls. Security specialists define policy and help evaluate risks.
The responsibilities are shared, but ownership should remain clear.
Understanding the security gates
| Security control | What it examines |
|---|---|
| Secrets scanning | Accidentally exposed credentials |
| SAST | Potentially insecure source code |
| SCA | Vulnerable software dependencies |
| IaC scanning | Infrastructure configuration risks |
| Image scanning | Packages and vulnerabilities inside images |
| SBOM | Software component inventory |
| Artifact signing | Artifact authenticity and integrity |
| DAST | Security behavior of a running application |
| Runtime monitoring | Suspicious production activity |
These controls complement each other. Installing one scanner does not replace the others.
Start with secrets scanning
Credentials accidentally committed to a repository can remain accessible through Git history.
A tool such as Gitleaks can help detect them.
For an authorized local repository, an illustrative command is:
gitleaks git --redact .
Use a version that supports this CLI syntax.
If an active credential is discovered, revoke or rotate it before treating repository cleanup as the solution.
Removing a credential from Git history does not invalidate copies already obtained by someone else.
Static application security testing
SAST analyzes source code for potentially insecure patterns.
For example, Semgrep can run security rules against a repository:
semgrep scan --config auto .
This example assumes Semgrep is installed and the environment can retrieve the requested rules.
For CI enforcement, use reviewed rule configurations and explicit exit-code behavior.
Do not automatically treat every reported issue as a confirmed exploitable vulnerability.
Dependency scanning
An application may contain no obvious security defects in its own source code while depending on a vulnerable library.
Software Composition Analysis helps identify those risks.
A Trivy filesystem scan can examine supported dependency manifests:
trivy fs --scanners vuln \
--severity HIGH,CRITICAL \
--exit-code 1 .
This example fails when matching vulnerabilities are detected.
A real production policy should also consider exploitability, exposure, available fixes and approved exceptions.
Scan the container that will actually ship
Scanning dependency manifests is useful, but the finished container image may include additional operating system packages.
Build an illustrative local image:
docker build -t example-app:local .
Then scan it:
trivy image \
--scanners vuln \
--severity HIGH,CRITICAL \
--exit-code 1 \
example-app:local
These commands assume a valid Dockerfile, Docker Engine and Trivy.
Production pipelines should preserve the relationship between the scanned image and the artifact eventually deployed.
Using immutable image digests helps maintain that relationship.
Generate an SBOM
An SBOM records software components contained in an artifact.
For example:
syft example-app:local \
-o cyclonedx-json > sbom.cyclonedx.json
When a dependency vulnerability becomes public, an SBOM can help identify affected application versions.
However, generating an SBOM does not mean those components have been proven secure.
It provides inventory, not a security verdict.
Verify artifacts before deployment
Signing helps establish whether an artifact was signed by a trusted identity and has not been altered.
Verification should enforce the expected signer, identity and applicable trust policy.
For Kubernetes, combine artifact verification with workload admission controls.
Examples of useful workload policies include restricting privileged containers and requiring non-root execution where appropriate.
Don't forget the pipeline itself
Your CI/CD system also has credentials, permissions and external dependencies.
Review:
- Workflow write permissions.
- Third-party actions.
- Cloud authentication.
- Runner security.
- Build artifact access.
- Deployment approvals.
Pin third-party GitHub Actions to reviewed full commit SHAs. Where supported, use short-lived federated cloud credentials instead of stored access keys.
Introduce enforcement gradually
A new security pipeline may discover hundreds of inherited vulnerabilities.
Blocking every finding immediately can make the pipeline unusable.
Start by reviewing the existing backlog, identifying unacceptable immediate risks and establishing a policy for newly introduced vulnerabilities.
Every temporary exception should have an owner, justification and expiry date.
Conclusion
A useful DevSecOps pipeline helps developers make better security decisions without losing the benefits of continuous delivery.
The objective is not maximizing the number of scanning tools. It is reducing the number of preventable security problems that reach production.
For the complete gate sequence, four-week adoption plan, threat modelling approach and troubleshooting guide, read:
What Is DevSecOps? A Practitioner Guide to Pipeline Security
Further references:
Top comments (0)