Credentials are stored in Jenkins; the security team wants no long-lived cloud keys at all.
AdvancedScenarioJenkins Shared Libraries, Credentials and Security
Answer
Situation read → Replace static keys with short-lived identity.
What I'd do →
- Run agents on EC2/EKS with an IAM role (instance profile or IRSA / Pod Identity); the AWS SDK then uses temporary credentials.
- For cross-account access use
sts assume-rolewith a limited session duration. - Remove access-key credentials from the credentials store and rotate the old keys out.
- Where a secret must exist, source it from Vault or AWS Secrets Manager at runtime.
Why → No stored keys means nothing to leak, and permissions are scoped to the agent identity.
Interview tip → Say "workload identity" and mention least privilege per pipeline type.
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?BeginnerA 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.IntermediateThe team wants the Jenkins configuration reproducible and reviewable. What tooling do you use?Intermediate