Sanitized above-fold image IDs to prevent XSS - #1116
Merged
Conversation
girishpanchal30
force-pushed
the
bugfix/optimole-service/1776
branch
from
August 24, 2026 12:24
d4b8c0c to
3cebc53
Compare
Collaborator
girishpanchal30
requested
a balanced review from Copilot
and removed request for
Copilot
August 24, 2026 12:31
Contributor
There was a problem hiding this comment.
Pull request overview
Prevents stored XSS through profiler debug comments by validating image IDs and safely encoding profile data.
Changes:
- Sanitizes submitted above-fold image IDs.
- Hex-encodes HTML-sensitive JSON characters.
- Adds an XSS regression test.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
inc/rest.php |
Sanitizes submitted image IDs. |
inc/v2/PageProfiler/Profile.php |
Safely encodes profiler comments. |
tests/test-lazyload-viewport.php |
Tests comment breakout prevention. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
girishpanchal30
force-pushed
the
bugfix/optimole-service/1776
branch
from
August 24, 2026 13:59
41a1ea2 to
c45ad03
Compare
girishpanchal30
requested review from
Soare-Robert-Daniel
and
a balanced review from Copilot
August 24, 2026 14:14
selul
approved these changes
Aug 25, 2026
Collaborator
|
🎉 This PR is included in version 4.2.11 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All Submissions:
Changes proposed in this Pull Request:
Handling the above-the-fold image data in profiler debug comments to prevent XSS (cross-site scripting) via malformed or malicious image IDs.
Closes https://github.com/Codeinwp/optimole-service/issues/1776
Other information: