Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

View Alerts: Sanitize and mark safe #11594

Merged
merged 1 commit into from
Jan 23, 2025

Conversation

Maffooch
Copy link
Contributor

Alerts are being HTML escaped in places where they should not be. Rather on relying on the default HTML escaping, we should use the markdown bleaching templatetag to allow for more options in object titles. Here is a before and after of an innocuous alert vs a dangerous one (no xss triggered here).

Before:
Screenshot 2025-01-17 at 2 23 43 PM

After:
Screenshot 2025-01-17 at 2 23 56 PM

[sc-9944]

@github-actions github-actions bot added the ui label Jan 17, 2025
Copy link

DryRun Security Summary

The pull request involves modifying the alert display in a Dojo application by introducing a custom Markdown rendering template tag, which raises potential security concerns around XSS vulnerabilities, input sanitization, and CSRF protection that require careful review.

Expand for full summary

Summary:

The code changes in this pull request are related to the display of alert information in the Dojo application. The key changes include the addition of a custom template tag library for rendering content and the modification of the alert description rendering to use a custom markdown_render filter. While these changes aim to improve the functionality, they also introduce potential security concerns that should be addressed.

The primary security considerations are the proper sanitization of the Markdown rendering to prevent Cross-Site Scripting (XSS) vulnerabilities, the secure handling of all user-supplied input to prevent injection attacks, the proper implementation and verification of the CSRF protection, and the review of the "Select all" checkbox functionality to ensure it does not introduce any security issues. As an application security engineer, it is crucial to thoroughly review these changes and ensure the overall security of the application is maintained.

Files Changed:

  • dojo/templates/dojo/alerts.html: This file has been modified to add the {% load display_tags %} template tag and change the rendering of the alert description from {{ alert.description|linebreaks }} to {{ alert.description|markdown_render|linebreaks }}. These changes introduce potential security concerns related to the proper sanitization of Markdown rendering and the secure handling of user-supplied input. Additionally, the form in the template includes a CSRF token, which should be properly implemented and verified, and the "Select all" checkbox functionality should be reviewed for potential security issues.

Code Analysis

We ran 9 analyzers against 1 file and 0 analyzers had findings. 9 analyzers had no findings.

View PR in the DryRun 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

@mtesauro mtesauro merged commit 80b0c14 into DefectDojo:bugfix Jan 23, 2025
72 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