Uploaded image for project: 'Jira Cloud'
  1. Jira Cloud
  2. JRACLOUD-65250

NullPointerException in issue collector plugin: TemporaryAttachmentsResource#createTemporaryWebAttachment

    XMLWordPrintable

Details

    Description

      Summary

      When a user tries to attach a file to an issue collector, if they do not have a current session for the JIRA instance where the issue collector is located, or if they do have a current session but do not have browse project permission on the target project of the issue collector, the ProjectService will return null and the creation of the temporary attachment will fail with an error.

      We still need to get the project in order to use the TemporaryWebAttachmentsManager (we changed to use this in https://jdog.jira-dev.com/browse/VPP-825 as part of vertigo swarm), but prevent the NPE from happening.

      Note: If the user with project access has previously login to the instance on a browser, the said user will be able to attach the attachments.

      Steps to Reproduce

      1. In any JIRA instance (for example's sake let's say blah.atlassian.net), create a new project and add an issue collector to it (make sure one of the fields on the issue collector allows you to attach files).
      2. Paste the generated <script>...</script> into some page (see footnotes for one way you can do this), and load that page in a browser that doesn't have a current session for the JIRA instance that you created the issue collector from (in our example, that means that when we go to blah.atlassian.net in that browser, we see a login page).
      3. Try to raise a new ticket and attach a new file to the ticket.
      4. The below error will be returned Cannot attach file issue collector.html: Unknown server error (500).
      5. Attempting the action again will return Cannot attach file issue collector.html: Unknown server error (500).

      Expected results

      Attachments should be attached to the ticket without issues.

      Actual results

      Attachment cannot be attached and error message is returned.

      Workaround

      No good workaround without relaxing permissions on the project with the issue collector.

      Similar issues

      There is a similar issue with the issue collector where if you use Internet Explorer with third-party cookies disabled, an error message is displayed saying JIRA could not attach the file as there was a missing form token. Please try attaching the file again. This was reproduced on IE 11.0.9600.18125. Using a different browser should fix this particular problem, but then the issue described in this bug report occurs.

      Footnote

      Example way of running a skeleton page with the issue collector

      Create a blank html page on your computer and paste the <script>...</script> into it:

      <!doctype html>
        <head>
          <title>Title</title>
        </head>
        <body>
          <!-- your script goes here -->
        </body>
      </html>
      

      You can then open that file directly in the browser, or use Python to start a local webserver in the directory where you've saved the html page: python -m SimpleHTTPServer or python3 -m http.server and navigate to it in your browser (usually localhost:8000).

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              tpu Tian Pu (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: