Jenkins:Groovy:脚本不允许使用方法 groovy.lang.GroovyObject getProperty java.lang.String

Jenkins : Groovy : Scripts not permitted to use method groovy.lang.GroovyObject getProperty java.lang.String

org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException:

Scripts not permitted to use method groovy.lang.GroovyObject

getProperty

java.lang.String (com.cccis.telematics.build.Templates.run_jgitflow_template)

at org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.StaticWhitelist.rejectMethod

(StaticWhitelist.java:180)

这里发生的事情是 属性 并不存在,正如所讨论的对象所命名的那样,因此 Groovy 开始内省对象以寻找它。我想允许自省可能会导致安全漏洞。

重现:

class Foo
{
   String FOOSPRoperty
}

def a_method()
{
  Foo f = new Foo()
  f.foosPROPERTY.replace( "x", "y" )
}