Skip to content

[JENKINS-75288] scm.browser RejectedAccessException despite method being whitelisted #899

Description

@jenkins-infra-bot

Jenkins is throwing a RejectedAccessException despise the GitSCM.getBrowser() method being whitelisted. SCM.getBrowser() is not whitelisted.

When multiple classes define / overload a method the script-security plugin selects the original declaring class instead of the overloading child class.

Given the following Jenkinsfile multi-branch pipeline backed by git:

pipeline {
    agent any

    stages {
stage('Stage') {
    steps {
script {
    println "class: " + scm.class
    println "browser: " + scm.browser
}
    }
}
    }
}

The error:

13:22:25  [Pipeline] echo
13:22:25  class: class hudson.plugins.git.GitSCM
13:22:25  Scripts not permitted to use method hudson.scm.SCM getBrowser. Administrators can decide whether to approve or reject this signature.
13:22:25  [Pipeline] }
. . .
13:22:25  org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use method hudson.scm.SCM getBrowser
13:22:25  	at PluginClassLoader for script-security//org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.StaticWhitelist.rejectMethod(StaticWhitelist.java:244)
13:22:25  	at PluginClassLoader for script-security//org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.rejectMethod(SandboxInterceptor.java:594)
13:22:25  	at PluginClassLoader for script-security//org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.lambda$onGetProperty$7(SandboxInterceptor.java:302)
13:22:25  	at PluginClassLoader for script-security//org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:386)

See this comment for further analysis.


Originally reported by mrichar2, imported from: scm.browser RejectedAccessException despite method being whitelisted
  • status: Open
  • priority: Major
  • component(s): script-security-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 3
  • imported: 2025-12-09
Raw content of original issue

Jenkins is throwing a RejectedAccessException despise the GitSCM.getBrowser() method being whitelisted. SCM.getBrowser() is not whitelisted.

When multiple classes define / overload a method the script-security plugin selects the original declaring class instead of the overloading child class.

Given the following Jenkinsfile multi-branch pipeline backed by git:

pipeline {
    agent any

    stages {
        stage('Stage') {
            steps {
                script {
                    println "class: " + scm.class
                    println "browser: " + scm.browser
                }
            }
        }
    }
}

The error:

13:22:25  [Pipeline] echo
13:22:25  class: class hudson.plugins.git.GitSCM
13:22:25  Scripts not permitted to use method hudson.scm.SCM getBrowser. Administrators can decide whether to approve or reject this signature.
13:22:25  [Pipeline] }
. . .
13:22:25  org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use method hudson.scm.SCM getBrowser
13:22:25  	at PluginClassLoader for script-security//org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.StaticWhitelist.rejectMethod(StaticWhitelist.java:244)
13:22:25  	at PluginClassLoader for script-security//org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.rejectMethod(SandboxInterceptor.java:594)
13:22:25  	at PluginClassLoader for script-security//org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.lambda$onGetProperty$7(SandboxInterceptor.java:302)
13:22:25  	at PluginClassLoader for script-security//org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:386)

See this comment for further analysis.

environment
Jenkins 2.479.1<br/>
git 5.7.0<br/>
script-security 1369.v9b_98a_4e95b_2d<br/>
workflow-multibranch 800.v5f0a_a_660950e

Metadata

Metadata

Assignees

No one assigned

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions