Gitlab -> Jira (On Prem) integration fails to display linkages if reporter is Anonymous on Jira issues
Summary
When a jira issue does not have the 'reporter' field set, Jira display the reporter as 'Anonymous'.
If a gitlab<-> Jira integration is setup. The 'reporter' field not being set breaks gitlab's display of jira issues on:
- Displaying the linked issues on a gitlab vulnerabilities page.
- Displaying the list of Jira Vulnerabilities on the Issues->Jira Issues page
Steps to reproduce
- Link Gitlab & Jira together on a repo that has a security vulnerabilty
- Create a jira issue from the vulnerability, make sure the reporter field is not set.
- An error will be reported on the vulnerability page
- Jira issues will not be able to be displayed on the Jira Issues page
- Set the reporter to any non empty value in Jira
- Pages will both display correctly in gitlab
What is the current bug behavior?
Once the Jira issue is created without a reporter gitlab shows an error when displaying a vulnerability with a linked jira issue:
The Issues->Jira Issues page also shows an error:
In Jira you can confirm the reporter is not set as it shows Anonymous
What is the expected correct behavior?
The correct behaviour is viewed when a non empty reporter is set on the jira issue.
The jira issue is correctly displayed when viewing the vulnerability page:
The Issues->Jira Issues page shows associated issues:
Relevant logs and/or screenshots
Logs show:
"exception_message": "undefined method `[]' for nil:NilClass",
"exception_backtrace": [
"ee/app/serializers/integrations/jira_serializers/issue_entity.rb:95:in `jira_user_id'",
"ee/app/serializers/integrations/jira_serializers/issue_entity.rb:84:in `jira_user'",
"ee/app/serializers/integrations/jira_serializers/issue_entity.rb:49:in `block in <class:IssueEntity>'",
"app/serializers/base_serializer.rb:16:in `represent'",
"app/serializers/concerns/with_pagination.rb:19:in `represent'",
"ee/app/controllers/projects/integrations/jira/issues_controller.rb:58:in `issues_json'",
"ee/app/controllers/projects/integrations/jira/issues_controller.rb:27:in `block (2 levels) in index'",
"ee/app/controllers/projects/integrations/jira/issues_controller.rb:24:in `index'",
"ee/lib/gitlab/ip_address_state.rb:10:in `with'",
"ee/app/controllers/ee/application_controller.rb:45:in `set_current_ip_address'",
"app/controllers/application_controller.rb:527:in `set_current_admin'",
"lib/gitlab/session.rb:11:in `with_session'",
"app/controllers/application_controller.rb:518:in `set_session_storage'",
"lib/gitlab/i18n.rb:105:in `with_locale'",
"lib/gitlab/i18n.rb:111:in `with_user_locale'",
"app/controllers/application_controller.rb:512:in `set_locale'",
"app/controllers/application_controller.rb:506:in `set_current_context'",
"lib/gitlab/middleware/memory_report.rb:13:in `call'",
"lib/gitlab/middleware/speedscope.rb:13:in `call'",
"lib/gitlab/database/load_balancing/rack_middleware.rb:23:in `call'",
"lib/gitlab/jira/middleware.rb:19:in `call'",
"lib/gitlab/middleware/go.rb:20:in `call'",
"lib/gitlab/etag_caching/middleware.rb:21:in `call'",
"lib/gitlab/middleware/query_analyzer.rb:11:in `block in call'",
"lib/gitlab/database/query_analyzer.rb:37:in `within'",
"lib/gitlab/middleware/query_analyzer.rb:11:in `call'",
"lib/gitlab/middleware/multipart.rb:173:in `call'",
"lib/gitlab/middleware/read_only/controller.rb:50:in `call'",
"lib/gitlab/middleware/read_only.rb:18:in `call'",
"lib/gitlab/middleware/same_site_cookies.rb:27:in `call'",
"lib/gitlab/middleware/handle_malformed_strings.rb:21:in `call'",
"lib/gitlab/middleware/basic_health_check.rb:25:in `call'",
"lib/gitlab/middleware/handle_ip_spoof_attack_error.rb:25:in `call'",
"lib/gitlab/middleware/request_context.rb:21:in `call'",
"lib/gitlab/middleware/webhook_recursion_detection.rb:15:in `call'",
"config/initializers/fix_local_cache_middleware.rb:11:in `call'",
"lib/gitlab/middleware/compressed_json.rb:26:in `call'",
"lib/gitlab/middleware/rack_multipart_tempfile_factory.rb:19:in `call'",
"lib/gitlab/middleware/sidekiq_web_static.rb:20:in `call'",
"lib/gitlab/metrics/requests_rack_middleware.rb:77:in `call'",
"lib/gitlab/middleware/release_env.rb:13:in `call'"
],
Results of GitLab environment info
Gitlab version experiencing the issue: 15.0.5-ee Though based on the code likely later versions.
Jira Datacenter 8.20.x this is an on site installation, not cloud based. Changing the version of Jira (Server,Datacenter, 8.x, 9,x) is unlikely to resolve the issue as jira is returning the correct information.
Possible fixes
The cause of the bug is the user object is not set:
Which caused the stack dump. The bug can easily be seen by toggling the reporter field in jira. If set, everything works. If unset (left blank) it will break gitlab.