-
Bug
-
Resolution: Not A Defect
-
Major
-
None
-
Jenkins 2.89.1
Email Extension Plugin 2.61
Script Security Plugin 1.38
Groovy Plugin 2.0
I had defined a working email extension in one of my templates that fired off emails in certain cases. This extension defined the following groovy pre-send script:
def getReplacementIndicatorFile(subproject) {
if (subproject == null) {
build.getWorkspace().child('build').child('replaceInfo.txt')
} else {
build.getWorkspace().child(subproject).child('build').child('replaceInfo.txt')
}
}
if (this.hasProperty("RAWSUB")) {
def replaceInfoFile = getReplacementIndicatorFile("${RAWSUB}")
logger.println("replaceInfoFile=${replaceInfoFile}")
if (replaceInfoFile.exists()) {
msg.text = replaceInfoFile.readToString()
} else {
cancel = true
}
} else {
cancel = true
}
This script now fails with the following error:
Pre-send script tried to access secured objects: classpath entry file:/ is a class directory, which are not allowed.
ERROR: Could not send email as a part of the post-build publishers.
org.jenkinsci.plugins.scriptsecurity.scripts.UnapprovedClasspathException: classpath entry file:/ is a class directory, which are not allowed.
at org.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval.using(ScriptApproval.java:570)
at hudson.plugins.emailext.ExtendedEmailPublisher.expandClasspath(ExtendedEmailPublisher.java:678)
at hudson.plugins.emailext.ExtendedEmailPublisher.executeScript(ExtendedEmailPublisher.java:620)
at hudson.plugins.emailext.ExtendedEmailPublisher.executePresendScript(ExtendedEmailPublisher.java:573)
at hudson.plugins.emailext.ExtendedEmailPublisher.sendMail(ExtendedEmailPublisher.java:456)
at hudson.plugins.emailext.ExtendedEmailPublisher._perform(ExtendedEmailPublisher.java:441)
at hudson.plugins.emailext.ExtendedEmailPublisher.perform(ExtendedEmailPublisher.java:349)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690)
at hudson.model.Build$BuildExecution.cleanUp(Build.java:196)
at hudson.model.Run.execute(Run.java:1771)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:421)
Finished: SUCCESS
Since my script says nothing about the classpath, I wonder what I would need to do to set up a classpath for my script that does not produce this error. Why is file:/ the default classpath?
Also, nothing is available in the script approval page that I can approve to get around this.
This issue was not present prior to the upgrade to the above versions.
I just attempted to reproduce and was unable to