-
Notifications
You must be signed in to change notification settings - Fork 24
Awesome: several XSS vulnerabilities #227
Copy link
Copy link
Closed
Description
Describe the bug
Unsanitized input is assigned to innerHTML in the following contexts:
- When a trace is rendered in a test's or step's error in Awesome (this happens when a user expands the message):
<pre dangerouslySetInnerHTML={{ __html: ansiTrace }}>{ansiTrace}</pre> - When an HTML attachment (content type
text/html) is opened for preview. This is relevant both for Awesome:
return <div className={styles["html-attachment-preview"]} dangerouslySetInnerHTML={{ __html: attachment?.text }} />;
... and for Classic:
allure3/packages/web-classic/src/components/TestResult/TestResultSteps/HtmlAttachmentPreview.tsx
Line 11 in 376bfe2
return <div className={styles["html-attachment-preview"]} dangerouslySetInnerHTML={{ __html: attachment?.text }} />; - When a code attachment with ANSI codes is expanded in Awesome (both in the inline view and in the modal window):
dangerouslySetInnerHTML={{ __html: ansiTrace(rawText) }}
It's possible this behavior will be extended to Classic.
The following attachment types are affected:
json: AttachmentCode, code: AttachmentCode, uri: AttachmentCode, css: AttachmentCode, table: AttachmentCode, html: AttachmentCode, text: AttachmentCode,
The full list of content types corresponding to the above types can be found here:
switch (fileType.type) {
While innerHTML doesn't run the code in a <script> tag, there are plenty of other ways to execute JS code. An example would be putting the code in onerror of an image with src set to a non-existing location:
<img src="-" onerror="alert('This input is not sanitized well enough :(')">To Reproduce
Steps to reproduce the behavior:
- Download and extract the directory with test result files:
allure-results.zip - Generate the Allure Awesome report from the extracted directory.
- Navigate to the test details page.
- Expand the test message. The alert 1 will be shown.
- Expand the
Foostep and click on the message. The alert 2 will be shown. - Expand the
index.htmlattachment. The alert 3 will be shown. The same alert is shown when the attachment preview is opened in the modal window. - Expand the
textattachment. The alert 4 will be shown. Unlike with the previous attachment, this time, no alert will be shown when the preview is opened in the modal window.
Expected behavior
No JavaScript is executed. In the context of the above example, that means no alerts should be shown.
Recording
Screen.Recording.2025-06-24.at.21.12.05.mov
Reactions are currently unavailable