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

Developers can edit the Jenkinsfile in a PR to disable the security scan stage. How do you prevent it?

AdvancedScenarioJenkins Shared Libraries, Credentials and Security
Answer

Situation read → The pipeline is controlled by the people it is meant to police.

What I'd do →

  1. Make mandatory stages part of a shared-library "golden pipeline" that teams call, e.g. standardPipeline(config).
  2. Protect the Jenkinsfile and the library with CODEOWNERS and branch protection.
  3. Add a required status check that runs the scan independently from the repo's own pipeline.
  4. Verify in the admission or deploy step that the artifact carries a scan attestation.

Why → Controls must live outside the code under review.

Interview tip → Attestation checked at deploy time is the unbypassable control.

All CI/CD questions

More on Jenkins Shared Libraries, Credentials and Security