Interview Prep/CI/CD/Jenkins Shared Libraries, Credentials and Security

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 →

  1. Rotate every exposed secret immediately.
  2. Move values to credentials or Vault and non-secret config to environment files.
  3. 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."

All CI/CD questions

More on Jenkins Shared Libraries, Credentials and Security