timja / jenkins-gh-issues-poc-06-18

0 stars 0 forks source link

[JENKINS-48922] Groovy PostBuild plugin is not compatible with JEP-200 #9570

Closed timja closed 6 years ago

timja commented 6 years ago

As reported by markewaite in https://groups.google.com/forum/#!topic/jenkinsci-dev/EALjDtS4riU

ConversionException: Refusing to unmarshal textBuilder for security reasons; see https://jenkins.io/redirect/class-filter/ 
---- Debugging information ---- 
class : java.lang.StringBuilder 
required-type : java.lang.StringBuilder 
converter-type : hudson.util.XStream2$BlacklistedTypesConverter 
path : /flow-build/actions/org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildSummaryAction/textBuilder 
line number : 120 
-------------------------------

It happens because the plugin serializes StringBuilder to the disk in the action.

The system log includes the following information:

Jan 13, 2018 5:00:30 AM org.jenkinsci.plugins.workflow.cps.CpsFlowExecution notifyListeners
WARNING: null
java.io.IOException: java.lang.RuntimeException: Failed to serialize hudson.model.Actionable#actions for class org.jenkinsci.plugins.workflow.job.WorkflowRun
at hudson.XmlFile.write(XmlFile.java:201)
at org.jenkinsci.plugins.workflow.support.PipelineIOUtils.writeByXStream(PipelineIOUtils.java:30)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.save(WorkflowRun.java:1067)
at hudson.BulkChange.commit(BulkChange.java:98)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.notifyListeners(CpsFlowExecution.java:1346)
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$3.run(CpsThreadGroup.java:412)
at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$1.run(CpsVmExecutorService.java:35)
at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: Failed to serialize hudson.model.Actionable#actions for class org.jenkinsci.plugins.workflow.job.WorkflowRun
at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:256)
at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:224)
at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:138)
at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:209)
at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:150)
at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:82)
at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:37)
at com.thoughtworks.xstream.XStream.marshal(XStream.java:1026)
at com.thoughtworks.xstream.XStream.marshal(XStream.java:1015)
at com.thoughtworks.xstream.XStream.toXML(XStream.java:988)
at hudson.XmlFile.write(XmlFile.java:194)
... 13 more
Caused by: java.lang.RuntimeException: Failed to serialize org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildSummaryAction#textBuilder for class org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildSummaryAction
at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:256)
at hudson.util.RobustReflectionConverter$2.visit(RobustReflectionConverter.java:224)
at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:138)
at hudson.util.RobustReflectionConverter.doMarshal(RobustReflectionConverter.java:209)
at hudson.util.RobustReflectionConverter.marshal(RobustReflectionConverter.java:150)
at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:88)
at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64)
at com.thoughtworks.xstream.converters.collections.CollectionConverter.marshal(CollectionConverter.java:74)
at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
at hudson.util.RobustReflectionConverter.marshallField(RobustReflectionConverter.java:265)
at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:252)
... 26 more
Caused by: java.lang.UnsupportedOperationException: Refusing to marshal java.lang.StringBuilder for security reasons; see https://jenkins.io/redirect/class-filter/
at hudson.util.XStream2$BlacklistedTypesConverter.marshal(XStream2.java:530)
at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
at hudson.util.RobustReflectionConverter.marshallField(RobustReflectionConverter.java:265)
at hudson.util.RobustReflectionConverter$2.writeField(RobustReflectionConverter.java:252)
... 41 more

Originally reported by oleg_nenashev, imported from: Groovy PostBuild plugin is not compatible with JEP-200
  • assignee: oleg_nenashev
  • status: Resolved
  • priority: Critical
  • resolution: Fixed
  • resolved: 2018-01-14T09:19:00+00:00
  • imported: 2022/01/10
timja commented 6 years ago

jglick:

Probably textBuilder should be transient or a String.

timja commented 6 years ago

markewaite:

I confirmed that the change to Jenkins core resolves the message.

timja commented 6 years ago

oleg_nenashev:

Resolved by the Jenkins Core patch

timja commented 6 years ago

scm_issue_link:

Code changed in jenkins
User: Oleg Nenashev
Path:
pom.xml
http://jenkins-ci.org/commit/groovy-postbuild-plugin/6fd0cd8a95015e394fc61bae14ab4bcc2cf2bc08
Log:
JENKINS-48922 - Update plugin POM to reproduce the issue in PCT

timja commented 6 years ago

scm_issue_link:

Code changed in jenkins
User: ikedam
Path:
Jenkinsfile
pom.xml
http://jenkins-ci.org/commit/groovy-postbuild-plugin/61f2d13e491ea42a5572590b1903a0acfbfef11c
Log:
Merge pull request #29 from oleg-nenashev/jep-200/pct-compat

JENKINS-48922 - Update plugin to make it runnable in PCT

Compare: https://github.com/jenkinsci/groovy-postbuild-plugin/compare/c2638a586703...61f2d13e491e