DevSecOps scenario interview questions
Security questions in DevOps interviews are operational: a key was pushed to a public repo, a container is behaving strangely, a rotation broke production. Interviewers check that you contain first, rotate what is exposed, and fix the process that let it happen.
Each question below is the exact prompt from a DevOps Ledger challenge. Decide what you would do, then open the challenge to defend it.
17 scenarios: 7 beginner, 5 intermediate, 5 advanced. Answer keys reviewed by Branko Petric.
What interviewers probe
- Revoking and rotating before cleaning history
- Preserving evidence while containing an incident
- Least privilege for people, machines and pipelines
The questions
- 01beginner9 min
A Contractor Needs DB Access for a Week. Open the Port?
An external contractor needs read access to the production database for one week of analysis work. A teammate proposes opening the database port (5432) to the internet in the firewall and giving the contractor a strong password. What do you do, and why?
Practice this scenario - 02advanced13 min
Secrets Rotation Took Down Prod at 3 AM. Pin Credentials?
Your new automated secrets rotation rotated the database password at 3am. Connection pools and config caches across a dozen services kept using the old credential, authentication failed platform-wide, and prod was down for 90 minutes. A teammate says rotation is clearly too risky - pin the credentials and rotate manually once a year. What do you do, and why?
Practice this scenario - 03beginner8 min
You Pushed AWS Keys to a Public Repo
You just pushed a commit to a public GitHub repo that contains your AWS access keys. You notice five minutes later. A teammate says just delete the file and force-push. What do you do first, and why?
Practice this scenario - 04beginner9 min
Your S3 Website Returns 403. Make the Bucket Public?
Your app gets 403 AccessDenied fetching objects from a private S3 bucket. A teammate says just turn off Block Public Access and make the bucket public so it works. Do you agree, and what do you do instead?
Practice this scenario - 05beginner10 min
Access Keys Are Hardcoded on the EC2 Box. Just Rotate Them?
Your app on EC2 talks to AWS using long-lived IAM user access keys stored in a config file on the instance, and one set just leaked. A teammate says generate new keys and paste them in. Do you agree, and what should you do instead?
Practice this scenario - 06advanced15 min
A Container in Prod Is Mining Crypto
You discover a pod in your production cluster is running a crypto miner and making outbound connections to an unknown host. A teammate says just kubectl delete the pod and we are done. How do you actually respond?
Practice this scenario - 07advanced15 min
Your CI Has Keys to Prod and Pulls Unpinned Deps
Your CI pipeline pulls dependencies on every build, runs their code, and holds long-lived credentials with broad access to production. A teammate says just add a vulnerability scanner and we are secure. Is that enough, and what would you actually do?
Practice this scenario - 08advanced15 min
Cross-Account S3 Access Still Fails. Just Open It Up?
You granted a partner account access to your S3 bucket with a bucket policy, but their role still gets AccessDenied reading the objects, which are encrypted with a customer-managed KMS key. A teammate says just make the bucket public and let the key allow everyone. What do you do?
Practice this scenario - 09advanced15 min
An EKS Pod Needs AWS Access. Attach It to the Node Role?
A pod in your EKS cluster needs to read from S3. A teammate says just add the S3 permission to the node instance role so the pod can use it immediately. Do you agree, and what should you do instead?
Practice this scenario - 10beginner8 min
Deploy Fails with Permission Denied. chmod 777 Everything?
A deploy to a Linux VM fails with 'Permission denied' when the app tries to write to its data directory. A teammate says just run chmod -R 777 on the whole app directory so permissions can never break a deploy again. What do you do, and why?
Practice this scenario - 11beginner10 min
The Cert Expires Tonight. Just Bump It to a 10-Year Cert?
Your nginx TLS cert expires in a few hours and last quarter an expired cert took the site down. A teammate says just buy a 10-year self-signed cert and install it so we never deal with this again. What do you do, and why?
Practice this scenario - 12intermediate12 min
The Container Needs Docker, So Mount the Socket and Run --privileged?
A CI job inside a container needs to build images, and a teammate says just bind-mount /var/run/docker.sock and run the job with --privileged so it can do whatever it needs. What do you do, and why?
Practice this scenario - 13intermediate12 min
Deploy From CI: Paste AWS Keys Into GitHub Secrets?
The deploy job needs AWS permissions. A teammate created an IAM user, generated an access key and secret, and wants to store them as GitHub Actions secrets so the pipeline can deploy. Do you agree, and what do you do instead?
Practice this scenario - 14beginner10 min
Commit terraform.tfstate to the Repo So Everyone Shares It?
Two engineers ran terraform apply from their laptops and got conflicting results. A teammate proposes committing terraform.tfstate to the git repo so everyone shares the same state. Do you agree, and what do you do instead?
Practice this scenario - 15intermediate12 min
Chasing a Bug: Flip Production to DEBUG and Log Everything?
An intermittent bug only shows up in production. A teammate wants to flip the entire app to DEBUG log level and log full request and response bodies until they catch it. Do you agree, and what do you do instead?
Practice this scenario - 16intermediate12 min
ArgoCD Says OutOfSync Forever. Ignore the Secret Diff and Move On?
After moving a third-party Helm chart from helm install to ArgoCD, the app is permanently OutOfSync, the admin password keeps resetting, one sync left a component crash-looping on database auth and agents in another cluster failing TLS. The team proposes ignoreDifferences on all the Secrets, turning on auto-sync with selfHeal, or going back to running helm upgrade by hand. Which do you pick, or what do you do instead, and why?
Practice this scenario - 17intermediate12 min
A GitHub Action You Use Was Hijacked. Bump the Tag and Move On?
A popular third-party scanner action had its version tags moved to a malicious commit for about twelve hours. Your org references it as @v2 in around 40 repos, and scheduled jobs ran during that window. A teammate opened PRs bumping to the maintainer's new safe tag and wants to close the ticket because the logs look normal. Do you agree, and what do you do?
Practice this scenario
Worked answers
- Scenario Based DevOps Interview Questions, With Worked Answers
Scenario based DevOps interview questions for Linux, Docker, CI/CD, Git and AWS, with first commands, the interviewer's pushback, and weak vs strong answers.
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.
A general chatbot makes up an answer on the spot. DevOps Ledger grades you against an answer key written before you started.
One payment. 12 months of access. No subscription, nothing renews.
Get full access - $19