Skip to content

Conversation

@NoumaanAhamed
Copy link
Collaborator

Fixes all the security issues for the rtMedia plugin : #2240

nayemDevs and others added 7 commits December 3, 2025 20:07
…2242)

* chore(tests): update dependencies in wp-e2e-playwright package.json

* fix(workflow): update NODE_VERSION to 20 in Playwright CI configuration

* fix(workflow): revert NODE_VERSION to 17 in Playwright CI configuration
…or encoding (#2247)

* fix(importer): replace die() with exit() in BPMediaAlbumimporter

* Potential fix for code scanning alert no. 13: Incomplete string escaping or encoding
@NoumaanAhamed NoumaanAhamed changed the base branch from master to develop December 31, 2025 12:42
@NoumaanAhamed NoumaanAhamed marked this pull request as ready for review December 31, 2025 12:42
@NoumaanAhamed NoumaanAhamed requested a review from mi5t4n December 31, 2025 12:42
* fix(importer): replace die() with exit() in BPMediaAlbumimporter

* fix: add explicit permissions to GitHub Actions workflows

- Add permissions block to phpcs_on_pull_request.yml (contents: read, pull-requests: write)
- Add permissions block to create.yml (contents: read)
- Add permissions block to playwright.yml (contents: read)

This follows the principle of least privilege and resolves GitHub code scanning alerts #1, #2, and #39.

Fixes: rtCamp/support#245

---------

Co-authored-by: rtBot <43742164+rtBot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings January 1, 2026 12:56
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 security vulnerabilities identified by CodeQL analysis for the rtMedia plugin, focusing on XSS prevention, input sanitization, and secure coding practices.

Key Changes:

  • Added HTML escaping and input sanitization functions to prevent XSS attacks
  • Updated magnific-popup library from v1.0.0 to v1.2.0 with enhanced security controls
  • Upgraded test dependencies and added GitHub Actions permission restrictions
  • Fixed regex patterns and replaced unsafe HTML methods with safer alternatives

Reviewed changes

Copilot reviewed 10 out of 12 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/wp-e2e-playwright/package.json Updated Playwright and WordPress packages to latest versions, added webpack-dev-server override
tests/codeception/composer.json Upgraded wp-browser from v2.4 to v3.0
app/importers/BPMediaAlbumimporter.php Replaced die(true) with exit for proper script termination
app/assets/js/vendors/magnific-popup.js Updated library to v1.2.0 with new security options for HTML handling
app/assets/js/rtMedia.js Changed .html() to .text() for user content, enabled allowHTMLInTemplate flag
app/assets/js/rtMedia.backbone.js Added XSS prevention functions and input sanitization for IDs and file names
app/assets/admin/js/settings.js Fixed regex to use global flag for replacing all occurrences
.github/workflows/*.yml Added explicit permission restrictions to workflow files

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

Comment on lines +803 to 807
if (mfp.st.allowHTMLInTemplate) {
template.find(EVENT_NS + '-'+key).html(value);
} else {
options.items = el;
el.off( eName ).on( eName, eHandler );
template.find(EVENT_NS + '-'+key).text(value);
}
Copy link

Copilot AI Jan 1, 2026

Choose a reason for hiding this comment

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

The magnific-popup library update includes changes to how HTML content is handled. Line 696-700 uses mfp.preloader.html(text) when allowHTMLInStatusIndicator is true, and mfp.preloader.text(text) otherwise. However, Line 803-807 also has a similar pattern for template handling with allowHTMLInTemplate. The security relies on these flags being set to false by default, which is correct, but usage in rtMedia.js sets allowHTMLInTemplate: true on line 65. This needs careful review to ensure no untrusted user input flows through these templates.

Copilot uses AI. Check for mistakes.
NoumaanAhamed and others added 2 commits January 1, 2026 19:02
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* chore: update magnific popup to v1.2.0

* fix: improve close button markup handling and prependTo selector logic

* fix: resolve merge conflicts in close button markup and prependTo logic
@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/admin/js/settings.js
  • app/assets/js/rtMedia.backbone.js
  • app/assets/js/rtMedia.js
  • app/assets/js/vendors/magnific-popup.js
  • app/importers/BPMediaAlbumimporter.php

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

@mi5t4n mi5t4n changed the title Fix/codeql issues fix: CodeQL security issues 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 fb70f35 into develop Jan 2, 2026
5 of 6 checks passed
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.

5 participants