Interview Prep/Jenkins/Credentials, permissions & script approval

`java.lang.SecurityException: Rejecting unsandboxed script` or `UnapprovedUsageException: script not yet approved for use`

IntermediateTroubleshootingCredentials, permissions & script approval
Answer

Likely causes → A pipeline configured with "Use Groovy Sandbox" unchecked (inline script) by a non-admin, so the whole script needs admin approval; or Job DSL scripts with script security enabled.

Diagnose → Job config sandbox checkbox; pending items in In-process Script Approval.

Fix → Enable the sandbox for the job, or have an admin review and approve the whole script (only for trusted content).

Prevent → Pipelines from SCM always use the sandbox; admin-only for unsandboxed scripts.

All Jenkins questions Roadmap: Jenkins

More on Credentials, permissions & script approval