Skip to content

Potential fix for code scanning alert no. 3: DOM text reinterpreted as HTML#1316

Merged
dkotter merged 2 commits into
developfrom
Use-`encodeURIComponent`-for-user-input-search-text
Jul 8, 2025
Merged

Potential fix for code scanning alert no. 3: DOM text reinterpreted as HTML#1316
dkotter merged 2 commits into
developfrom
Use-`encodeURIComponent`-for-user-input-search-text

Conversation

@Sidsector9

Copy link
Copy Markdown
Member

Potential fix for https://github.com/10up/distributor/security/code-scanning/3

To fix this issue, we need to ensure that the user input from searchField.value is properly sanitized or encoded before being used in the URL. The best way to do this is to use a library that provides functions for escaping or encoding user input to prevent XSS attacks.

In this case, we can use the encodeURIComponent function, which is a built-in JavaScript function that encodes a URI component by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…s HTML

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@github-actions github-actions Bot added this to the 2.2.0 milestone May 21, 2025
@github-actions github-actions Bot added the needs:refresh This requires a refreshed PR to resolve. label May 27, 2025
@jeffpaul jeffpaul moved this to Code Review in Open Source Practice Jul 7, 2025
@jeffpaul jeffpaul requested review from dkotter and peterwilsoncc July 7, 2025 19:16
Comment thread assets/js/admin-pull.js Outdated
@github-actions github-actions Bot removed the needs:refresh This requires a refreshed PR to resolve. label Jul 8, 2025
@github-project-automation github-project-automation Bot moved this from Code Review to QA Testing in Open Source Practice Jul 8, 2025
@dkotter dkotter marked this pull request as ready for review July 8, 2025 15:35
@dkotter dkotter requested a review from a team as a code owner July 8, 2025 15:35
@dkotter dkotter merged commit 02a8792 into develop Jul 8, 2025
18 of 19 checks passed
@dkotter dkotter deleted the Use-`encodeURIComponent`-for-user-input-search-text branch July 8, 2025 15:35
@github-project-automation github-project-automation Bot moved this from QA Testing to Done in Open Source Practice Jul 8, 2025
@github-actions github-actions Bot added the needs:feedback This requires reporter feedback to better understand the request. label Jul 8, 2025
@github-actions

github-actions Bot commented Jul 8, 2025

Copy link
Copy Markdown

@Sidsector9 thanks for the PR! Could you please fill out the PR template with description, changelog, and credits information so that we can properly review and merge this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs:feedback This requires reporter feedback to better understand the request.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants