Interview Prep/Jenkins/Scripted pipeline, Groovy & CPS

What does `evaluate` or `GroovyShell` inside a pipeline mean for security?

AdvancedConceptScripted pipeline, Groovy & CPS
Answer

Arbitrary Groovy evaluation in an unsandboxed context (a trusted library, or an admin-approved script) runs with full controller privileges: it can read Jenkins.instance, decrypt credentials, and modify configuration. In a sandboxed Jenkinsfile, such calls are blocked and require script approval. Admins should never approve signatures like staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods execute java.lang.String or new groovy.lang.GroovyShell, because they turn any Jenkinsfile author into a controller admin.

All Jenkins questions Roadmap: Jenkins

More on Scripted pipeline, Groovy & CPS