Security for DevOps: The Basics a Junior Needs

By Branko Petric - Updated - About 2 weeks at 10 hours a week

The short answer

For DevOps, you need the security basics that stop common accidents: no secrets in Git, least-privilege access, no long-lived keys in CI, scanning in your pipeline, and knowing what to do when a key leaks. You can skip CISSP and pen testing. Plan on about 2 weeks at 10 hours a week.

Why security comes after observability

You have touched security at each step: SSH keys, file permissions, IAM roles. Doing it now pulls those pieces into one review of a system you built yourself. You also have logs and alerts by this point, so you can see what happened if something does go wrong.

Nothing here should wait until now if you can do it sooner. Never commit a secret, even at step 1. This step checks your work and fixes the gaps.

Evidence on what employers expect from juniors in security is thin. We did not find a dataset that breaks it out, so treat this list as our judgment. It covers the failures a junior is most likely to cause or to catch.

What to learn, in order

  1. Keep secrets out of Git. A secret is a password, key or token. Git keeps old versions forever, so a deleted secret is still in the history. Run gitleaks on your repo. On public repos, GitHub also runs secret scanning automatically.
  2. Store secrets in a proper place. Use a secrets manager (a service that stores secrets and controls access to them). AWS Secrets Manager and Parameter Store are two options. Your app reads them when it runs, so they never sit in code or in an image.
  3. Least privilege. Least privilege means giving only the access a job needs. Review each IAM role from your AWS step. Replace any * you can, because a stolen role can only do what the role allows.
  4. Replace long-lived keys with OIDC. A stored key works until someone disables it. OIDC lets your pipeline get short-lived AWS access with no stored key. Limit the role's trust to your repo and branch. Copy the current format from that page, because it has changed for newer repos.
  5. Close what does not need to be open. Check each security group and firewall rule. Only your load balancer should face the internet. Your database should have no public address.
  6. Keep software patched. Many attacks use bugs that already have a fix. Turn on unattended-upgrades on Ubuntu servers, and rebuild images often so they pick up a fresh base image.
  7. Scan in your pipeline. A scanner such as Trivy checks images and dependencies for known bugs. Fail the build on critical findings only at first. If every build fails, people will turn the scanner off.
  8. Know what your pipeline trusts. Third-party actions run with access to your secrets. Pin them to a full commit SHA, because a tag can be moved to point at bad code.
  9. Know the web's common failures. Read the headings of the OWASP Top 10, a list of common web app risks. 2025 is the current edition. It helps you follow along when a developer brings them up.

What to skip for now

  • CISSP, CKS and Security+.
  • Pen testing (attacking systems to find holes) and bug bounties.
  • Compliance frameworks such as SOC 2 and PCI. Know that they exist.
  • Service mesh mTLS (encrypting all traffic between services).
  • Running your own Vault server. A managed secrets service does the job here.

Common mistakes

  • Deleting the file and thinking the leak is over. The secret is still in the history, and it may already be copied. Disable it first, then clean up.
  • Treating .env as safe by default. It is only safe if it is listed in .gitignore and was never committed. Check with git log --all -- .env.
  • Mounting the Docker socket into a container. That gives the container control of the host, close to root access. The same goes for --privileged.
  • Believing a clean scan means you are safe. Scanners find known bugs in packages. They do not catch an open database port or a role with too much access.
  • Using a strong password as your only defense. A database open to the internet is still one mistake away from a breach. Reduce who can reach it as well.

Your project

Attack your own project. In a throwaway repo, commit a made-up key that looks real. Never use a real one. Scanners may ignore the example key from the AWS docs, so make up your own random string. Check that gitleaks catches it, then add the scan to your pipeline so the next one blocks the merge.

Then audit your real project: IAM roles, open ports, stored keys. Switch your pipeline to OIDC, if you have not already, and delete any old access keys. Write one page on what you found, what you changed, and your first-hour plan for a leak. That page gives you something real to talk about in an interview.

You are done when

You can do all of this with no notes. If you already can, skip this step.

  • gitleaks git run on your repo reports no leaks across the full history, and it also runs in your CI pipeline.
  • Your pipeline reaches AWS through OIDC, and your repo's GitHub secrets hold no AWS access keys.
  • A container image with a critical vulnerability fails the build, using a scan such as trivy image --severity CRITICAL --exit-code 1 <image>.
  • For each IAM role in your project, you can explain each permission it holds. You removed any you could not explain.
  • Without notes, you can list what you do in the first hour after a leaked key, in order, starting with disabling the key.

Learn it and test it

Free guides

Practice scenarios

Common questions

How much security does a junior DevOps engineer need to know?

Evidence here is thin. We found no dataset that isolates what employers want from juniors in security, so the list on this page is our judgment. It focuses on mistakes a junior could cause or catch: leaked secrets, too much access, and open ports.

What should I do if I push a secret to GitHub?

Disable the secret first, then make a new one. Assume it was copied, because bots scan public repos. After that, check the logs for anything it was used for, such as CloudTrail on AWS. Deleting the file or rewriting Git history does not make the old secret safe.

Do I need Security+ or another security certification for DevOps?

Not for this step. We found no solid data showing that security certifications help someone get a first DevOps job. Spend the two weeks on your project. A later security-focused role is the time to look again.

Is DevSecOps a separate thing I need to learn?

Not at this stage. DevSecOps mostly means building security checks into the work you already do, such as scans in your pipeline. If you finish the project on this page, you have done the beginner version.

Practice defending your decisions

DevOps Ledger is a scenario-based DevOps and SRE interview practice platform: you pick a real production incident, defend your decision in a chat against a senior-engineer AI that pushes back, and get scored against an answer key written before you started.

One payment. 12 months of access. No subscription, nothing renews.

Get full access - $19