Interview Prep/CI/CD/Secrets and Credentials

How do you prevent secrets from leaking into build logs?

IntermediateProductionSecrets and Credentials
Answer

Use the platform's masking (GitHub ::add-mask::, GitLab masked variables, Jenkins credentials binding), never set -x around secret use, avoid passing secrets on command lines (visible in process lists; use stdin or env vars), disable verbose/debug flags in production pipelines, don't cat config files that contain tokens, and scan logs and artifacts for secrets. Masking works by exact match, so transformed values (base64, URL-encoded, split) are not masked.

echo "$REGISTRY_TOKEN" | docker login ghcr.io -u "$USER" --password-stdin
All CI/CD questions

More on Secrets and Credentials