PRs from forks must be built, but the security team is worried about secrets. How do you configure it?
AdvancedScenarioShared libraries & multibranch
Answer
Situation read → Fork PRs run untrusted code; the Jenkinsfile and build scripts can be attacker-controlled.
What I'd do →
- Set fork PR trust to "From users with Admin or Write permission" (or Nobody), so untrusted forks run the target branch's Jenkinsfile.
- Remember the target Jenkinsfile still runs the fork's code (tests, build scripts), so do not bind any secrets in PR stages.
- Run PR builds on a separate, isolated agent pool (different namespace or cluster, no network to internal systems).
- Require a maintainer comment or label to trigger builds for first-time contributors.
Why → Trust settings protect the pipeline definition, not the code it executes; isolation protects the rest.
Interview tip → This "trusted Jenkinsfile, untrusted code" distinction is what interviewers want to hear.
More on Shared libraries & multibranch
A shared library change merged to `main` broke 200 pipelines within minutes. How do you prevent a repeat?IntermediateYou want to test a library branch against a real app pipeline without affecting anyone. How?BeginnerEvery app repo has its own pod YAML for builds, and they all drift. How do you standardize?IntermediateSecurity wants every pipeline to run a secret scan, even if teams forget to add it. How?AdvancedA multibranch project has 600 stale branch jobs and the folder page takes 30 seconds to load. What do you do?BeginnerA new org with 150 repositories wants Jenkins builds for every repo with a Jenkinsfile, without tickets to the platform team. What do you set up?Intermediate