Skip to content

Commit b767aa4

Browse files
risk acceptance expiration: keep link with findings
1 parent 96c8e41 commit b767aa4

File tree

3 files changed

+26
-16
lines changed

3 files changed

+26
-16
lines changed

dojo/jira_link/helper.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1758,7 +1758,14 @@ def process_resolution_from_jira(finding, resolution_id, resolution_name, assign
17581758
jira_instance = get_jira_instance(finding)
17591759

17601760
if resolved:
1761-
if jira_instance and resolution_name in jira_instance.accepted_resolutions and (finding.test.engagement.product.enable_simple_risk_acceptance or finding.test.engagement.enable_full_risk_acceptance):
1761+
if (
1762+
jira_instance
1763+
and resolution_name in jira_instance.accepted_resolutions
1764+
and (
1765+
finding.test.engagement.product.enable_simple_risk_acceptance
1766+
or finding.test.engagement.enable_full_risk_acceptance
1767+
)
1768+
):
17621769
if not finding.risk_accepted:
17631770
logger.debug(f"Marking related finding of {jira_issue.jira_key} as accepted.")
17641771
finding.risk_accepted = True

dojo/risk_acceptance/helper.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,22 @@ def expire_now(risk_acceptance):
2424
for finding in risk_acceptance.accepted_findings.all():
2525
if not finding.active: # not sure why this is important
2626
logger.debug("%i:%s: unaccepting/reactivating finding.", finding.id, finding)
27+
finding.active = True
28+
finding.risk_accepted = False
2729

2830
# Update any endpoint statuses on each of the findings
2931
update_endpoint_statuses(finding, accept_risk=False)
30-
risk_unaccept(None, finding, post_comments=False) # comments will be posted at end
3132

3233
if risk_acceptance.restart_sla_expired:
3334
finding.sla_start_date = timezone.now().date()
34-
finding.save(dedupe_option=False) # resave if changed after risk_unaccept
35+
36+
finding.save(dedupe_option=False)
3537

3638
reactivated_findings.append(finding)
3739
else:
3840
logger.debug("%i:%s already active, no changes made.", finding.id, finding)
3941

42+
# best effort JIRA integration, no status changes, just a comment
4043
post_jira_comments(risk_acceptance, risk_acceptance.accepted_findings.all(), expiration_message_creator)
4144

4245
risk_acceptance.expiration_date = timezone.now()
@@ -73,7 +76,7 @@ def reinstate(risk_acceptance, old_expiration_date):
7376
else:
7477
logger.debug("%i:%s: already inactive, not making any changes", finding.id, finding)
7578

76-
# best effort JIRA integration, no status changes
79+
# best effort JIRA integration, no status changes, just a comment
7780
post_jira_comments(risk_acceptance, risk_acceptance.accepted_findings.all(), reinstation_message_creator)
7881

7982
risk_acceptance.expiration_date_handled = None

dojo/templates/dojo/view_eng.html

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ <h4> Risk Acceptance
437437
Never
438438
{% endif %}
439439
</td>
440-
<td>{{ risk_acceptance.accepted_findings_count }}</td>
440+
<td><a href="{% url 'view_risk_acceptance' eng.id risk_acceptance.id %}">{{ risk_acceptance.accepted_findings_count }}</a></td>
441441
{% if risk_acceptance.filename %}
442442
<td><a href="{% url 'download_risk_acceptance' eng.id risk_acceptance.id %}">Yes</a>
443443
&nbsp;<i style="position:absolute;" class="fa has-popover fa-info-circle" title="Uploaded proof" data-trigger="hover" data-placement="bottom" data-container="body" data-html="true"
@@ -717,7 +717,7 @@ <h4>Files<span class="pull-right">
717717
<div class="col-md-4">
718718
<div class="panel panel-default-secondary">
719719
<div class="panel-heading">
720-
<h3 class="panel-title"><span class="fa-solid fa-circle-info fa-fw" aria-hidden="true"></span>
720+
<h3 class="panel-title"><span class="fa-solid fa-circle-info fa-fw" aria-hidden="true"></span>
721721
{% if eng.name %}
722722
{{ eng.name }}
723723
{% else %}
@@ -1040,25 +1040,25 @@ <h4><span class="fa-solid fa-key" aria-hidden="true"></span>
10401040
$(document).on('keypress', null, 'e', function () {
10411041
window.location.assign('{% url 'edit_engagement' eng.id %}');
10421042
});
1043-
1043+
10441044
$(document).on('keypress', null, 'a', function () {
10451045
window.location.assign('{% url 'add_tests' eng.id %}');
10461046
});
1047-
1047+
10481048
$(document).on('keypress', null, 'i', function () {
10491049
window.location.assign('{% url 'import_scan_results' eng.id %}');
10501050
});
1051-
1051+
10521052
$("a[data-toggle='collapse']").on('click', function () {
10531053
var i = $($(this).find('i').get(0));
10541054
i.toggleClass('glyphicon-chevron-up').toggleClass('glyphicon-chevron-down');
10551055
});
1056-
1056+
10571057
//Ensures dropdown has proper zindex
10581058
$('.table-responsive').on('show.bs.dropdown', function () {
10591059
$('.table-responsive').css( "overflow", "inherit" );
10601060
});
1061-
1061+
10621062
$('.table-responsive').on('hide.bs.dropdown', function () {
10631063
$('.table-responsive').css( "overflow", "auto" );
10641064
})
@@ -1067,15 +1067,15 @@ <h4><span class="fa-solid fa-key" aria-hidden="true"></span>
10671067
var terms = '';
10681068
if ($.cookie('highlight')) {
10691069
terms = $.cookie('highlight').split(' ');
1070-
1070+
10711071
for (var i = 0; i < terms.length; i++) {
10721072
$('body').highlight(terms[i]);
10731073
}
10741074
}
1075-
1075+
10761076
$('input#simple_search').val(terms);
10771077
}
1078-
1078+
10791079
$('#shareQuestionnaireModal').on('show.bs.modal', function (event) {
10801080
var button = $(event.relatedTarget) // Button that triggered the modal
10811081
var path = button.data('whatever') // Extract info from data-* attributes
@@ -1088,8 +1088,8 @@ <h4><span class="fa-solid fa-key" aria-hidden="true"></span>
10881088
modal.find('p#questionnaireURL').text('Questionnaire URL: ' + host + path)
10891089
})
10901090
});
1091-
1091+
10921092
{% include 'dojo/snippets/risk_acceptance_actions_snippet_js.html' %}
1093-
1093+
10941094
</script>
10951095
{% endblock %}

0 commit comments

Comments
 (0)