I have a pipeline which fails on script approval:

Scripts not permitted to use method org.jenkinsci.plugins.workflow.support.actions.EnvironmentAction getEnvironment. Administrators can decide whether to approve or reject this signature.
[Pipeline] End of Pipeline
[BFA] Scanning build for known causes...
[BFA] No failure causes found
[BFA] Done. 0s
[JobCompletedListener] Build result is: FAILURE
org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use method org.jenkinsci.plugins.workflow.support.actions.EnvironmentAction getEnvironment

I went to in scriptApproval screen, approved the below:

signature: method org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper getRawBuild     
signature: method java.net.URL getProtocol
signature: method java.lang.Throwable printStackTrace
signature: method org.jenkinsci.plugins.workflow.support.actions.EnvironmentAction getEnvironment

but on the next run I'm getting the exact same error, and approval request in scriptApproval screen, comes up again. any idea what is the root cause of this behavior? is there a workaround for it?

Jenkins is running as a container, and the Security plugin version is 1.60. BTW, the same job works perfect on other Jenkins which is VM

  • Did you try to restart Jenkins ?
    – Hedi Nasr
    Mar 3, 2020 at 15:09
  • does it still fail if you run outside of the sandbox?
    – Alex
    Mar 3, 2020 at 15:16
  • @Alex it runs groovy file from bitbucket. I don't have the option of disabling the sandbox
    – arielma
    Mar 3, 2020 at 15:40
  • Can you test it directly in jenkins once to see if you’re having the same issue?
    – Alex
    Mar 3, 2020 at 17:22
  • I don't think this is the issue, as it works as well on other Jenkins. the only difference is that the other one is VM, while this is a container.
    – arielma
    Mar 3, 2020 at 22:17

1 Answer 1


The issue was with the wrong UID and GID of the user. after I've changed it from jenkins to 1000 1000 recursively, issue solved.

  • Can you elaborate? I experience the same issue. UID GID of user where? in the filesystem? can you explain?
    – Moshe
    Sep 30, 2020 at 13:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.