Uploaded image for project: 'Jira Service Management Data Center'
  1. Jira Service Management Data Center
  2. JSDSERVER-12219

On windows env, Automation Rule Action "Execute Groovy script" is failing with the input validation error "Script file path must be absolute" for the file path

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Low Low
    • None
    • 4.21.0, (17)
      4.22.0, 4.21.1, 4.22.1, 5.0.0, 4.22.2, 4.22.3, 4.22.4, 4.22.6, 5.2.0, 5.3.0, 4.20.14, 5.4.0, 5.3.1, Insight 8.10.13, 4.20.16, 5.5.0, Assets 8.10.15
    • Assets - Automation

      Issue Summary

      On windows env, Automation Action "Execute Groovy script" is failing with the input validation error "Script file path must be absolute"

      This is reproducible on Data Center: yes

       This bug affects Jira Service Management Data Center installations with the bundled Assets/Insight since the Jira Service Management 4.20.14+.  

       This bug also affects the installations which do not come with the bundled Insight/Asset add-on, any Assets/Insight 8.10.13+ from the add-on marketplace listing.

      Steps to Reproduce

      1. Create windows env
      2. Create an automation rule with Execute Groovy script action
      3. Provide the groovy script path and the system will not accept any format of the windows path

      Expected Results

      The correct windows file path must be accepted

      Actual Results

      Due to the below HTML input validation, the file path is being rejected

      <input class="text long-field" type="text" id="atm-rule-item-data-table-absFilePath" name="absFilePath" required="" data-validations="{&quot;^(?:(?!\\.\\.).)+$&quot;:&quot;Script file path must be absolute&quot;,&quot;^\\/.+$&quot;:&quot;Script file path must be absolute&quot;}" value="" title="atm-rule-item-data-table-absFilePath">

      Workaround

      Option 1

      • Open the Developer tool, edit the input field as HTML and remove the validation for saving the file path/rule temporarily. This needs to be done every time you require to save the path.
        • <input class="text long-field" type="text" id="atm-rule-item-data-table-absFilePath" name="absFilePath" required="" data-validations="{&quot;^(?:(?!\\.\\.).)+$&quot;:&quot;Script file path must be absolute&quot;,&quot;^\\/.+$&quot;:&quot;Script file path must be absolute&quot;}" value="" title="atm-rule-item-data-table-absFilePath">

          TO

        • <input class="text long-field" type="text" id="atm-rule-item-data-table-absFilePath" name="absFilePath" required="" value="" title="atm-rule-item-data-table-absFilePath">

      Option 2 (should be done carefully as it can break the insight jar)

      These steps will remove the validation from the JS file itself

      • Update ComponentDetailsEditView.js and redeploy insightx.xx.jar file
        • Take a backup of insight-xxxx.jar(JIRA_INSTALL/atlassian-jira/WEB-INF/application-installation/jira-servicedesk-application) and copy it over to a different location
        • extract the JS file
          jar -xvf insight-xxx.jar includes/js/configure/automation/rule/configure/ComponentDetailsEditView.js
        • Update the code below
          556                 const groovyPathError = AJS.I18n.getText("rlabs.insight.i18n.atm.rule.input.validation.error.groovyPath");
          557                 dataObjUIDef = {
          558                     'absFilePath' :
          559                         {
          560                             'inputType' : 'text',
          561                             'required' : true,
          562                             'i18nText' : AJS.I18n.getText("rlabs.insight.i18n.atm.config.field.groovy.absFilePath.label"),
          563                             'description' : AJS.I18n.getText("rlabs.insight.i18n.atm.config.field.groovy.absFilePath.description"),
          564                             'validations' : JSON.stringify({
          565                                 [NO_PREV_FOLDER_PATTERN]: groovyPathError,
          566                                 [MUST_START_WITH_SLASH_PATTERN]: groovyPathError
          567                             })
          568                         },
          569                 };

          TO

        • 556                 const groovyPathError = AJS.I18n.getText("rlabs.insight.i18n.atm.rule.input.validation.error.groovyPath");
          557                 dataObjUIDef = {
          558                     'absFilePath' :
          559                         {
          560                             'inputType' : 'text',
          561                             'required' : true,
          562                             'i18nText' : AJS.I18n.getText("rlabs.insight.i18n.atm.config.field.groovy.absFilePath.label"),
          563                             'description' : AJS.I18n.getText("rlabs.insight.i18n.atm.config.field.groovy.absFilePath.description")
          568                         },
          569                 };
        • jar -uvf insight-xxxx.jar includes/js/configure/automation/rule/configure/ComponentDetailsEditView.js
        • Stop Jira
        • Replace the insight-xxxx.jar at JIRA_INSTALL/atlassian-jira/WEB-INF/application-installation/jira-servicedesk-application
        • Replace the insight-xxxx.jar at JIRA_HOME/plugins/installed-plugins & JIRA_SHARED_HOME/plugins/installed-plugins as applicable
        • Clear plugin cache folders .bundled-plugins & .osgi-plugins from both JIRA_HOME/plugins/installed-plugins & JIRA_SHARED_HOME/plugins/installed-plugins as applicable
        • Start Jira

            [JSDSERVER-12219] On windows env, Automation Rule Action "Execute Groovy script" is failing with the input validation error "Script file path must be absolute" for the file path

            SET Analytics Bot made changes -
            UIS Original: 2 New: 4
            SET Analytics Bot made changes -
            UIS Original: 3 New: 2
            SET Analytics Bot made changes -
            UIS Original: 5 New: 3
            SET Analytics Bot made changes -
            UIS Original: 3 New: 5
            SET Analytics Bot made changes -
            UIS Original: 5 New: 3
            SET Analytics Bot made changes -
            UIS Original: 6 New: 5
            SET Analytics Bot made changes -
            UIS Original: 7 New: 6
            SET Analytics Bot made changes -
            UIS Original: 6 New: 7
            SET Analytics Bot made changes -
            UIS Original: 4 New: 6
            SET Analytics Bot made changes -
            UIS Original: 3 New: 4

              Unassigned Unassigned
              4a39baba09d4 Nikhil Janardhanan
              Affected customers:
              24 This affects my team
              Watchers:
              23 Start watching this issue

                Created:
                Updated: