DevSecOps Engineer interview questions
100 real questions with model answers and explanations for Middle candidates.
See a DevSecOps Engineer resume example →Practice with flashcards
Spaced repetition · Hunter Pass
Questions
I would publish small versioned templates with stable contracts and enforce immutability separately for each reference type.
- Separate build, scan, sign, and deploy templates so each job receives only the permissions and secrets it needs.
- Define typed inputs, required outputs, artifact digests, and failure semantics so teams can integrate without copying YAML.
- Pin GitHub Actions to full 40-character commit SHAs and pin container images and downloaded tools by their native content digests.
- Publish SemVer tags for discovery, but have consumers use a full commit SHA and call a tag immutable only when repository controls separately prevent or detect retagging.
Why interviewers ask this: The interviewer is evaluating whether you can build reusable CI controls while distinguishing Git commit identities, artifact digests, and mutable version labels.
I would make untrusted code and protected release jobs separate trust zones with no credential path between them.
- Pull-request jobs get read-only source access, no repository secrets, no cloud role, and an isolated cache namespace.
- A protected branch job consumes the reviewed commit, obtains a short-lived identity, and writes only to a staging artifact repository.
- Signing and production promotion run after policy checks in a protected environment with explicit permissions and immutable inputs.
- Artifacts from the untrusted zone are treated as untrusted data and rebuilt in the release zone rather than promoted directly.
Why interviewers ask this: A strong answer shows that branch rules alone are not a trust boundary and that untrusted artifacts cannot cross into release authority.
I would provide an authenticated remote rootless BuildKit service whose workers and trust state are isolated per job and team.
- Each build runs in a fresh rootless worker or equivalent user-namespace boundary with no host Docker socket, privileged container, or reusable workspace.
- A job-scoped OIDC or mTLS identity authorizes the repository and cache namespace, while untrusted pull requests cannot write cache entries later consumed by protected releases.
- Egress is allowlisted, secret and SSH mounts exist only for the build session, and logs, layers, and exported caches are checked to ensure secret material is not persisted.
- I would canary representative builds from all 8 teams and require isolation tests to pass with p95 build time no more than 15% above the current baseline before retiring Docker-in-Docker.
Why interviewers ask this: The interviewer is testing whether you can replace privileged builds with a multi-tenant service that balances isolation, identity, cache trust, secret boundaries, and measured performance.
I would create separate runner pools by trust level and destroy the worker after one job.
- Untrusted pull requests never share a pool, subnet, cache, or service account with release jobs.
- Each worker gets a minimal network policy that permits only source, dependency mirror, logs, and its assigned artifact repository.
- The orchestrator injects a job-scoped identity after scheduling, while the base image contains no cloud keys or repository credentials.
- Pool labels are only scheduling metadata, so isolation is enforced by separate accounts, networks, identities, and autoscaling groups.
Why interviewers ask this: This tests whether you understand that runner labels do not provide security isolation without infrastructure and identity boundaries.
An ephemeral runner should be created from a verified image for one job and destroyed whether that job succeeds or fails.
- The controller obtains a short-lived registration token, then registers with --ephemeral or uses a JIT runner configuration so the worker accepts exactly one job; the registration token itself is not assumed to be single-use.
- A short-lived workload identity and job-specific network policy are attached only after the scheduler selects the worker.
- Logs and approved artifacts leave through controlled sinks, while workspaces, caches containing credentials, and local disks do not survive teardown.
- I alert on workers alive beyond the expected build duration plus a small grace period because failed destruction creates persistent attack surface.
Why interviewers ask this: The interviewer is checking that one-job execution is enforced by ephemeral or JIT runner configuration rather than inferred from the lifetime of a registration token.
I would split scanning by trust so forks receive a credentialless reduced control while protected code receives the authoritative licensed scan.
- External fork pull requests run an open or locally packaged reduced ruleset with read-only repository access, no vendor credential, no secrets, and no writable cache shared with trusted jobs.
- The CI control plane labels its sanitized result with commit, scanner version, rules version, and a fork-reduced trust class that cannot satisfy the protected-branch gate.
- After review, the protected branch runs the licensed scanner with a narrowly scoped credential and publishes a trusted result tied to the reviewed commit and release artifact.
- Promotion rebuilds in the trusted zone and requires that licensed result, while regression tests prove a fork cannot replace scan evidence, poison its cache, or promote its artifacts.
Why interviewers ask this: The interviewer is evaluating whether scanner licensing and fork safety are separated without letting reduced evidence cross the release trust boundary.
I would build once, identify the artifact by digest, and promote that exact digest through environments.
- The build job pushes to an immutable staging repository and emits the image digest, SBOM, provenance, and test evidence.
- Policy checks verify those objects refer to the same digest before a promotion record is created.
- Deployment jobs copy or reference the approved digest without accepting a mutable tag as the source of truth.
- Production admission verifies signature and provenance again, so approval of one digest cannot authorize a substituted image.
Why interviewers ask this: The interviewer is testing whether you preserve artifact identity and evidence across promotion instead of trusting mutable tags or repeated builds.
I would release a new major template version, automate migration checks, and set a time-bound retirement for the old version.
- A compatibility test scans every consumer for removed inputs, permission changes, and unsupported runner assumptions before rollout.
- Two services from different stacks adopt first, and their duration, failure rate, and denied permissions become canary signals.
- Teams receive a generated pull request with the version bump and exact remediation rather than a wiki-only announcement.
- The old version remains immutable during the migration window, then policy blocks new uses before existing consumers reach the final deadline.
Why interviewers ask this: This evaluates whether you can own template evolution as a platform migration with evidence and deadlines rather than silently changing shared code.
I would use the repository dependency graph to run fast checks on affected components while keeping scheduled full-repository coverage.
- A change detector maps edited files to services, shared libraries, lockfiles, container definitions, and downstream dependents.
- Pull requests run relevant SAST, SCA, IaC, and secret scans in parallel with normalized findings and one final gate.
- A nightly job scans all services and base images to catch new advisories that appear without a code change.
- The orchestrator records scanner version, rule set, commit, component, and result so skipped work is visible rather than mistaken for a pass.
Why interviewers ask this: The interviewer wants a scalable monorepo design that reduces pull-request latency without creating blind spots.
A differential gate should compare the proposed commit with an explicit trusted baseline and block newly introduced risk in the affected scope.
- For SAST it compares stable fingerprints, not line numbers alone, because refactoring moves the same finding.
- For SCA it includes newly added packages, version changes, and vulnerabilities newly affecting an existing dependency graph.
- For IaC it evaluates the planned resource delta as well as inherited module changes.
- A scheduled full gate still evaluates the whole estate because differential scans cannot detect every rule or advisory update.
Why interviewers ask this: This tests whether you understand both the mechanics and the coverage limits of change-based gating.
I would make scanner-result reuse depend on the monorepo dependency graph and every input that can change a finding.
- Cache keys include source and lockfile hashes, shared-library revisions, resolved base-image digest, build configuration, scanner and rule versions, and advisory-data version.
- A changed shared lockfile, base image, library, or build template invalidates results for its full downstream service closure, while unknown graph impact triggers a full scan instead of a cache hit.
- Cache namespaces are content-addressed and separated by trust class, and a missing, stale, or failed result can never be converted into a pass.
- A scheduled full scan reconciles all 40 services against reused results, reports unexplained divergence, and disables the faulty cache path until its invalidation rule is corrected.
Why interviewers ask this: The interviewer is testing whether monorepo acceleration follows real dependency inputs and is continuously checked for silent stale-result reuse.
Reachability should raise or lower remediation priority, but it should not be the only reason a vulnerable dependency passes.
- A reachable vulnerable function in an internet-facing service is strong evidence for a blocking gate.
- An unreachable result can be uncertain with reflection, plugins, generated code, native bindings, or runtime-only paths.
- I combine reachability with package location, deployment exposure, exploit maturity, compensating controls, and dependency depth.
- The evidence and tool version are stored with the decision so a later call-graph or application change triggers re-evaluation.
Why interviewers ask this: A strong answer uses reachability as risk evidence while recognizing the analysis can produce false negatives.
No, I would gate on contextual risk rather than CVSS alone, while keeping a conservative rule for confirmed exploitation.
- CISA KEV inclusion or a reliable exploit for an exposed path can justify an immediate block even when the raw score is lower.
- EPSS, reachability, internet exposure, package usage, and available compensating controls refine priority.
- Scanner confidence and fix availability affect the action, but lack of a patch does not erase the risk or ownership.
- The decision matrix is versioned and produces a recorded reason so teams receive consistent outcomes across 40 services.
Why interviewers ask this: The interviewer is checking that you can combine severity and exploitability without turning risk scoring into an opaque exception process.
I would use changed-component analysis for ordinary pull requests and reserve full cross-service dataflow for risk-triggered and scheduled gates.
- A reviewed dependency graph maps edited files to services, generated code, shared libraries, entry points, and downstream callers so the pull-request scan covers affected components rather than only changed lines.
- Ordinary service changes run high-confidence interprocedural rules inside a fixed pull-request budget and publish any skipped scope as incomplete rather than clean.
- Changes to shared libraries or cross-service interfaces trigger the 28 GB full analysis as a required merge gate because their dataflow impact cannot be bounded to one component safely.
- A scheduled isolated 35-minute full scan reconciles every service, routes stable findings to owners, and supplies regression cases when the changed-component path misses a flow.
Why interviewers ask this: The interviewer is evaluating whether you can control an expensive whole-program analysis while preserving a mandatory path for shared cross-service risk.
I would scan lockfiles before build and scan the final image by digest because those views answer different questions.
- Pull-request SCA checks direct and transitive dependencies from committed lockfiles and detects risky version changes early.
- The image scan finds operating-system packages, copied binaries, and build artifacts that are absent from the application lockfile.
- Nightly rescans of stored production digests catch newly published CVEs without rebuilding the image.
- Results are correlated by service, package, version, layer or manifest, and digest so duplicate findings have one owner and one status.
Why interviewers ask this: The interviewer wants proof that you distinguish declared dependencies from the software actually shipped in an image.
I would run authenticated DAST against an ephemeral environment after deployment and keep a signed evidence record tied to the release digest.
- A smoke profile runs on release candidates, while a broader crawler and active test set runs nightly to control latency and test risk.
- Test accounts, seeded data, allowed hosts, request rate, and destructive-test exclusions are explicit and reproducible.
- The result stores scanner and rule versions, target commit, image digest, timestamps, coverage, findings, and any incomplete checks.
- The release gate consumes a normalized verdict, but teams can open the original report to inspect request and response evidence.
Why interviewers ask this: This tests whether DAST is a controlled, reproducible stage whose evidence can support a release decision.
I would use the strongest native workload identity available for each environment and avoid distributing a shared Vault token.
- CI authenticates with JWT or OIDC claims bound to repository, branch, audience, and workflow, then receives a short Vault token.
- Kubernetes workloads use Kubernetes auth with service-account identity bound to an exact namespace and service account.
- Legacy VMs use a machine identity such as cloud IAM auth; AppRole is a fallback only when RoleID and SecretID delivery can be separated.
- Every auth role has narrow policies, a short token TTL, usage telemetry, and no default path shared across all 40 services.
Why interviewers ask this: The interviewer is evaluating whether you match Vault authentication to workload identity instead of standardizing on another long-lived secret.
I would give each service a database role that issues narrowly privileged users with short, renewable leases.
- Vault role SQL grants only the schemas and operations that service needs, with separate roles for migrations and normal runtime access.
- The default TTL covers normal connection turnover, while max TTL forces replacement instead of indefinite renewal.
- Applications renew before expiry and rotate connection pools gracefully so new credentials enter service before old sessions close.
- Lease owner, database role, issue time, renewal, expiry, and revocation are monitored per service for audit and capacity planning.
Why interviewers ask this: A strong answer covers database privilege, application renewal behavior, and lease observability rather than only enabling the secrets engine.
Dynamic credentials need a tested revocation path that removes external access and handles active application sessions.
- Each Vault role has deterministic revocation SQL that disables or drops only the generated database user without touching other service identities.
- For immediate containment, a separately authorized path disables login and terminates that generated user's active database sessions instead of waiting for pooled connections to age out.
- Routine connection lifetime is bounded, and revocation failures enter a retry queue with alerts containing lease, role, service, and database identifiers.
- Periodic reconciliation compares active Vault leases, database users, and live sessions to find orphaned credentials or surviving access on either side.
Why interviewers ask this: The interviewer is checking whether revocation reaches both the issued database identity and any sessions that could remain authenticated after it.
I would use response wrapping to deliver sensitive bootstrap material through an intermediary without exposing the underlying secret.
- Vault returns a single-use wrapping token with a short TTL instead of the AppRole SecretID or initial credential itself.
- The target workload unwraps directly from Vault and verifies expected creation path and wrapping metadata before using the value.
- An expired or already-unwrapped token fails closed and produces an audit event, which reveals interception or delayed delivery.
- Wrapping protects delivery, but it does not replace workload authentication, narrow policy, or rotation after bootstrap.
Why interviewers ask this: This evaluates whether you know the precise delivery problem response wrapping solves and its limits.
Locked questions
- 21
How would you organize Vault namespaces and policies for 8 teams and 40 services?
secretskubernetes - 22
How would you replace stored cloud keys in CI with OIDC federation?
cloud-securityidentity-accessworkload-identity - 23
What rotation telemetry would you expose for a Vault-backed secrets platform?
secrets - 24
How would you configure Vault token lifetimes for long-running services and CI jobs?
tokenssecretsconfig - 25
How would you rotate a versioned static secret consumed by 12 services without a synchronized restart?
secrets - 26
How would you choose between SPDX and CycloneDX output when generating SBOMs with Syft?
- 27
Where should a Syft SBOM be generated and how should it live with a container image?
containerscontainer-imagessupply-chain - 28
A multi-stage image contains a build-produced native binary whose dependencies are absent from the image SBOM, while source and runtime SBOMs disagree; how would you reconcile them?
conflictdependenciessupply-chain - 29
How does cosign keyless signing work, and does it really use no keys?
keyless-signing - 30
What identity checks would you require when verifying a keyless cosign signature?
- 31
What does a transparency log add to keyless signing?
keyless-signingtransparency-logs - 32
How would you use in-toto attestations in a 40-service release pipeline?
ci-cdpipelinesattestations - 33
What would Tekton Chains own in a Tekton-based supply-chain design?
design - 34
What would you require to claim SLSA Build Level 2 for a service?
supply-chain - 35
What extra design work supports SLSA Build Level 3, and what does the level not guarantee?
supply-chaindesign - 36
How would you structure a Rego policy that validates deployment manifests across 40 services?
validationdeployment - 37
What roles do OPA and Conftest play in a policy-as-code platform?
policypytestpolicy-as-code - 38
How would you version, test, and distribute OPA policy bundles to 8 teams?
policy - 39
How would you enforce security policy on Terraform changes before apply?
terraform - 40
When would you use OPA Gatekeeper for Kubernetes admission policy?
kuberneteskubernetes-policypolicy - 41
When would Kyverno be a better fit than Gatekeeper for a Kubernetes platform?
kubernetes - 42
What responsibility should Pod Security Admission have alongside Kyverno or Gatekeeper?
- 43
How would you move a new Kubernetes policy from audit to enforcement across 8 teams?
kubernetes - 44
Design the vulnerability intake flow for 40 services using several scanners.
vulnerabilitiesdesign - 45
Who should own a vulnerability found in a shared base image used by 18 services?
vulnerabilities - 46
How would you define vulnerability remediation SLAs without relying only on severity labels?
remediation-slavulnerabilitiesseverity-priority - 47
What should a vulnerability exception contain and how should it expire?
exceptionsvulnerabilitieserror-handling - 48
What evidence is needed before closing a vulnerability as fixed?
vulnerabilities - 49
How would you produce compliance-as-code evidence from CI and policy systems?
compliancesystem-design - 50
Which metrics would you own for the supply-chain platform across 40 services?
monitoring - 51
A supposedly ephemeral runner snapshot exposes another repository's workspace and Docker credentials across 11 jobs; how would you contain and recover?
snapshotdocker - 52
A rebuilt self-hosted runner becomes reinfected after two days; how would you find and remove the persistence path?
ci-cd - 53
A pull_request_target workflow let a fork write to a dependency cache later restored by main-branch builds; how would you handle the cache-poisoning incident?
incidentscachingdependencies - 54
Two matrix jobs upload an artifact named release.zip, and the release job consumes the attacker's overwritten copy; what would you change during and after the incident?
incidentsartifacts - 55
CloudTrail shows an unexpected GitHub Actions session assuming your deployment role, whose OIDC trust allows repo:acme/*; how would you respond?
ci-cddeploymentgithub-actions - 56
A GitLab merge request pipeline printed a protected deployment variable after running code from an untrusted branch; how would you contain and fix it?
deploymentci-cdpipelines - 57
A new commit cancels an in-progress release workflow after image push but before signing and cleanup; how would you make cancellation safe?
resilience - 58
A compromised pipeline step may have exfiltrated a package token, but CI logs expire in seven days; what evidence and containment would you prioritize?
tokensincident-responseci-cd - 59
Thirty-five percent of SAST jobs publish no SARIF yet pass because the wrapper uses continue-on-error and treats upload failure as success; how would you recover?
saststatic-analysis - 60
After a scanner upgrade, security-stage p95 latency rises from 8 to 31 minutes; how would you debug the regression?
latency - 61
A SAST ruleset update blocks 400 builds because it no longer recognizes your framework's sanitizer; how would you roll it back and reintroduce it safely?
validationsaststatic-analysis - 62
Forty-two percent of nightly DAST jobs fail because the test environment is unstable; how would you separate environment failures from security results?
dasttest-environmentsdynamic-analysis - 63
Your offline SCA database is nine days stale, but pipelines still show green checks; what would you do?
ci-cdpipelinesdatabase - 64
A service in a monorepo changed a shared lockfile but skipped SCA because the path filter watched only its own directory; how would you close the bypass?
monorepopackaging - 65
You must migrate 12,000 legacy vulnerability suppressions to a scanner with different fingerprints; how would you avoid reopening everything or hiding new risk?
vulnerabilitiesrisk-management - 66
An SCA wrapper treats vendor exit code 2 as no findings during API throttling; how would you repair the gate and assess impact?
procurementapi - 67
Vault becomes unavailable and 18 services cannot fetch new database credentials; how would you recover without distributing static secrets?
secretsdatabase - 68
A production service loses database access because its Vault dynamic lease expired instead of renewing; how would you debug it?
databasesecrets - 69
A database password rotation changes the server credential but six application replicas keep the old value; how would you recover and prevent a repeat?
databasereplicationpasswords - 70
You discover an orphan Vault token with broad read access and no active parent; how would you contain and investigate it?
tokenssecretsincident-response - 71
A Vault policy deployment accidentally grants wildcard access to one product namespace for 37 minutes; what would you do?
deploymentkubernetessecrets - 72
During a Doppler migration, six services load production values from the wrong project and config; how would you recover safely?
migrationsconfig - 73
An AWS Secrets Manager migration leaves three services on the legacy secret while rotation advances AWSCURRENT; how would you complete the cutover?
migrationssecrets - 74
Vault has recovered from a 25-minute outage; what telemetry would you require before declaring the secrets platform healthy?
secrets - 75
Production admission accepts a cosign signature chained to your staging Fulcio root; how would you correct the trust policy and assess exposure?
- 76
Images have valid keyless cosign signatures but no Rekor inclusion evidence because signing used tlog upload disabled; what would you do?
- 77
A deployment verifies registry tag release-42, but another job retags it before Kubernetes pulls the image; how would you remove the promotion race?
kubernetesdeploymentregistries - 78
Tekton Chains missed attestations for 17% of TaskRuns during controller restarts; how would you recover coverage?
coverage - 79
After a scanner update, 27 of 140 SBOM components lack purl, version, or supplier, and vulnerability matching drops 22%; how would you repair the regression?
vulnerabilitiessupply-chaincomponents - 80
A verifier update expects SLSA provenance v1 and blocks 28 deployments still emitting v0.2; how would you migrate safely?
supply-chaindeployment - 81
A build downloads a public package whose name matches an internal dependency; how would you contain dependency confusion?
dependencies - 82
A private package mirror serves a package whose hash differs from the lockfile in 14 builds, with no lifecycle-script evidence; how would you respond?
packaging - 83
The malicious build step has been reverted, but its container images remain in the registry and two clusters; what cleanup is required?
containersregistriescontainer-images - 84
A new Kyverno require-run-as-non-root policy blocks 14 legitimate workloads during rollout; how would you recover without abandoning the control?
- 85
A Gatekeeper ConstraintTemplate update denies Deployments that omit an optional field; how would you debug the Rego regression?
deployment - 86
Thirty percent of OPA sidecars keep serving an old bundle after a policy rollout; how would you diagnose and converge them?
policy - 87
A Kyverno admission webhook reaches 12-second p99 latency and API requests time out; would you set failurePolicy to Ignore or Fail?
webhookslatency - 88
CloudTrail shows a Terraform apply that bypassed the reviewed plan artifact; how would you contain the bypass?
terraformartifactscloud-security - 89
Terraform detects that a production security group was manually opened to the internet; how would you handle the drift?
terraformiacnetworking - 90
A workload passes Pod Security Admission in staging but production rejects it under the same restricted label; how would you find the mismatch?
- 91
A new Falco ruleset emits 9,000 alerts per hour for writes under /etc by an approved init process; how would you tune and roll it out?
runtime-securityconcurrencyalerting - 92
You inherit 480 critical and high vulnerability findings for one platform area, including 190 older than 90 days; how would you take ownership?
ownershipvulnerabilities - 93
Your platform area's median time to patch is 12 days against a 5-day target; how would you reduce it without gaming severity?
severity-priority - 94
Thirty-one vulnerability risk exceptions expire this Friday, but nine services cannot patch in time; what would you do?
vulnerabilitiesrisk-managementerror-handling - 95
How would you run a tabletop for a malicious dependency affecting 22 services in the platform area you own?
incident-exercisedependencies - 96
You propose consolidating two SCA scanners; what evidence would you collect before retiring one?
- 97
During scanner consolidation, the new dashboard shows 28% fewer open findings than the old one; how would you prove whether this is improvement or data loss?
- 98
You need to mentor two SREs into the on-call rotation for your policy-as-code area within six weeks; how would you do it?
mentoringon-callpolicy-as-code - 99
A release owner wants to ship in 90 minutes, but the gate finds two reachable critical vulnerabilities among 38 findings; how would you resolve the conflict?
vulnerabilities - 100
After one quarter owning container vulnerability remediation for 34 services, what numbers would demonstrate real improvement?
vulnerabilitiescontainers