Global vs folder-level vs ad hoc libraries: what is the security difference?
AdvancedConceptShared libraries
Answer
- Global libraries (Manage Jenkins > System) are trusted: they run outside the Groovy sandbox with full controller access. Only admins can configure them, and whoever can push to the library repo effectively has admin.
- Folder-level libraries are untrusted: they run in the sandbox, like Jenkinsfiles, so script approval applies.
- Ad hoc libraries loaded with
library identifier:from arbitrary repos are untrusted too.
Protect trusted library repos with branch protection, required reviews and tags.
More on Shared libraries
What is the directory structure of a shared library?BeginnerHow does a `vars/` global step work?BeginnerWhat goes in `src/` and how is it used?IntermediateHow do classes in `src/` call pipeline steps?IntermediateWhat is `libraryResource` used for?IntermediateWhat are the ways to load a library in a Jenkinsfile?Intermediate