A Jenkinsfile hardcodes the production URL and keys in the repo. What is the remediation?
BeginnerScenarioJenkins Shared Libraries, Credentials and Security
Answer
Situation read → Secrets committed to Git.
What I'd do →
- Rotate every exposed secret immediately.
- Move values to credentials or Vault and non-secret config to environment files.
- Purge history only after rotation (
git filter-repo) and add pre-commit and CI secret scanning (gitleaks).
Why → Rewriting history does not undo exposure; rotation does.
Interview tip → "Rotate first, clean second."
More on Jenkins Shared Libraries, Credentials and Security
Ten teams copy the same 80-line "build and push image" stage. What do you do?BeginnerA shared library change broke 50 pipelines at once. How do you prevent a repeat?AdvancedA pipeline needs an AWS secret key and a DB password. How do you provide them without exposing them in logs?BeginnerCredentials are stored in Jenkins; the security team wants no long-lived cloud keys at all.AdvancedA developer asks for admin access to Jenkins to "fix their job". How do you handle it?BeginnerA pipeline from a fork PR should not be able to read production credentials.Intermediate