Interview CI/CD & GitOps

How do you implement secrets scanning to prevent credentials in commits?

CI/CD & GitOps · Advanced level

Answer

Secrets scanning detects credentials before they land in Git history or before they reach main. I use pre-commit hooks, server-side scanning, GitHub secret scanning, CI checks, and automated revocation or alerting for exposed tokens.

Technical explanation

Masking is a safety net, not a complete control; scripts can still leak secrets through files, command arguments, debug output, or third-party tools.

Prefer scoped, short-lived credentials and store only the minimum secrets needed for that job or environment.

Artifacts should be immutable and addressed by version or digest, with metadata linking them to commit SHA and pipeline run.

Jenkins archived artifacts are convenient for diagnostics, but production deployment should consume from a controlled artifact repository or registry.

Security gates should be policy-driven with documented exception handling; otherwise teams will bypass noisy checks.

Provenance should connect repository, commit, workflow identity, artifact digest, signer identity, and deployment environment.

Hands-on example

1. Design an advanced delivery exercise for: How do you implement secrets scanning to prevent credentials in commits using one service, one Git repository, one artifact registry, and one Kubernetes environment.

2. Build once from a protected branch, generate test reports, SBOM, vulnerability scan results, provenance metadata, and a container image tagged by both semantic version and digest.

3. Sign the image or artifact, verify the signature in the deployment pipeline, and promote the same digest through dev, staging, and production without rebuilding.

4. Use progressive exposure where relevant: feature flag off by default, canary 5%, automated metric check for error rate and latency, then expand or rollback.

5. Record audit evidence: PR, approver, pipeline run, artifact digest, SBOM location, signature verification result, deployment event, and rollback or forward-fix decision.

Preparing for an interview?

Check how well your resume matches the role with our free resume checker— match score, ATS check, and the skills you're missing.

More CI/CD & GitOps interview questions

← All CI/CD & GitOps questions