A team wants to store a long-lived GitHub personal access token in Jenkins for checkouts. What is better?
IntermediateScenarioJenkins Shared Libraries, Credentials and Security
Answer
Situation read → PATs tie access to a person and rarely expire.
What I'd do →
- Use a GitHub App with the GitHub Branch Source plugin; installation tokens are short-lived and scoped to repos.
- If an app is not possible, use a machine user with fine-grained read-only token and an expiry date.
- Store it as a folder-scoped credential.
Why → GitHub App tokens are repo-scoped, short-lived, and independent of employees leaving.
Interview tip → Offboarding an engineer should never break CI.
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