The Practitioner’s Guide to Scaling Infrastructure as Code

➡️ Download Now

General

What is DevSecOps? Security in Your DevOps Pipeline

What is DevSecOps

In this article, we’re going to take a closer look at a very important part of the DevOps pipeline: security.

Because of how important security is to DevOps pipelines, many have taken to calling it DevSecOps instead. What exactly is it, and how can you properly implement it in your organization? Let’s take a look.

Table of contents:

  1. What is DevSecOps?
  2. DevSecOps benefits
  3. How to implement DevSecOps – methodology
  4. The DevSecOps lifecycle framework
  5. DevSecOps tools
  6. DevSecOps best practices

What is DevSecOps?

DevSecOps means integrating automated security tools and practices throughout the entire software development lifecycle, from planning and coding to testing and deployment, rather than treating them as separate tasks. The point of DevSecOps is to implement security best practices while still maintaining increased team productivity by breaking down silos between teams.

DevSecOps is important because most people view security as an annoyance and as something that adds extra friction to the development and deployment process. Instead of accepting that and putting security on the back burner, DevSecOps brings security back to the forefront by saying “you know what, security is critical and must be part of our process, so let’s make it fit in as painlessly as possible.”

DevOps vs. DevSecOps

As speed and automation became central to DevOps, security was often treated as a separate step, slowing down the deployment process and potentially introducing vulnerabilities. 

DevSecOps extends DevOps principles by integrating security practices from the start, embedding automated security checks into each stage of the CI/CD pipeline. While DevOps seeks to accelerate development and improve collaboration, DevSecOps ensures that this acceleration doesn’t come at the cost of security, making security a shared responsibility across all teams.

DevSecOps vs. Agile

While Agile focuses on delivering software incrementally and adapting quickly to changes, DevSecOps takes a more integrated approach by embedding security within this continuous development process.

In an Agile process, security considerations can often become an afterthought or be handled separately by a dedicated security team. DevSecOps, on the other hand, seeks to address this by incorporating security testing and compliance checks within each iteration, ensuring that vulnerabilities are identified and mitigated early in the development cycle.

DevSecOps benefits

The reason that security is so important to include from day one is that it will help maximize DevSecOps benefits, such as:

  • Reduce risk and legal liability
  • Identify bugs and vulnerabilities earlier in the process
  • Make security more manageable
reducing risk devsecops

1. Reducing risk and legal liability

When it comes to reducing risk and legal liability, we’re not just talking about getting sued by shareholders or customers when there’s a costly breach. We’re also talking about being in compliance with the law.

Depending on your business, you may have to comply with GDPR law depending on certain situations. Or, you may have to handle health-related records, which means you may need to comply with HIPAA or other important laws.

If you don’t comply, it could cost your organization a massive amount of money in fees.

Having the proper tools and processes in place can help prevent modifications from going out that would result in violations.

It can also help identify compliance violations as the features are created by the development or infrastructure teams instead of right before we try to deploy them to production.

2. Identifying bugs and vulnerabilities early in the process

It’s important for issues that can cause vulnerabilities to be caught as early as possible in the DevOps pipeline.

The reason is that the further into the pipeline you are, the more expensive it is (in both monetary and time requirement terms) to fix issues.

With the traditional DevOps process, code or infrastructure changes are committed and pushed to the next phase. The QA team and automated tools receive those changes and start testing, and everyone crosses their fingers that no major issues are found so that everything can get deployed to production on time in order to meet a deadline.

automated testing devsecops

Except that more often than not, the QA team or automated testing will find problems. Not just cosmetic problems but potentially major security issues that require costly re-writes.

Now, suddenly, the issues are sent back to the development or infrastructure teams, and they need to be fixed as soon as possible because they’re holding up a release. Those teams are under massive pressure to deliver a solution. Once they submit a solution, the QA and security tests start over again.

security devsecops

Security becomes a source of pain and anxiety, and when stakeholders ask why a project is delayed, they’re told that it’s because the security team found issues.

Instead, if you shift security left and include it earlier in the process, it becomes integrated into the development process rather than an add-on further down. Those otherwise costly security issues get discovered much faster and closer to the developer or infrastructure engineer so that they can address them before moving on to another task.

Our goal is to give Dev and Ops fast feedback on the work they are producing so that they can be notified right away and can address the issue before moving on to another task and switching contexts.

3. Making security more manageable

An added benefit of shifting security left is that it helps make security tasks more manageable in a way that can feel completely natural to development teams.

Enabling IT teams to deliver value faster is not a new concept…development has had very similar problems. How has development fixed it? By going agile and by breaking down large projects into the smallest tasks possible.

devsecops managable security

Security should be handled in the same way. Instead of keeping huge security tests or projects, we need to take those and break them down into really small tests or projects that happen continuously throughout the DevOps pipeline. Being reactive to changes halfway down our deployment pipeline makes this very difficult. Being proactive to changes at the very beginning enables us to be agile.

How to implement DevSecOps - methodology

Implementing DevSecOps involves shifting security left, getting management buy-in, making security part of everyone’s responsibilities, and implementing the proper tools and processes.

Let’s talk more about what the DevSecOps roadmap means and what it looks like.

Shift-left security

We need to include security from the very beginning to make it more impactful without adding much friction. The traditional approach has been to plan, develop, and push changes forward. Only then would a security team become involved. 

However, there are many issues with this approach.

Issues with the traditional approach to security

One issue is that the security team will not have access to most of the context. Lack of context results in questions like these being asked without an easy way to gather answers and typically way too late in the process:

  • Why is this being developed the way that it is?
  • Who made that decision?
  • Are they aware it will have an impact on other parts of the system?

Another issue is that when the security team finds problems, the pipeline has to go all the way back to the beginning. That causes delays and frustration, especially if the development or infrastructure team has already moved on to another task.

The DevSecOps way of handling security

Instead, with DevSecOps, we want to include security from the very beginning so that problems are found as early in the process as possible: closest to the decision makers and to the context.

One way we can do this is by including security team members during planning and then again during product demonstrations in between each development interval. This helps threefold:

  1. It helps the security team understand business goals for the implementation
  2. It involves a team that will be impacted during the development instead of after
  3. The security team can provide guidance and feedback as features get created

This approach provides security expertise earlier in the development process and reduces the amount of time before issues get discovered.

Another way we can do this is by tracking open security issues in the same tracking systems that development and operations teams use. The traditional approach has been to keep security issues in separate tracking systems, which means Dev and Ops don’t have visibility (and vice versa). By having all open issues (from Dev, Sec, and Ops) in a central location, everyone can see what the priorities are, and they can collaborate.

If we envision our pipeline going from left to right — left being the starting point and right being production — by moving security at the very beginning, we are shifting security left. That’s why this is often referred to as a “shift-left” security strategy.

shift left devsecops

Ask any developer, infrastructure engineer, or security engineer whether they’d prefer someone to find issues with their code, infrastructure, etc.… while they’re still working on it versus after they’ve pushed it through and moved on to another task and the answer will be the same: show me issues as early as possible so that I can quickly fix them and move on to something else.

It’s much easier and less painful to fix issues while the project is fresh on your mind than after you’ve already switched to a different context. It’s much more efficient.

Management buy-in

Properly implementing DevSecOps requires a fundamental shift in how your organization thinks about, builds, and deploys software and infrastructure. It requires far more than your peers’ agreement to make a change…it requires management buy-in.

Software vulnerabilities being exploited in production create risks for the organization. The person who judges risks vs. revenue needs to see the value in implementing DevSecOps, or else it will fall flat.

We want to build a mindset that everyone is responsible for security. That sounds cliché, but it’s true, and it is practical, not just conceptual. For good security decisions to be made at speed and scale, they simply can’t be centralized.

If you want to see this properly implemented, you need management to not only back it up but also implement it themselves.

Security is everyone’s responsibility

DevSecOps makes security part of the development process instead of lobbing it over the fence to a security team and forgetting about it.

Instead of hearing, “I don’t usually worry about vulnerabilities in my code or config files because the security team will take care of it” we want to empower the development and infrastructure teams to write more secure code and configurations.

Security is a profession, and we do need highly skilled people in security-focused roles, but we also need everyone else to be responsible for securing their work instead of lobbing it over the fence and saying, “not my problem.”

Again, achieving this requires management buy-in and measuring the right metrics.

Security and DevSecOps training

Getting organizational culture right is critical, but it’s not going to happen overnight. Unless you’re already implementing a lot of these concepts, it’s going to require a fundamental shift. There will be resistance, and it will initially cause frustration because you’re changing people’s traditional ways of thinking and working.

Of course, management buy-in will help alleviate these issues, but so will proper training. Not only does management need to understand these concepts (even if at a high level), but so does everyone else (at a more practical level).

Once everyone understands the DevSecOps approach, they’ll not only understand why it’s important, but they’ll also see how to properly implement it and how it will end up helping them do their jobs more efficiently.

The DevSecOps lifecycle framework

As mentioned before, DevSecOps doesn’t have just one right way of implementing it. With that said visual learners may find it helpful to visualize the lifecycle.

devsecops lifecycle

As we can see, many verifications should happen before we reach the test or release stages of the lifecycle…or, in other words, on the left.

Stage Description Actions
Plan The planning phase is where all projects start.
  • Providing secure code training
  • Creating baselines
  • Creating threat models
Code In the code stage, developers start writing application code, or infrastructure engineers start configuring cloud resources to support those applications.
  • Source code versioning
  • Code reviews
  • Local secrets scanning
  • Linting
  • Static Application Security Testing (SAST)
  • Software Composition Analysis (SCA)
Build The build phase involves compiling code, packaging applications, and preparing them for testing and deployment.
  • Dynamic Application Security Testing (DAST)
  • Interactive Application Security Testing (IAST)
  • Centralized SCA and SAST (instead of local only)

Read more about Automated and Manual Code Testing with DevSecOps.

Test In the testing phase, the application undergoes automated and manual testing to identify and fix bugs, vulnerabilities, and performance issues.
  • Centralized secrets scanning
  • Vulnerability assessments
  • Penetration tests (depending on the size of the organization)
Release The release phase is where the approved, tested application is made available for deployment to various environments.
  • Compliance checks
Deploy Deployment involves moving the application to production or other target environments for real-world use.
  • Implement code signing
  • Harden endpoints
  • Harden applications
  • Encrypt everything that needs to be
Operate The operate phase includes managing the application in production, ensuring its stability, availability, and ongoing performance.
  • Centralized logging
  • Process for patching
  • Vulnerability disclosure
  • Vulnerability assessments
  • Penetration Tests
  • Bug bounty programs
Monitor Monitoring involves continuously tracking the application’s performance, security, and usage to detect and respond to incidents or potential issues.
  • Access monitoring
  • IPS/IDS and WAF solutions
  • SIEM
  • Attack surface mapping

All of that helps us learn and improve, which we can then use the next time we start a new project, which takes us all the way back to the planning phase.

DevSecOps CI/CD pipeline

Another common way of visualizing and calling this process is CI/CD, or Continuous Integration and Continuous Delivery/Deployment.

devsecops cicd

Continuous Integration helps us move through the Plan, Code, Build, Test, and Release stages. 

Continuous Delivery helps us move through the Deploy, Operate, and Monitor stages so that a team member can press a button to smoothly deploy all of the changes to production. 

Continuous Deployment is the same as Continuous Delivery, except it aims to completely automate deployment without even requiring manual intervention. Getting to this point requires a serious amount of trust in your pipeline and is a great goal to strive towards.

As the graphic above shows, we’ve barely scratched the surface. Each stage has a number of actions, processes, and tools we can (and should) implement depending on our needs.

DevSecOps tools

Here are some tools commonly used in DevSecOps:

SAST (Static Application Security Testing)

  • SonarQube – Detects code vulnerabilities and bugs across multiple languages.
  • Checkmarx – Scans source code for security flaws within development workflows.
  • Veracode – Provides automated static code analysis to identify weaknesses.

SCA (Software Composition Analysis)

  • WhiteSource (Mend) – Identifies vulnerabilities and license issues in open-source components.
  • Snyk – Finds and fixes vulnerabilities in open-source dependencies and containers.
  • Black Duck – Scans for security risks and compliance in open-source software.

IAST (Interactive Application Security Testing)

  • Contrast Security – Detects vulnerabilities in real-time during testing.
  • Seeker by Synopsys – Identifies security flaws by monitoring runtime behavior.
  • Hdiv Security – Provides real-time vulnerability detection during development.

DAST (Dynamic Application Security Testing)

  • OWASP ZAP – An open-source tool for automated web app vulnerability scanning.
  • Burp Suite – Offers web application security testing, both automated and manual.
  • Acunetix – Scans for web vulnerabilities like SQL injection and XSS.

Check the 73 Most Useful DevOps Tools for a full list of DevOps and DevSecOps tools.

DevSecOps best practices

Here are five DevSecOps best practices to ensure security is embedded seamlessly throughout the development lifecycle:

  • Automate security testing: Integrating automated security tools into the CI/CD pipeline is crucial for catching vulnerabilities early and consistently. By automating code scanning, dependency checks, and compliance validation, teams can detect security issues as soon as they arise, allowing for quicker remediation without slowing down the development pace.
  • Shift security left: This means embedding security considerations right from the start of the development process, including during the planning and coding phases. By involving security experts early and encouraging developers to adopt secure coding practices, teams can address potential risks before they escalate rather than scrambling to fix them just before release.
  • Implement continuous monitoring: Security isn’t a one-time task; it requires ongoing vigilance. Setting up continuous monitoring for threats, anomalies, and compliance violations helps detect new risks in real-time, enabling teams to respond swiftly. This practice extends security beyond the development phase into deployment and operations.
  • Foster a security-first culture: Encourage all team members—developers, testers, and operations staff—to take ownership of security. By providing regular security training and fostering a mindset where security is everyone’s responsibility, teams can ensure that security considerations are baked into every stage of the development lifecycle.
  • Use Infrastructure as Code (IaC) with secure configurations: Treating infrastructure as code allows for standardized, version-controlled, and automated deployments. Incorporating security best practices in IaC templates helps ensure that all environments are set up securely by default, minimizing configuration drift and reducing the likelihood of insecure settings being introduced.

Key points

As we’ve seen, the three pillars of a DevSecOps model are automation, collaboration, and continuous monitoring.

Now that we understand what DevSecOps aims to achieve, why it’s advantageous, and what it looks like, we need to explore how to properly implement processes and tools to achieve it in our organization. 

Getting organizational buy-in and detecting security issues as early in the pipeline as possible sounds great and all, but also much easier said than done. Plus, there’s not just one right way of achieving DevSecOps. Every organization is different in the way that they build and deploy. With that said, there are concepts that can be applied across the board.

In the meantime, go ahead and share this article with your colleagues so they can start learning about DevSecOps, and learn how a platform like Spacelift can help you and your organization fully manage cloud resources within minutes. Spacelift is a CI/CD platform for infrastructure-as-code that supports tools like Terraform, Pulumi, Kubernetes, and more. For example, it enables policy-as-code, which lets you define policies and rules that govern your infrastructure automatically. You can even invite your security and compliance teams to collaborate on and approve certain workflows and policies for parts that require a more manual approach.

While we will cover concepts like these in the rest of our DevSecOps series, get a head start with Spacelift’s documentation.

Secure Infrastructure as Code at Scale

Operate at the pace your business demands, knowing your infrastructure is compliant and under control. Spacelift enables you to rapidly provision and configure infrastructure in a single integrated workflow while giving you the control to manage risk and meet compliance requirements.

Learn more

The Practitioner’s Guide to Scaling Infrastructure as Code

Transform your IaC management to scale

securely, efficiently, and productively

into the future.

ebook global banner
Share your data and download the guide