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

Unhandled PatternSyntaxException within RoleStrategyConfig.doRolesSubmit

    XMLWordPrintable

Details

    Description

      Hello Team,

      I am trying to implement Role based access control , but when i try to add pattern in Manage and Assign Roles getting Logging ID Error 

      For eg : I have multiple projects some are starting with  test and some ending with test ,while I defining pattern as *test* in Manage Roles -> Item Roles , I am getting logging ID error

       

      Jenkins Version : 2.319.1

      Attachments

        Activity

          Please open the Jenkins logs, search for the Logging ID "0d2d58dd-479b-4488-a068-d3699f18fadf" that was shown in Screenshot 2021-12-25 at 5.13.15 PM.png, and post the log entry here. The Logging ID is randomly generated and not useful without the logs.

          The Role-based Authorization Strategy plugin is not yet compatible with the latest version 3.0 of the Matrix Authorization Strategy plugin; see JENKINS-67422. If you have installed that version, please downgrade to Matrix Authorization Strategy 2.6.11 until a compatible version of Role-based Authorization Strategy is released. You may also have to downgrade the Azure AD plugin to version 185.v3b416408dcb1 if you use that.

          kon Kalle Niemitalo added a comment - Please open the Jenkins logs, search for the Logging ID "0d2d58dd-479b-4488-a068-d3699f18fadf" that was shown in Screenshot 2021-12-25 at 5.13.15 PM.png , and post the log entry here. The Logging ID is randomly generated and not useful without the logs. The Role-based Authorization Strategy plugin is not yet compatible with the latest version 3.0 of the Matrix Authorization Strategy plugin; see JENKINS-67422 . If you have installed that version, please downgrade to Matrix Authorization Strategy 2.6.11 until a compatible version of Role-based Authorization Strategy is released. You may also have to downgrade the Azure AD plugin to version 185.v3b416408dcb1 if you use that.
          kon Kalle Niemitalo added a comment - - edited

          Oh right, *test* is not a valid Java regular expression pattern.
          Perhaps you need .*test.* or just test instead. I don't remember whether the plugin anchors those patterns by default.

          On the other hand, the plugin should surely handle this error better and tell the user what the problem is.

          kon Kalle Niemitalo added a comment - - edited Oh right, *test* is not a valid Java regular expression pattern. Perhaps you need .*test.* or just test instead. I don't remember whether the plugin anchors those patterns by default. On the other hand, the plugin should surely handle this error better and tell the user what the problem is.

          I see the error only occurs when I try to save or apply the settings with the invalid pattern, not yet when I add the pattern to the grid. Retitling this issue.

          kon Kalle Niemitalo added a comment - I see the error only occurs when I try to save or apply the settings with the invalid pattern, not yet when I add the pattern to the grid. Retitling this issue.

          Stack trace from Role-based Authorization Strategy 3.2.0:

          Caught unhandled exception with ID f4e8b446-b021-4363-8c32-88982d69b33b
          java.util.regex.PatternSyntaxException: Dangling meta character '*' near index 0
          *test*
          ^
          	at java.base/java.util.regex.Pattern.error(Unknown Source)
          	at java.base/java.util.regex.Pattern.sequence(Unknown Source)
          	at java.base/java.util.regex.Pattern.expr(Unknown Source)
          	at java.base/java.util.regex.Pattern.compile(Unknown Source)
          	at java.base/java.util.regex.Pattern.<init>(Unknown Source)
          	at java.base/java.util.regex.Pattern.compile(Unknown Source)
          	at com.michelin.cio.hudson.plugins.rolestrategy.Role.<init>(Role.java:90)
          	at com.michelin.cio.hudson.plugins.rolestrategy.RoleBasedAuthorizationStrategy$DescriptorImpl.readRoles(RoleBasedAuthorizationStrategy.java:836)
          	at com.michelin.cio.hudson.plugins.rolestrategy.RoleBasedAuthorizationStrategy$DescriptorImpl.newInstance(RoleBasedAuthorizationStrategy.java:784)
          	at com.michelin.cio.hudson.plugins.rolestrategy.RoleBasedAuthorizationStrategy$DescriptorImpl.doRolesSubmit(RoleBasedAuthorizationStrategy.java:697)
          	at com.michelin.cio.hudson.plugins.rolestrategy.RoleStrategyConfig.doRolesSubmit(RoleStrategyConfig.java:150)
          	at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(Unknown Source)
          	at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:393)
          	at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:405)
          	at org.kohsuke.stapler.interceptor.RequirePOST$Processor.invoke(RequirePOST.java:77)
          	at org.kohsuke.stapler.PreInvokeInterceptedFunction.invoke(PreInvokeInterceptedFunction.java:26)
          	at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:208)
          	at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:141)
          	at org.kohsuke.stapler.MetaClass$11.doDispatch(MetaClass.java:536)
          	at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
          	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:766)
          
          kon Kalle Niemitalo added a comment - Stack trace from Role-based Authorization Strategy 3.2.0: Caught unhandled exception with ID f4e8b446-b021-4363-8c32-88982d69b33b java.util.regex.PatternSyntaxException: Dangling meta character '*' near index 0 *test* ^ at java.base/java.util.regex.Pattern.error(Unknown Source) at java.base/java.util.regex.Pattern.sequence(Unknown Source) at java.base/java.util.regex.Pattern.expr(Unknown Source) at java.base/java.util.regex.Pattern.compile(Unknown Source) at java.base/java.util.regex.Pattern.<init>(Unknown Source) at java.base/java.util.regex.Pattern.compile(Unknown Source) at com.michelin.cio.hudson.plugins.rolestrategy.Role.<init>(Role.java:90) at com.michelin.cio.hudson.plugins.rolestrategy.RoleBasedAuthorizationStrategy$DescriptorImpl.readRoles(RoleBasedAuthorizationStrategy.java:836) at com.michelin.cio.hudson.plugins.rolestrategy.RoleBasedAuthorizationStrategy$DescriptorImpl.newInstance(RoleBasedAuthorizationStrategy.java:784) at com.michelin.cio.hudson.plugins.rolestrategy.RoleBasedAuthorizationStrategy$DescriptorImpl.doRolesSubmit(RoleBasedAuthorizationStrategy.java:697) at com.michelin.cio.hudson.plugins.rolestrategy.RoleStrategyConfig.doRolesSubmit(RoleStrategyConfig.java:150) at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(Unknown Source) at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:393) at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:405) at org.kohsuke.stapler.interceptor.RequirePOST$Processor.invoke(RequirePOST.java:77) at org.kohsuke.stapler.PreInvokeInterceptedFunction.invoke(PreInvokeInterceptedFunction.java:26) at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:208) at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:141) at org.kohsuke.stapler.MetaClass$11.doDispatch(MetaClass.java:536) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:766)

          java.util.regex.PatternSyntaxException is a subtype of java.lang.RuntimeException so it is an unchecked exception.

          kon Kalle Niemitalo added a comment - java.util.regex.PatternSyntaxException is a subtype of java.lang.RuntimeException so it is an unchecked exception.

          People

            oleg_nenashev Oleg Nenashev
            sivareddyvenna sivareddyvenna venna
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: