8 Preventative Steps to Keep Your CI/CD Secure
by Arnab Dey Business Security Systems 01 April 2022
Many enterprises somewhere along the line decide to take the leap and evolve — from DevOps methodology to its 2.0 brother, DevSecOps. The main difference is that now they start to integrate security into all their product’s lifecycle.
This is one of the principles of the shift-left mindset, build everything, security included, into the application from the very beginning. Don’t wait until the testing phase to address an issue. The big advantage? It reduced the chances of productions releases containing flaws and vulnerabilities.
Plus, it cuts back costs — tackling an issue at the end of the development cycle is 10x more costly than if you had caught it early on. The kink is that the CI/CD pipeline, part of the tools and features you’re employing to keep your apps secure, is itself a target of comprise and abuse.
So, let’s delve right and give you some easy-to-follow tips on how to better secure this valuable ecosystem – a CI/CD security checklist.
What does CI/CD security mean?
CI/CD stands for Continuous Integration and Continuous Deployment. CI is the process of integrating changes in a project periodically. While CD is the process of deploying these changes at regular intervals.
The main goal of CI/CD is to make sure that the code quality remains high and to avoid any downtime. That everything runs smoothly.
CI/CD security refers to the protection of the code used in CI/CD processes from being compromised by attackers or malicious insiders.
This includes both technical measures like encryption, access control, and data integrity verification, as well as organizational measures like security training for developers and employees who have access to critical systems or data.
It’s a key part of the process — and also a target-rich environment. If a hacker were to infiltrate this smorgasbord of secrets he could retire to a Caribbean island on your dime.
8 preventative steps to secure your CI/CD
In the water of the Codecov breach and the SolarWinds attack – in which software ended up comprising thousands of organizations, two of the biggest supply chain attacks in modern history – it’s important to understand not only who your CI/CD security can be compromised but what easy to follow steps you can take to mitigate those threats, shore-up your secrets and secure CI/CD.
1. Map threats to the pipeline and secure connections
The pipeline is an essential part of the CI/CD process. It is the sequence of steps that are taken to get a product from its conception to its release.
The pipeline can be mapped to show how threats can impact the process — conduct a strict thereto modeling exercise and make a blueprint of potential threats and where you will need to deploy additional protection.
Threats can be mapped in three ways: before, during, and after. It’s important to regularly and proactively scan all devices that connect to the pipeline — and block or patch those that fail to meet security policy guidelines.
2. Establish tight access control lists and rules
One of the most important steps in all cyber security ventures is to establish a tight access control list and rules. This means, in the case of your pipelines, that the people who have access to the CI/CD should be carefully selected, and their roles should be clearly defined.
Companies need to understand who is in charge of what to get things done efficiently. The head of the CI/CD will make sure that all changes are done according to the set standards and policies.
3. Separate duties and enforce permissions
The CI/CD process is broken down into two main parts:
- Continuous Integration: The developer’s job is to make a change, test it and if it passes the tests, merge it back into the mainline.
- Continuous Delivery: The developer’s job is to create a production-ready copy of the mainline and deploy it.
One team should be partly isolated, from certain databases, from the other. This gives you more control over your whole process and starts to compartmentalize it. There should be cooperation between teams and processes, but that relationship must be supervised.
4. Keep secrets properly secured and used
There are many ways to keep secrets secure and used.
One of the most common ways is through the use of a CI/CD process. This process ensures that secrets are only used by authorized personnel and that they are not exposed to any parties who should not be privy to them.
5. Lock up your code repository
This tip, and patch, is a continuation of the former — A second way to keep secrets secure, including your code repositories, is through the use of encryption.
This method ensures that any data that is being transferred is encrypted so it can’t be read by unauthorized parties. The encryption keys must be kept secret for this method to work properly.
6. Always monitor the CI/CD environment
It is important to monitor the CI/CD environment so that you can identify any issues with the code or any other issues that may arise in the process of deployment. Always have your eye on the ball — that way when an issue arrives you’re not blind-sighted.
7. Remove any unnecessary tools and utilities
Like your cellphone, with thousands of apps that you’ve downloaded once and never used, the same thing happens to CI/CD environments. Periodically take time to delete unnecessary tools and utilities, and uncluttered your workplace.
8. Stay informed and establish an incident response plan
Most companies use third-party resources, services, and codes — sometimes your policies might be stellar, but those of your vendors are lax.
Demand that your IT teams closely monitor security feeds and notices from your many vendors. If an incident does pop its head and make a mess of everything, you must act fast.
When the Codecov breach was discovered, Netflix, for example, quickly rotated its credentials. Why did the company act at a moment’s notice? Because they had an “in case of fire break glass” response plan on hand.
Don’t take for granted the fact that you might have a very good security team, understand that everything – no matter how robust – can and will be compromised.
Make sure that when you are attacked, you have a plan in place to repel the invaders and get everything back to normal as soon as possible.
CI/CD pipelines are some of the most important byways and tools of your organization — treat them as such. It’s important to secure them accordingly and prevent all manner of supply chain attacks or other threats.