File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change 37
37
from dojo .utils import (
38
38
add_error_message_to_response ,
39
39
get_file_images ,
40
+ get_full_url ,
40
41
get_system_setting ,
41
42
prod_name ,
42
43
to_str_typed ,
@@ -646,6 +647,12 @@ def jira_description(obj, **kwargs):
646
647
kwargs ["finding_group" ] = obj
647
648
648
649
description = render_to_string (template , kwargs )
650
+ defect_dojo_obj_url = get_full_url (obj .get_absolute_url ())
651
+ max_length = getattr (settings , "JIRA_DESCRIPTION_MAX_LENGTH" , 32767 )
652
+ suffix = f"\n \n Issue Description Too Long: See [DefectDojo|{ defect_dojo_obj_url } ] for full description."
653
+ if len (description ) > max_length :
654
+ # suffix can be longer after rendering do to urlenocoding, so we take twice the length of the suffix as a buffer
655
+ description = description [:max_length - (2 * len (suffix ))] + suffix
649
656
logger .debug ("rendered description: %s" , description )
650
657
return description
651
658
Original file line number Diff line number Diff line change 226
226
DD_MAX_REQRESP_FROM_API = (int , - 1 ),
227
227
DD_MAX_AUTOCOMPLETE_WORDS = (int , 20000 ),
228
228
DD_JIRA_SSL_VERIFY = (bool , True ),
229
+ DD_JIRA_DESCRIPTION_MAX_LENGTH = (int , 32767 ),
229
230
# When interacting with jira tickets that attached finding groups, we should no be opening any findings
230
231
# on the DefectDojo side because jira has no way of knowing if a finding really should be reopened or not
231
232
DD_JIRA_WEBHOOK_ALLOW_FINDING_GROUP_REOPEN = (bool , False ),
@@ -1643,6 +1644,7 @@ def saml2_attrib_map_format(din):
1643
1644
JIRA_ISSUE_TYPE_CHOICES_CONFIG += ((extra_type , extra_type ),)
1644
1645
1645
1646
JIRA_SSL_VERIFY = env ("DD_JIRA_SSL_VERIFY" )
1647
+ JIRA_DESCRIPTION_MAX_LENGTH = env ("DD_JIRA_DESCRIPTION_MAX_LENGTH" )
1646
1648
JIRA_WEBHOOK_ALLOW_FINDING_GROUP_REOPEN = env ("DD_JIRA_WEBHOOK_ALLOW_FINDING_GROUP_REOPEN" )
1647
1649
1648
1650
# ------------------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments