Secure Software Delivery: DevSecOps, Pipeline, and Supply Chain Security Questions
Embedding security into how software is built, assembled from dependencies, and shipped. Covers shift-left and secure-SDLC practices, infrastructure-as-code security, CI/CD pipeline and secrets management, integrating security scanning into build and deploy, and configuration and secret management across environments, together with software supply chain security: software composition analysis (SCA), dependency and open-source vulnerability management, build-provenance and artifact integrity, and mitigating supply-chain attack vectors. The 'secure the delivery pipeline and everything it pulls in' discipline, distinct from vendor-risk governance.
A newly deployed SAST scanner is producing a high volume of findings, many of which appear to be false positives. Describe a systematic approach to triage and reduce the noise while preserving detection efficacy. Include automation, baseline creation, developer review flows, rule tuning, and how to validate that tuning hasn't removed true positives.
Sample Answer
A new scanner producing a wall of findings on day one is the single most predictable way to lose developer trust in a security program, so the triage approach has to separate 'this tool is noisy' from 'this specific finding is wrong' and fix the right one.
A systematic triage approach
Step one, establish a baseline before touching anything. Run the scanner against the existing codebase once and snapshot every current finding as "pre-existing, not newly introduced". This baseline is not a permanent suppression; it is a starting point that separates the debt the codebase already carried from anything a new PR introduces going forward.
Step two, cluster before triaging individually. Group findings by rule ID and inspect the top five to ten rules by volume first; a single overly broad rule is often responsible for the majority of the noise, and fixing that one rule's configuration has more leverage than triaging a thousand individual findings one at a time.
Step three, validate a sample of each cluster with a developer who owns that code, not the security team alone; the person who wrote the code can usually say in seconds whether a given pattern is actually exploitable in context, which the scanner cannot know without that context.
Step four, tune rather than blanket-suppress. For a rule confirmed to be a true false-positive pattern in this codebase (for example, a SQL-construction pattern the scanner flags that is actually parameterized through an ORM it doesn't recognize), adjust the rule's configuration or add a scoped suppression with a comment explaining why, rather than disabling the rule org-wide, which would also hide the rare true positive the same rule would have caught elsewhere.
Validating you haven't suppressed a real finding
After each tuning pass, run the scanner against a small set of KNOWN-VULNERABLE test fixtures (intentionally-vulnerable code samples representing the rule's true-positive case) to confirm the tuned rule still fires on the pattern it's supposed to catch, not just that it stopped firing on the false positive. Track the suppression list itself as a metric over time: a shrinking or stable list after the first tuning pass is healthy; a list that keeps growing every week is a sign the team has started suppressing rather than fixing, which defeats the purpose of the gate entirely.
Where automation fits
Automate what does not need human judgment: the baseline snapshot itself (a scheduled job diffing today's findings against the last approved baseline), nightly re-runs against the known-vulnerable test fixtures so a tuning regression is caught the next morning rather than at the next manual audit, and tracking the suppression list's size and age over time so a growing list raises itself as an alert rather than waiting for someone to notice. Keep the actual judgment calls (is this specific pattern really safe in context) manual, since that is exactly the step a developer with real code context does better than a script.
The trade-off
This process trades a slower initial rollout (weeks of tuning before the gate becomes meaningfully blocking) for a program that developers still trust six months later. Skipping straight to a hard-blocking gate on day one produces faster nominal coverage and a much higher chance the whole program gets quietly bypassed once developers learn how.
Describe the common ways secrets accidentally end up in Git history or CI artifacts. For each leakage vector, provide two concrete preventive controls you would implement (tooling, process, or policy) to stop that class of leak.
Sample Answer
Secrets end up in Git history or CI artifacts through a small number of well-known paths, and each one has its own concrete, checkable prevention control rather than a single blanket fix.
Leakage vectors and controls
A developer commits a secret directly into source code (a hardcoded API key, a .env file checked in by accident). Prevention: a pre-commit hook running a secret-detection tool (gitleaks or trufflehog) that blocks the commit locally before it ever reaches the remote, plus a server-side push-protection check as a backstop for the developer who bypasses or doesn't have the local hook installed.
A secret leaks into CI build logs (an environment variable printed by a verbose build step, or a script echoing its own inputs for debugging). Prevention: enable the CI provider's built-in log masking for any value sourced from a secrets store (most CI systems mask a value automatically once it's referenced as a secret), and explicitly discourage set -x or verbose debug flags in scripts that handle secret-bearing environment variables.
A secret gets baked into a built artifact or container image (a config file with a real credential copied into the image during a multi-stage build, rather than injected at runtime). Prevention: scan every built artifact and container layer for secret patterns before it's published, and enforce a runtime-injection pattern (secrets manager, sidecar, or environment variable set at deploy time) rather than baking any credential into the image at build time.
Historical leakage, meaning a secret that was committed and later removed, but still exists in the Git history of an old commit. Prevention: run a periodic (for example nightly) scan of the FULL Git history, not just the current HEAD, since deleting a file in a later commit does not remove it from history; and gate any change that widens a repository's exposure (making a private repository public, adding an external collaborator, connecting a new third-party integration) on that full-history scan passing clean first, so a secret from years ago cannot be newly exposed the moment access to the repository widens.
If a secret is found in a log or artifact
The response is always rotate first, investigate second: revoke and reissue the credential immediately, since the window between detection and rotation is exactly the window an attacker could exploit, and only afterward investigate how it leaked and whether it was actually accessed by anyone unauthorized. A secret found by the historical scan gets the same treatment: it must be treated as compromised and rotated, not merely scrubbed from history, since history rewrites don't help once a repository has been cloned elsewhere, and the safe assumption is that any exposed secret has already been seen.
Trade-offs
Pre-commit hooks add a small amount of friction to every commit (a moment's pause while the scan runs) in exchange for catching the leak at the cheapest possible point, before it ever reaches a shared remote; skipping local hooks in favor of only a server-side check still catches the leak, but only after it has already reached the remote repository, which several tools and CI systems may have already cloned or cached by the time it's caught.
Write an OPA (Rego) policy snippet that enforces two Kubernetes admission rules: 1) container images must come from registries 'mycompany.registry/' or 'gcr.io/mycompany/', and 2) containers must not be allowed to run as root (either securityContext.runAsNonRoot == true or securityContext.runAsUser != 0). Include brief comments explaining your logic. (Assume input is the Kubernetes admission review JSON.)
Sample Answer
This admission policy enforces two independent security properties on any container about to run in the cluster: that its image comes from a trusted source, and that it can't run with root privileges.
package kubernetes.admission
import rego.v1
allowed_registries := ["mycompany.registry/", "gcr.io/mycompany/"]
deny contains msg if {
some container in input_containers
not image_from_allowed_registry(container.image)
msg := sprintf("container %q uses image %q from a non-approved registry", [container.name, container.image])
}
deny contains msg if {
some container in input_containers
not runs_as_non_root(container)
msg := sprintf("container %q is not enforced to run as non-root", [container.name])
}
image_from_allowed_registry(image) if {
some prefix in allowed_registries
startswith(image, prefix)
}
runs_as_non_root(container) if {
container.securityContext.runAsNonRoot == true
}
runs_as_non_root(container) if {
container.securityContext.runAsUser != 0
}
input_containers := input.request.object.spec.containers
The two rules, and why non-root has two paths
The registry rule checks the image reference's prefix against an explicit allowlist, denying anything that doesn't match one of the two approved registries; this closes the same trust gap discussed for the supply-chain capstone elsewhere in this topic, enforced here at the actual point a container is scheduled, not just earlier in the pipeline. The non-root rule accepts EITHER of two ways a Pod spec can express "don't run as root": the explicit runAsNonRoot: true flag, or an explicit runAsUser set to any non-zero UID; a policy that only checked one of these two equivalent expressions would incorrectly deny a container that's actually correctly configured via the other path, which is why both are modeled as alternative ways to satisfy the same underlying rule.
Comments explaining the logic
The input_containers binding pulls directly from the Kubernetes AdmissionReview object's standard shape (request.object.spec.containers), which is the same structure every admission webhook receives regardless of what specific resource triggered the review, as long as it has a pod spec. Each deny rule is independent, meaning a container that fails BOTH checks produces two separate messages, giving the developer full visibility into everything wrong at once rather than surfacing one issue, requiring a fix, then surfacing the next.
Verified
Evaluated with opa eval against two fixture AdmissionReview payloads: a container using an unapproved registry (docker.io/library/nginx) with no non-root enforcement correctly produced both deny messages; a container using an approved registry with runAsNonRoot: true correctly produced an empty result.
Trade-offs
This policy checks only the FIRST container in a pod spec implicitly through the some container in input_containers iteration, which actually does correctly check every container in a multi-container pod (including init containers if they're included in the same array in your admission review shape); the real limitation is that it doesn't separately address initContainers, which live in a different field of the pod spec and would need their own explicit check if your threat model requires equally strict treatment of init containers.
Provide a sample CI/CD workflow (YAML or pseudocode) that enforces separation of duties: developers can build and push artifacts but cannot promote to production; release and deployment require an independent approver and only signed artifacts are promoted. Include artifact signing and verification and least-privilege runner identities.
Sample Answer
Enforcing separation of duties in a pipeline means the same identity that can build and push an artifact structurally cannot also be the one that approves and executes its promotion to production; this has to be enforced by permissions and explicit configuration, not by a policy document asking people not to do both.
Workflow design
name: build-and-promote
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: Build and push (unsigned, dev-only tag)
run: docker build -t "$IMAGE:dev-${{ github.sha }}" . && docker push "$IMAGE:dev-${{ github.sha }}"
- name: Sign image
run: cosign sign --yes "$IMAGE:dev-${{ github.sha }}"
promote-to-production:
needs: build
runs-on: ubuntu-latest
environment:
name: production # requires configured required reviewers AND "Prevent self-review" enabled
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Verify signature before promoting
run: cosign verify --certificate-identity-regexp ".*" --certificate-oidc-issuer https://token.actions.githubusercontent.com "$IMAGE:dev-${{ github.sha }}"
- name: Retag and push production tag
run: |
docker pull "$IMAGE:dev-${{ github.sha }}"
docker tag "$IMAGE:dev-${{ github.sha }}" "$IMAGE:prod-${{ github.sha }}"
docker push "$IMAGE:prod-${{ github.sha }}"
How separation of duties is actually enforced
The build job runs under the identity of whoever pushed the commit, with permissions scoped to push a dev-tagged image and sign it, but with NO permission to push a prod- tag directly. The promote-to-production job is gated by GitHub's own environment protection rule, which requires a configured human approver before the job runs at all. That alone is not enough to guarantee separation of duties: by default GitHub does not stop the person who triggered the workflow from also being the required reviewer who approves their own promotion. The environment's protection settings must explicitly enable "Prevent self-review" for the approver to be guaranteed distinct from whoever pushed the change; without that setting turned on, a developer with reviewer permissions could approve their own promotion, which would defeat the entire point of this control. With it enabled, "developers can build and push but cannot promote" becomes an actually-enforced permission boundary rather than a documented convention someone could bypass.
Signature verification and least-privilege runner identities
The promotion job re-verifies the image's signature before retagging it for production, so promotion depends on the signature actually being valid at promotion time, not merely on trusting that the build job signed it correctly earlier. For keyless verification, cosign verify requires both a certificate-identity match and a certificate-OIDC-issuer match (here, GitHub Actions' own OIDC issuer); a verify command that supplies only the identity regex and omits the issuer will fail with a missing-required-flag error rather than silently passing, so both flags have to be present for the check to run at all. Each job uses its own scoped permissions block (least privilege per job, following GitHub Actions' job-level permission model) rather than one broad permission set shared across the whole workflow.
Trade-offs
Requiring a re-verification of the signature at promotion time, rather than trusting the build job's own signing step, is a small amount of redundant work but is exactly what prevents a compromised or buggy build job from being able to push an unsigned or improperly-signed image straight to the production tag by skipping its own signing step. Similarly, explicitly enabling "Prevent self-review" costs nothing beyond a one-time configuration change, but skipping it leaves the entire separation-of-duties guarantee resting on an assumption about GitHub's default behavior that does not actually hold; the promotion job's independent signature check plus the self-review-blocked environment rule together are what actually enforce the separation, not just the presence of a signing step and an approval gate somewhere in the pipeline.
Assess the pros and cons of automatically blocking PR merges for vulnerabilities above a CVSS threshold vs allowing merges and auto-creating prioritized remediation tickets. Consider developer productivity, attack window, context-aware exploitability, and false positives. Recommend a policy that balances security and velocity and describe an exception process.
Sample Answer
Auto-blocking on a raw CVSS (Common Vulnerability Scoring System) threshold and auto-creating a ticket both fail in the same direction if applied blindly: CVSS alone doesn't distinguish a theoretical, unreachable finding from an actively-exploited one, so a policy built purely on that score either blocks too aggressively or lets real risk slide through as 'just a ticket'.
Pros and cons of each
Auto-blocking on CVSS threshold: strong guarantee (nothing above the threshold ever ships without explicit action), but high false-positive cost, since CVSS alone doesn't account for whether the vulnerable code path is actually reachable in this specific application; blocking on raw CVSS routinely stops merges for findings that pose no practical risk in context, which is exactly the pattern that erodes developer trust in the gate.
Allow-merge-plus-ticket: preserves developer velocity and avoids blocking on unreachable findings, but risks a genuinely dangerous, actively-exploited vulnerability shipping to production while its ticket sits in a backlog with no enforced urgency, especially if the ticket has no real deadline or escalation path.
Considering developer productivity, attack window, and context-aware exploitability
The honest resolution isn't picking one policy over the other uniformly, but making the blocking decision a function of BOTH severity and reachability/exploitability together: a CRITICAL, actively-exploited, reachable finding blocks the merge outright regardless of any velocity cost, since the attack-window cost of shipping it clearly outweighs the delay cost of fixing it now; a HIGH-CVSS but unreachable or theoretical finding becomes a tracked, SLA-bound ticket rather than a blocker, since blocking here buys little real risk reduction for a real velocity cost.
A balanced policy
Block automatically only on the combination of high severity AND either confirmed reachability or known active exploitation; everything else routes to a ticket with a severity-tiered SLA (days for the highest tier, weeks for lower tiers) and an escalation path if the SLA is missed, so 'just a ticket' still carries real enforced urgency rather than becoming an indefinitely-deferred backlog item.
An exception process
Even a rule this well-calibrated will occasionally need a genuine, documented exception (a finding that's technically reachable but mitigated by a compensating control elsewhere the automated policy can't see); the exception needs an owner, a stated reason, a re-review date, and visibility to the security team, following the same pattern used for every other exception mechanism discussed in this topic.
Trade-offs
This combined-criteria policy is more sophisticated to implement (it requires reachability analysis, not just a CVSS lookup) than either pure-blocking or pure-ticketing alone, but it's the calibration that actually distinguishes real risk from noise, which is the entire point of moving past CVSS-only gating in the first place.
Unlock Full Question Bank
Get access to all Secure Software Delivery: DevSecOps, Pipeline, and Supply Chain Security interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.