Duplicating Jira Issues when Jira user assignment fails
Bug description When the assignee is not in Jira or the Jira user does not have the right to set assignee, jira.assign_issue(new_issue.key, jira_project.default_assignee) fails and that makes DD think that the ticket was not created. However, the ticket has been created, only the user assignment could not be done. Since the ticket is not created according to DD, it continues to create tickets again and again by every reimport.
Steps to reproduce Steps to reproduce the behavior:
- Set an unavailable user as default assignee for a product or remove set assignee permission for Jira user.
- Start a reimport process
- See error
Expected behavior Handle cases when assignee is not set-able
Deployment method (select with an X)
- [X] Docker Compose
- [ ] Kubernetes
- [ ] GoDojo
Environment information
- DefectDojo version (see footer) or commit message: 2.31.1
Logs {"log":"[14/Feb/2024 21:13:10] DEBUG [dojo.utils:2191] getting product for \u003cclass 'dojo.models.Finding_Group'\u003e:Findings in: XXX:25.38\n","stream":"stderr","time":"2024-02-14T21:13:10.732673297Z"} {"log":"[14/Feb/2024 21:13:10] ERROR [dojo.jira_link.helper:806] jira_meta for project: XXX and url: https://XXX.atlassian.net meta: null\n","stream":"stderr","time":"2024-02-14T21:13:10.732658682Z"} {"log":"\u0009response text = {"errorMessages":[],"errors":{"assignee":"User 'XXXX' cannot be assigned issues."}}\n","stream":"stderr","time":"2024-02-14T21:13:10.732473136Z"} {"log":"\u0009response headers = {'Date': 'Wed, 14 Feb 2024 21:13:10 GMT', 'Content-Type': 'application/json;charset=UTF-8', 'Server': 'AtlassianEdge', 'Timing-Allow-Origin': '*', 'X-Arequestid': 'xx', 'X-Ratelimit-Nearlimit': 'false', 'X-Aaccountid': 'xx', 'Cache-Control': 'no-cache, no-store, no-transform', 'X-Content-Type-Options': 'nosniff', 'X-Xss-Protection': '1; mode=block', 'Atl-Traceid': '7c2818fe11114057951c8956250b8b9c', 'Report-To': '{"endpoints": [{"url": "https://xx.xx.net"}], "group": "endpoint-1", "include_subdomains": true, "max_age": 600}', 'Nel': '{"failure_fraction": 0.001, "include_subdomains": true, "max_age": 600, "report_to": "endpoint-1"}', 'Strict-Transport-Security': 'max-age=63072000; includeSubDomains; preload', 'Transfer-Encoding': 'chunked'}\n","stream":"stderr","time":"2024-02-14T21:13:10.732454451Z"} {"log":"\u0009\n","stream":"stderr","time":"2024-02-14T21:13:10.732449513Z"} {"log":"jira.exceptions.JIRAError: JiraError HTTP 400 url: https://XXX.atlassian.net/rest/api/latest/issue/XXX-13453/assignee\n","stream":"stderr","time":"2024-02-14T21:13:10.732444703Z"} {"log":" raise JIRAError(\n","stream":"stderr","time":"2024-02-14T21:13:10.732439887Z"} {"log":" File "/usr/local/lib/python3.11/site-packages/jira/resilientsession.py", line 71, in raise_on_error\n","stream":"stderr","time":"2024-02-14T21:13:10.732434557Z"} {"log":" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n","stream":"stderr","time":"2024-02-14T21:13:10.732427645Z"} {"log":" elif raise_on_error(response, **processed_kwargs):\n","stream":"stderr","time":"2024-02-14T21:13:10.732422754Z"} {"log":" File "/usr/local/lib/python3.11/site-packages/jira/resilientsession.py", line 246, in request\n","stream":"stderr","time":"2024-02-14T21:13:10.73241747Z"} {"log":" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n","stream":"stderr","time":"2024-02-14T21:13:10.732410698Z"} {"log":" return self.request("PUT", url, data=data, **kwargs)\n","stream":"stderr","time":"2024-02-14T21:13:10.732389613Z"} {"log":" File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 649, in put\n","stream":"stderr","time":"2024-02-14T21:13:10.732384353Z"} {"log":" self._session.put(url, data=json.dumps(payload))\n","stream":"stderr","time":"2024-02-14T21:13:10.732379226Z"} {"log":" File "/usr/local/lib/python3.11/site-packages/jira/client.py", line 1891, in assign_issue\n","stream":"stderr","time":"2024-02-14T21:13:10.732374369Z"} {"log":" ^^^^^^^^^^^^^^^^^^^^^^^^^\n","stream":"stderr","time":"2024-02-14T21:13:10.732369465Z"} {"log":" result = func(arg_list, **kwargs)\n","stream":"stderr","time":"2024-02-14T21:13:10.732364693Z"} {"log":" File "/usr/local/lib/python3.11/site-packages/jira/client.py", line 123, in wrapper\n","stream":"stderr","time":"2024-02-14T21:13:10.732359588Z"} {"log":" jira.assign_issue(new_issue.key, jira_project.default_assignee)\n","stream":"stderr","time":"2024-02-14T21:13:10.73235477Z"} {"log":" File "/app/dojo/jira_link/helper.py", line 753, in add_jira_issue\n","stream":"stderr","time":"2024-02-14T21:13:10.732349738Z"} {"log":"Traceback (most recent call last):\n","stream":"stderr","time":"2024-02-14T21:13:10.732344738Z"} {"log":"\u0009response text = {"errorMessages":[],"errors":{"assignee":"User 'XXXX' cannot be assigned issues."}}\n","stream":"stderr","time":"2024-02-14T21:13:10.732339237Z"} {"log":"\u0009response headers = {'Date': 'Wed, 14 Feb 2024 21:13:10 GMT', 'Content-Type': 'application/json;charset=UTF-8', 'Server': 'AtlassianEdge', 'Timing-Allow-Origin': '', 'X-Arequestid': 'xx', 'X-Ratelimit-Nearlimit': 'false', 'X-Aaccountid': 'xx', 'Cache-Control': 'no-cache, no-store, no-transform', 'X-Content-Type-Options': 'nosniff', 'X-Xss-Protection': '1; mode=block', 'Atl-Traceid': 'xx', 'Report-To': '{"endpoints": [{"url": "https://xx.xx.net"}], "group": "endpoint-1", "include_subdomains": true, "max_age": 600}', 'Nel': '{"failure_fraction": 0.001, "include_subdomains": true, "max_age": 600, "report_to": "endpoint-1"}', 'Strict-Transport-Security': 'max-age=63072000; includeSubDomains; preload', 'Transfer-Encoding': 'chunked'}\n","stream":"stderr","time":"2024-02-14T21:13:10.732328236Z"} {"log":"\u0009\n","stream":"stderr","time":"2024-02-14T21:13:10.732276411Z"} {"log":"[14/Feb/2024 21:13:10] ERROR [dojo.jira_link.helper:805] JiraError HTTP 400 url: https://XXX.atlassian.net/rest/api/latest/issue/XXX-13453/assignee\n","stream":"stderr","time":"2024-02-14T21:13:10.732201906Z"}