django-DefectDojo icon indicating copy to clipboard operation
django-DefectDojo copied to clipboard

jira: not able to create custom fields for the issues created/uploaded to dojo.

Open reddybhaskarvengala opened this issue 6 years ago • 10 comments

Bug description I am trying to integrate dojo with jira. In my case there are some fields needs to be present in the issues uploaded in dojo to create an issue in the jira automatically (ex: OS version, Affected versions etc..). In the alerts I can see the message like below and I could not find any errors in the celery logs. Jira_Update issue: "Finding: 505, O/S is required., Severity is required., Product Hierarchy is required., Affects Version/s is required., The default assignee does NOT have ASSIGNABLE permission OR Unassigned issues are turned off."

so I am trying to add these custom fields to the issue created in dojo but I could not find any options to add. I am able to add some custom fields to the product but it looks like these fields are not getting added to the issue while dojo making a issue creation request to jira.

Steps to reproduce Steps to reproduce the behavior:

  1. Enable jira integration and create a product, engagement and test case.
  2. upload any report.
  3. Goto any finding. edit and save the finding.

reddybhaskarvengala avatar Aug 04 '20 09:08 reddybhaskarvengala

this is not possbile currently, changed this issue to enhancement.

valentijnscholten avatar Aug 27 '20 18:08 valentijnscholten

Severity should be there from defect dojo, the other fields are not present in defect dojo. We could allow to have multiple "default" values to be configured with the jira config. But as it is, maintaining the integration with JIRA is already complicated as it is, so not sure if there ever is someone who wants to take on this task.

We have faced similar issues in the past, for example when creating issue from sentry, newrelic, etc, etc. We decided the make all these fields optional in JIRA as they break most of the JIRA integrations in other products.

valentijnscholten avatar Sep 19 '20 17:09 valentijnscholten

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 19 '20 07:12 stale[bot]

I run into this problem with lots of integrations with JIRA and in the end the only solution is to make all the non standard fields optional in JIRA to be able to integrate with other tools like Sentry, Gitlab, JIRA, Zendesk, ..

valentijnscholten avatar Dec 19 '20 08:12 valentijnscholten

This feature would be useful for my installation of DefectDojo and JIRA as well. 👍

Are there any workarounds for this for the time being?

joebasirico avatar Jan 29 '21 20:01 joebasirico

Found myself in same to authors' situation! We really need to be able to set custom issue types.

sarosbacz avatar Feb 11 '21 16:02 sarosbacz

If it's about custom issuetypes, these are configured in settings.dist.py:

https://github.com/DefectDojo/django-DefectDojo/blob/f567f53aeeb33404762fd44a28a7d18362cb9d68/dojo/settings/settings.dist.py#L863

valentijnscholten avatar Feb 11 '21 17:02 valentijnscholten

For my use case we have custom, required fields in JIRA. If we try to automatically create a JIRA ticket from DD without the field the update will fail. I was able to modify the code in a couple of places to properly submit the fields required. This isn't a generic (or flexible) fix so I won't share the specifics, but in case this helps somebody else here is what I ended up doing:

  1. In dojo/models.py within the Finding class (around line 1718) I added my custom field
    customfield_id = models.CharField(null=True,
                                           blank=True,
                                           max_length=4000,
                                           verbose_name="My Name",
                                           help_text="Custom field help text.")
  1. In dojo/jira_link/helper.py within the add_jira_issue method (around line 471) I map the custom field in the finding to the jira issue fields. Note: JIRA is particular about how you send field data. I found these references to be helpful: https://community.atlassian.com/t5/Jira-Service-Management/Jira-API-Insight-object-customfield/qaq-p/1276723 https://developer.atlassian.com/server/jira/platform/jira-rest-api-examples/#creating-an-issue-examples
fields['customfield_id'] = [ { "value": find.customfield_id } ]
  1. Either using a DB migration or by directly updating the database you must create a new field in the dojo_finding table that corresponds to customfield_id referenced in the model.

I suspect this solution could be generalized using a configuration file or something similar, but for now this has resolved the issue for me.

joebasirico avatar Feb 12 '21 21:02 joebasirico

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 11 '21 01:06 stale[bot]

I'm in a similar predicament as BhaskiBuzz. I would love to see this enhancement included.

wxd11a avatar Jul 28 '21 18:07 wxd11a