File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3737from dojo .utils import (
3838 add_error_message_to_response ,
3939 get_file_images ,
40+ get_full_url ,
4041 get_system_setting ,
4142 prod_name ,
4243 to_str_typed ,
@@ -646,6 +647,12 @@ def jira_description(obj, **kwargs):
646647 kwargs ["finding_group" ] = obj
647648
648649 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
649656 logger .debug ("rendered description: %s" , description )
650657 return description
651658
Original file line number Diff line number Diff line change 226226 DD_MAX_REQRESP_FROM_API = (int , - 1 ),
227227 DD_MAX_AUTOCOMPLETE_WORDS = (int , 20000 ),
228228 DD_JIRA_SSL_VERIFY = (bool , True ),
229+ DD_JIRA_DESCRIPTION_MAX_LENGTH = (int , 32767 ),
229230 # When interacting with jira tickets that attached finding groups, we should no be opening any findings
230231 # on the DefectDojo side because jira has no way of knowing if a finding really should be reopened or not
231232 DD_JIRA_WEBHOOK_ALLOW_FINDING_GROUP_REOPEN = (bool , False ),
@@ -1643,6 +1644,7 @@ def saml2_attrib_map_format(din):
16431644 JIRA_ISSUE_TYPE_CHOICES_CONFIG += ((extra_type , extra_type ),)
16441645
16451646JIRA_SSL_VERIFY = env ("DD_JIRA_SSL_VERIFY" )
1647+ JIRA_DESCRIPTION_MAX_LENGTH = env ("DD_JIRA_DESCRIPTION_MAX_LENGTH" )
16461648JIRA_WEBHOOK_ALLOW_FINDING_GROUP_REOPEN = env ("DD_JIRA_WEBHOOK_ALLOW_FINDING_GROUP_REOPEN" )
16471649
16481650# ------------------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments