Why am I unable to see a method in In-process Script Approval?

Issue

  • You have received a RejectedAccessException error (e.g., org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use method)
  • The method does not show up in Manage Jenkins > In-process Script Approval for approval

Environment

Resolution

Case 1: The method is included in the Script Security Blacklist.

The method is dangerous, will not be available for approval, and can not be approved.

Case 2: The method is wrapped in a try/catch block and gets suppressed.

The method will not show up when written as:

try {
    //Method Requiring Script Approval Here
} catch(e) {
    echo 'There was an error'
}

You will need to re-throw the exception to propagate the error to In-process Script Approval:

try {
    //Method Requiring Script Approval Here
} catch(e) {
    if (e instanceof RejectedAccessException) {
        throw e
    }
}

This can also be written as:

try {
    //Method Requiring Script Approval Here
} catch(RejectedAccessException e) {
    throw e	
} catch(e) {
    echo 'There was an error'
}

Jenkins issue

References

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.