The security team wants all build agents to have no internet access except to approved registries. How do you implement it?
AdvancedScenarioCredentials & security
Answer
Situation read → Egress control for CI.
What I'd do →
- Kubernetes NetworkPolicy in the agents namespace: default-deny egress, allow DNS, the Jenkins service, Nexus/Artifactory, the container registry and SonarQube.
- Route all dependency downloads through the repository manager (which has internet access and scans packages).
- For cloud APIs, use VPC endpoints.
- Monitor denied flows to find breakage.
Why → Blocks exfiltration and dependency confusion attacks while keeping builds working.
Interview tip → Mention that this also improves reproducibility because everything is proxied.
More on Credentials & security
What credential types does Jenkins support out of the box?BeginnerWhat is the difference between Global and System credential scope?IntermediateHow do folder-scoped credentials help multi-team controllers?IntermediateHow does Jenkins mask secrets in logs and what are its limits?AdvancedWhat authorization strategies are available?IntermediateWhat are the key permissions to understand in matrix auth?Intermediate