[JIRA] (JENKINS-42801) Can't access "include" or "list" in parallel test executor. Security exceptions thrown.

3 views
Skip to first unread message

ghs1@3ds.com (JIRA)

unread,
Mar 15, 2017, 6:42:02 AM3/15/17
to jenkinsc...@googlegroups.com
g hs1 created an issue
 
Jenkins / Bug JENKINS-42801
Can't access "include" or "list" in parallel test executor. Security exceptions thrown.
Issue Type: Bug Bug
Assignee: Unassigned
Components: parallel-test-executor-plugin
Created: 2017/Mar/15 10:41 AM
Environment: Win2008 R2. Jenkins 2.49. Latest plugins.
Priority: Critical Critical
Reporter: g hs1

Jenkins throws security exceptions when trying to access "split.includes" or "split.list", as described in examples such as [this|https://jenkins.io/blog/2016/06/16/parallel-test-executor-plugin/.]

There's no apparent way around the exceptions and it's not clear how to make it work in other ways.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
Atlassian logo

ghs1@3ds.com (JIRA)

unread,
Mar 15, 2017, 6:46:01 AM3/15/17
to jenkinsc...@googlegroups.com
g hs1 updated an issue
Change By: g hs1
Jenkins throws security exceptions when trying to access "split.includes" or "split.list", as described in examples such as [this|[https://jenkins.io/blog/2016/06/16/parallel-test-executor-plugin/] . ] .

There's no apparent way around the exceptions and it's not clear how to make it work in other ways.

ghs1@3ds.com (JIRA)

unread,
Mar 15, 2017, 6:47:01 AM3/15/17
to jenkinsc...@googlegroups.com
g hs1 updated an issue
Jenkins throws security exceptions when trying to access "split.includes" or "split.list", as described in examples such as [this| [ https://jenkins.io/blog/2016/06/16/parallel-test-executor-plugin/] ]
.

There's no apparent way around the exceptions and it's not clear how to make it work in other ways.

christian.ciach@gmail.com (JIRA)

unread,
Apr 26, 2018, 11:08:02 AM4/26/18
to jenkinsc...@googlegroups.com
Christian Ciach commented on Bug JENKINS-42801
 
Re: Can't access "include" or "list" in parallel test executor. Security exceptions thrown.

After updating Jenkins and some plugins to the current version today, I encounter this issue, too. I didn't change anything in my Jenkinsfile.

Part of the stacktrace is:

org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: No such field found: field java.lang.String list
    at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.unclassifiedField(SandboxInterceptor.java:397)

Trying to debug this, i used this snipped inside my Jenkinsfile:

 

    def splits = splitTests parallelism: count(6)
    echo "Class of splits is ${splits.class}"
    for (int i = 0; i < splits.size(); i++) {
      def num = i
      def split = splits.get(num)
      echo "Class of split ${num} is ${split.class}"
{{    }}}

 

I expected the list elements to be of type InclusionExclusionPattern, but instead the output is this:

[Pipeline] echo
Class of splits is class java.util.ArrayList
[Pipeline] echo
Class of split 0 is class java.util.Collections$UnmodifiableRandomAccessList
[Pipeline] echo
Class of split 1 is class java.util.Collections$UnmodifiableRandomAccessList
[Pipeline] echo
Class of split 2 is class java.util.Collections$UnmodifiableRandomAccessList
[Pipeline] echo
Class of split 3 is class java.util.Collections$UnmodifiableRandomAccessList
[Pipeline] echo
Class of split 4 is class java.util.Collections$UnmodifiableRandomAccessList
[Pipeline] echo
Class of split 5 is class java.util.Collections$UnmodifiableRandomAccessList

In fact, these are lists of Strings. I have no idea how this could happen.

christian.ciach@gmail.com (JIRA)

unread,
Apr 26, 2018, 11:28:03 AM4/26/18
to jenkinsc...@googlegroups.com

Actually, I don't fully understand why it worked for me ever before. I do not use inclusions (and never have, I checked our SCM), so, according to SplitStep.Execution.run() I should have gotten List<List<String>> as the return type, not List<InclusionExclusionPattern>.

 

My best guess is that "split.list.join("\n")" worked before for me, because Jenkins allowed me to access the private field "list" inside "UnmodifiableList".

 

Long story short: When not letting the plugin generate inclusions, the return type of "splitTests" is "List<List<String>>" instead of "List<InclusionExclusionPattern>". If this is not documented, it should have been.

christian.ciach@gmail.com (JIRA)

unread,
Apr 26, 2018, 11:30:02 AM4/26/18
to jenkinsc...@googlegroups.com
Christian Ciach edited a comment on Bug JENKINS-42801
{{ Actually, I don't fully understand why it worked for me ever before. I do not use inclusions (and never have, I checked our SCM), so, according to  {{ SplitStep.Execution.run() }} I should have gotten  {{ List<List<String>> }} as the return type, not {{ List<InclusionExclusionPattern> . }} .

 

My best guess is that "  {{ split.list.join("\n") " }}
worked before for me, because Jenkins allowed me to access the private field "list" inside "UnmodifiableList".

 

Long story short: When not letting the plugin generate inclusions, the return type of
"  {{ splitTests " }} is "  {{ List<List<String>> " }} instead of "List< {{ List< InclusionExclusionPattern> " }} . If this is not documented, it should have been .}} :)

christian.ciach@gmail.com (JIRA)

unread,
Apr 26, 2018, 11:32:02 AM4/26/18
to jenkinsc...@googlegroups.com
Christian Ciach edited a comment on Bug JENKINS-42801
Actually, I don't fully understand why it worked for me ever before. I do not use inclusions (and never have, I checked our SCM), so, according to {{SplitStep.Execution.run()}} I should have gotten {{List<List<String>>}} as the return type, not {{List<InclusionExclusionPattern>}}.

My best guess is that {{split.list.join("\n")}} worked before for me before , because Jenkins allowed me to access the private field "list" inside "UnmodifiableList".

 

Long story short: When not letting the plugin generate inclusions, the return type of {{splitTests}} is {{List<List<String>>}} instead of {{List<InclusionExclusionPattern>}}. If this is not documented, it should have been :)

yoshimoto@intra-mart.jp (JIRA)

unread,
Sep 7, 2019, 8:22:04 AM9/7/19
to jenkinsc...@googlegroups.com

Hi Christian Ciach

I also encountered the same problem. Apparently, the return type has changed due to the following modifications. However, this seems to affect only if the generateInclusions option is false.

https://github.com/jenkinsci/parallel-test-executor-plugin/commit/fce5c452cf2d683472049cfa313b821f2f7c131d#diff-edac883320f661584226d7e57aa70dd8

https://github.com/jenkinsci/parallel-test-executor-plugin/pull/14#discussion-diff-36798939

https://github.com/jenkinsci/parallel-test-executor-plugin/pull/14

 

Incidentally, this behavior itself is explained in the document. However, there seems to be no announcement that compatibility is broken.
https://jenkins.io/doc/pipeline/steps/parallel-test-executor/#splittests-split-test-runs

 

If disabled, the splitStep call will return a List<List<String>> containing the exclusion patterns for the different buckets.
If enabled, the splitStep call won't return a List<List<String>>.
Instead it will return a List of a structure with :

boolean includes whether the following list is an inclusion or an exclusion list List<String> list the list of patterns
 

 

This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)
Reply all
Reply to author
Forward
0 new messages