What is the Groovy sandbox and script approval in Jenkins?

AdvancedConceptJenkins
Answer

Pipeline Groovy runs in a sandbox that only allows a whitelist of safe methods. When a Jenkinsfile calls something outside the whitelist, the build fails with RejectedAccessException: Scripts not permitted to use method ... and an administrator must approve the signature under Manage Jenkins > In-process Script Approval.

Trusted shared libraries (configured globally, not "load implicitly from SCM for untrusted users") run outside the sandbox, which is why only admins should be able to change them. Approving dangerous signatures like Runtime.exec effectively gives the pipeline author control of the controller JVM.

All CI/CD questions

More on Jenkins