Skip to content

Conversation

@NoumaanAhamed
Copy link
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings January 2, 2026 09:38
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses XSS (Cross-Site Scripting) security vulnerabilities in the rtMedia.js file by replacing potentially unsafe .html() methods with safer .text() methods and refactoring DOM manipulation code to use proper jQuery element creation and appending patterns.

Key Changes:

  • Replaced .html() with .text() for inserting user-facing text (moreText/lessText) to prevent XSS
  • Refactored ellipsis span creation to use secure jQuery element creation and .text() instead of string concatenation with .html()
  • Restructured content display HTML construction to use proper DOM manipulation methods instead of string concatenation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 1440 to 1447
var $moreLink = jQuery('<span><a href="javascript://nop/" class="morelink"></a></span>');

$this.html(html);
$this.empty()
.append($shortContent)
.append($allContent)
.append($moreLink);

$this.find(".morelink").text(config.moreText);
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

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

The more link element is created without text content on line 1440, and then the text is set separately on line 1447 using a selector. This is inefficient and could cause a brief flicker where the link is empty. Consider setting the text immediately after creating the element before appending it to the DOM, or chain the text assignment before the append operations.

Copilot uses AI. Check for mistakes.
@rtBot
Copy link
Contributor

rtBot commented Jan 2, 2026

Unable to PHPCS or SVG scan one or more files due to error running PHPCS/SVG scanner:

  • app/assets/js/rtMedia.js

The error may be temporary. If the error persists, please contact a human (commit-ID: ea1bc13).

@NoumaanAhamed NoumaanAhamed requested a review from mi5t4n January 2, 2026 09:46
@mi5t4n mi5t4n changed the title Security issue/rtmedia js fix: construct DOM nodes correctly. Jan 2, 2026
@mi5t4n mi5t4n changed the title fix: construct DOM nodes correctly. fix: construct DOM nodes correctly Jan 2, 2026
Copy link
Member

@mi5t4n mi5t4n left a comment

Choose a reason for hiding this comment

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

LGTM

@NoumaanAhamed NoumaanAhamed merged commit 460e436 into develop Jan 2, 2026
5 of 6 checks passed
@NoumaanAhamed NoumaanAhamed deleted the security-issue/rtmedia-js branch January 8, 2026 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants