Skip to content

Refactor risk acceptance details display#14283

Merged
mtesauro merged 1 commit intobugfixfrom
risk-acceptance-no-user-supplied-html
Feb 12, 2026
Merged

Refactor risk acceptance details display#14283
mtesauro merged 1 commit intobugfixfrom
risk-acceptance-no-user-supplied-html

Conversation

@Maffooch
Copy link
Contributor

@Maffooch Maffooch commented Feb 9, 2026

Remove markdown rendering for decision and recommendation details in the risk acceptance display to simplify the presentation of information. This change enhances clarity and consistency in the user interface.

[sc-12782]

@Maffooch Maffooch requested a review from mtesauro as a code owner February 9, 2026 21:41
@github-actions github-actions bot added the ui label Feb 9, 2026
@dryrunsecurity
Copy link

dryrunsecurity bot commented Feb 9, 2026

DryRun Security

🟡 Please give this pull request extra attention during review.

This pull request introduces several instances where user-controlled fields (risk_acceptance.filename, decision_details, recommendation_details) are interpolated directly into HTML attributes (data-content) used by JS popovers without attribute-context escaping or sanitization, creating a stored XSS risk if those fields can contain quotes or HTML. The scanner flags these as risky (non-blocking) locations in dojo/templates/dojo/view_eng.html and dojo/templates/dojo/view_risk_acceptance.html and recommends applying proper attribute-appropriate escaping or sanitization.

🟡 Potential Cross-Site Scripting in dojo/templates/dojo/view_eng.html
Vulnerability Potential Cross-Site Scripting
Description Unescaped user-controlled fields (risk_acceptance.decision_details and risk_acceptance.filename) are injected directly into an HTML attribute data-content within an tag. Django auto-escapes template variables in HTML content, but when placed inside a double-quoted attribute, quotes or HTML entities in the variable can break out of the attribute if not properly escaped. The template uses {{ risk_acceptance.decision_details }} without any attribute-specific escaping or sanitization, and there is no evidence in the patch of prior sanitization. This provides a path for attacker-controlled content to reach a rendering sink (HTML attribute) without context-appropriate encoding, enabling XSS.

&nbsp;<i style="position:absolute;" class="fa has-popover fa-info-circle" title="Decision Details" data-trigger="hover" data-placement="bottom" data-container="body"
data-content="{{ risk_acceptance.decision_details }}"></i>

🟡 Potential Cross-Site Scripting in dojo/templates/dojo/view_eng.html
Vulnerability Potential Cross-Site Scripting
Description User-controllable values (risk_acceptance.filename and risk_acceptance.decision_details) are injected into HTML attribute data-content of elements used by a JS popover without additional attribute-specific escaping or sanitization. Django templates auto-escape by default for HTML body context, but embedding a value inside a double-quoted HTML attribute still requires that quotes and other special characters be escaped for attribute context. The code uses {{ risk_acceptance.filename }} and {{ risk_acceptance.decision_details }} directly inside data-content="...". If either field can contain user-controlled characters such as double quotes or HTML/JS, they can break out of the attribute or change the popover content leading to XSS when the popover renders (especially since popover content may be interpreted as HTML by the JS plugin). No escape, urlencode, or a sanitizer (e.g., DOMPurify on the client or server-side cleaning) is applied in the template, and I did not find any surrounding code that sanitizes these model fields before rendering in the provided patch. Therefore a path exists from user-controlled data to a rendering sink without proper context-appropriate escaping or sanitization.

data-content="{{ risk_acceptance.filename }}"></i>
</td>
{% else %}

🟡 Potential Cross-Site Scripting in dojo/templates/dojo/view_risk_acceptance.html
Vulnerability Potential Cross-Site Scripting
Description User-controlled fields risk_acceptance.recommendation_details, risk_acceptance.decision_details, and risk_acceptance.filename are rendered directly into HTML attributes (data-content) and into the template without any escaping/filtering. Django templates auto-escape variables when inserted into HTML body, but they are inserted into HTML attributes (data-content) that are later used by JS-driven popovers; if values contain quotes or HTML they can break out of the attribute or include HTML in the rendered popover. The patch shows direct use of {{ risk_acceptance.recommendation_details }} and {{ risk_acceptance.decision_details }} with no safe filtering or sanitization; there is no indication in the patch that these fields are sanitized before rendering. This creates a stored XSS risk if those fields can contain untrusted input.

{{ risk_acceptance.get_recommendation_display }}
</td>
<td width="40%">
{{ risk_acceptance.recommendation_details }}
</td>
<td width="10%">
{{ risk_acceptance.get_decision_display }}
</td>
<td width="40%">
{{ risk_acceptance.decision_details }}
</td>
</tr>
</tbody>


All finding details can be found in the DryRun Security Dashboard.

Copy link
Contributor

@mtesauro mtesauro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

@Maffooch Maffooch added this to the 2.55.3 milestone Feb 10, 2026
@mtesauro mtesauro merged commit 0dc77d4 into bugfix Feb 12, 2026
274 of 276 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants