Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-46358

Support String.eachMatch, String.findAll in Pipeline

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      I'd like the ability to iterate over regex matches against a string.

      Thus far my attempts at using eachMatch and findAll have both met a similar end:

       

      00:04:43.237 Got exception: org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods eachMatch java.lang.String java.lang.String groovy.lang.Closure [Pipeline] }

        Attachments

          Issue Links

            Activity

            Hide
            busbey Sean Busbey added a comment -

            if anyone has a workaround I can use in the mean time I'd really appreciate it.

            Show
            busbey Sean Busbey added a comment - if anyone has a workaround I can use in the mean time I'd really appreciate it.
            Hide
            abayer Andrew Bayer added a comment -

            Initial PR up at https://github.com/cloudbees/groovy-cps/pull/70 - still need to do the downstream workflow-cps PR to go with it.

            Show
            abayer Andrew Bayer added a comment - Initial PR up at https://github.com/cloudbees/groovy-cps/pull/70 - still need to do the downstream workflow-cps PR to go with it.
            Hide
            abayer Andrew Bayer added a comment -

            Also adding script security PR for whitelisting.

            Show
            abayer Andrew Bayer added a comment - Also adding script security PR for whitelisting.
            Hide
            abayer Andrew Bayer added a comment -

            And downstream PR in workflow-cps up at https://github.com/jenkinsci/workflow-cps-plugin/pull/168

            Show
            abayer Andrew Bayer added a comment - And downstream PR in workflow-cps up at https://github.com/jenkinsci/workflow-cps-plugin/pull/168
            Hide
            abayer Andrew Bayer added a comment -

            fwiw, the core problem here was that StringGroovyMethods has closure methods that weren't being transformed (and those methods weren't whitelisted, which makes sense, since they wouldn't work right!). So now, with this change, we transform the closure methods in StringGroovyMethods, whitelist them, and test. Woo.

            Show
            abayer Andrew Bayer added a comment - fwiw, the core problem here was that StringGroovyMethods has closure methods that weren't being transformed (and those methods weren't whitelisted, which makes sense, since they wouldn't work right!). So now, with this change, we transform the closure methods in StringGroovyMethods , whitelist them, and test. Woo.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Andrew Bayer
            Path:
            src/main/resources/org/jenkinsci/plugins/scriptsecurity/sandbox/whitelists/generic-whitelist
            http://jenkins-ci.org/commit/script-security-plugin/dc9dcd991d18184cd9e93256ebbc8dcda1f54749
            Log:
            JENKINS-46358 Whitelist new StringGroovyMethods

            These will be added to CPS in https://github.com/cloudbees/groovy-cps/pull/70

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: src/main/resources/org/jenkinsci/plugins/scriptsecurity/sandbox/whitelists/generic-whitelist http://jenkins-ci.org/commit/script-security-plugin/dc9dcd991d18184cd9e93256ebbc8dcda1f54749 Log: JENKINS-46358 Whitelist new StringGroovyMethods These will be added to CPS in https://github.com/cloudbees/groovy-cps/pull/70
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Andrew Bayer
            Path:
            src/main/java/org/jenkinsci/plugins/scriptsecurity/sandbox/groovy/SandboxInterceptor.java
            src/main/resources/org/jenkinsci/plugins/scriptsecurity/sandbox/whitelists/generic-whitelist
            src/test/java/org/jenkinsci/plugins/scriptsecurity/sandbox/groovy/SandboxInterceptorTest.java
            http://jenkins-ci.org/commit/script-security-plugin/0226a85c5961c19df0d9df1f721b72e36787f780
            Log:
            Merge pull request #145 from abayer/jenkins-46358

            JENKINS-46358 Whitelist new StringGroovyMethods

            Compare: https://github.com/jenkinsci/script-security-plugin/compare/6ee006972bd1...0226a85c5961

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: src/main/java/org/jenkinsci/plugins/scriptsecurity/sandbox/groovy/SandboxInterceptor.java src/main/resources/org/jenkinsci/plugins/scriptsecurity/sandbox/whitelists/generic-whitelist src/test/java/org/jenkinsci/plugins/scriptsecurity/sandbox/groovy/SandboxInterceptorTest.java http://jenkins-ci.org/commit/script-security-plugin/0226a85c5961c19df0d9df1f721b72e36787f780 Log: Merge pull request #145 from abayer/jenkins-46358 JENKINS-46358 Whitelist new StringGroovyMethods Compare: https://github.com/jenkinsci/script-security-plugin/compare/6ee006972bd1...0226a85c5961

              People

              • Assignee:
                abayer Andrew Bayer
                Reporter:
                busbey Sean Busbey
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: