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

GString map identifiers don't work in sandboxed Groovy code

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • script-security-plugin
    • None
    • Script Security 1.33

      The following code will fail in non-CPS-transformed sandboxed Groovy, but will pass in CPS-transformed-and-sandboxed Groovy or vanilla Groovy:

      def m = [fruitA: 'apple', fruitB: 'banana']
      
      def bKey = 'B'
      
      assert m."fruitB" == m."fruit${bKey}"

      That's obviously wrong. Not sure yet where the problem is happening but will dig.

          [JENKINS-46327] GString map identifiers don't work in sandboxed Groovy code

          Andrew Bayer created issue -
          Andrew Bayer made changes -
          Remote Link New: This issue links to "test reproducing included in script-security PR #143 (Web Link)" [ 17497 ]
          Andrew Bayer made changes -
          Description Original: The following code will fail in non-CPS-transformed sandboxed Groovy, but will pass in CPS-transformed-and-sandboxed Groovy or vanilla Groovy:
          {code:groovy}
          def m = [fruitA: 'apple', fruitB: 'banana']

          def bKey = 'B'

          assert m."fruitB" == m."fruit${bKey}"{code}

          That's obviously wrong. Not sure yet where the problem is happening but will dig.
          New: The following code will fail in non-CPS-transformed sandboxed Groovy, but will pass in CPS-transformed-and-sandboxed Groovy or vanilla Groovy:
          {code:java}
          def m = [fruitA: 'apple', fruitB: 'banana']

          def bKey = 'B'

          assert m."fruitB" == m."fruit${bKey}"{code}

          That's obviously wrong. Not sure yet where the problem is happening but will dig.
          Andrew Bayer made changes -
          Assignee Original: Andrew Bayer [ abayer ]

            Unassigned Unassigned
            abayer Andrew Bayer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: