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

Migrating issue security schemes corrupts new customer requests if the Issue Security field is preset in JSM Data Center

XMLWordPrintable

      Issue Summary

      As described on Setting up request types, JSM DC allows project administrators to specify hidden fields with preset values. This includes the "Security Level" system field, which defines an issue security level. The level specified here will override the scheme's default during issue creation.

      If an administrator migrates the project to a new issue security scheme, this preset value is not updated and will continue to apply the old security level. When new customer requests are created, they can't be viewed in the UI, even by users granted access. Other fields will produce a clear warning in both the Jira UI and the customer portal.

      The root cause of this behavior is JRASERVER-67812. It causes other related bugs, such as JRASERVER-74605.

      Steps to Reproduce

      1. Create a service project and issue security scheme with at least one security level.
      2. Associate that project with the issue security scheme.
      3. Add the "Security Level" system field to the project's "create issue" screen.
      4. Add a new request type and make "Security Level" a hidden field, with the security level as the default value.
      5. Create a second issue security scheme.
      6. Migrate the project to the second issue security scheme.
      7. Create a new customer request.

      Expected Results

      The customer portal presents an error when a user submits a request. Project administrators are provided a warning in the Jira UI. This is the behavior with other fields.

      Actual Results

      The customer portal allows the request to be submitted without warning:

      Neither the customer nor any agent can view it from the portal or Jira UI:

      Workaround

      Prevent corruption of new issues

      Edit the present value from the request type to ensure it uses an applicable security level. You can accomplish this by showing and re-hiding the "Security Level" field from the field editor under request types.

      You can find invalid preset values with this database query:

      WITH security_form_fields AS (SELECT p.id           AS project_id,
                                           p.pkey         AS project_key,
                                           p.pname        AS project_name,
                                           portal."ID"    AS portal_id,
                                           portal."NAME"  AS portal_name,
                                           form."ID"      AS request_type_id,
                                           form."NAME"    AS request_type_name,
                                           fvalue."VALUE" AS issue_security_level
                                    FROM project p
                                             JOIN "AO_54307E_VIEWPORT" portal ON p.id = portal."PROJECT_ID"
                                             JOIN "AO_54307E_VIEWPORTFORM" form ON portal."ID" = form."VIEWPORT_ID"
                                             JOIN "AO_54307E_VIEWPORTFIELD" field ON form."ID" = field."FORM_ID"
                                             JOIN "AO_54307E_VIEWPORTFIELDVALUE" fvalue ON field."ID" = fvalue."FIELD_ID"
                                    WHERE p.projecttype = 'service_desk'
                                      AND field."DISPLAYED" = FALSE
                                      AND field."FIELD_ID" = 'security'),
           security_level_mapping AS (SELECT p.id AS pid, sisl.id AS isl
                                      FROM project p
                                               JOIN nodeassociation na ON p.id = na.source_node_id
                                               JOIN issuesecurityscheme iss ON na.sink_node_id = iss.id
                                               JOIN schemeissuesecuritylevels sisl ON iss.id = sisl.scheme
                                      WHERE p.projecttype = 'service_desk'
                                        AND na.source_node_entity = 'Project'
                                        AND na.sink_node_entity = 'IssueSecurityScheme')
      SELECT *
      FROM security_form_fields sff
      WHERE sff.issue_security_level::NUMERIC NOT IN
            (SELECT slm.isl FROM security_level_mapping slm WHERE slm.pid = sff.project_id);
      

      Repair existing issues

      Manually correct the "security" column in the "jiraissue" table.

      You can find issues with invalid security levels with this database query:

      WITH security_level_mapping AS (SELECT p.id AS pid, sisl.id AS isl
                                      FROM project p
                                               JOIN nodeassociation na ON p.id = na.source_node_id
                                               JOIN issuesecurityscheme iss ON na.sink_node_id = iss.id
                                               JOIN schemeissuesecuritylevels sisl ON iss.id = sisl.scheme
                                      WHERE p.projecttype = 'service_desk'
                                        AND na.source_node_entity = 'Project'
                                        AND na.sink_node_entity = 'IssueSecurityScheme')
      SELECT p.pname     AS project_name,
             p.pkey      AS project_key,
             ji.issuenum AS issue_number,
             ji.id       AS issue_id,
             ji.security AS issue_security_level,
             ji.summary  AS issue_summary
      FROM jiraissue ji
               JOIN project p ON ji.project = p.id
      WHERE p.projecttype = 'service_desk'
        AND ji.security IS NOT NULL
        AND ji.security NOT IN (SELECT slm.isl FROM security_level_mapping slm WHERE slm.pid = p.id);
      

        1. portal-missing-requests.png
          155 kB
          Benjamin S
        2. error-browse-issue.png
          153 kB
          Benjamin S
        3. portal-error.png
          181 kB
          Benjamin S
        4. portal-request-submitted.png
          104 kB
          Benjamin S
        5. config-error-flag.png
          389 kB
          Benjamin S
        6. config-error-dialog.png
          388 kB
          Benjamin S

              c8bcca445054 Benjamin Suess
              1353e2e9fd2f Benjamin S
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: