This repository was archived by the owner on Jul 31, 2026. It is now read-only.
Potential fix for code scanning alert no. 1: Incomplete multi-character sanitization - #4
Closed
scorpion7slayer wants to merge 1 commit into
Closed
Potential fix for code scanning alert no. 1: Incomplete multi-character sanitization#4scorpion7slayer wants to merge 1 commit into
scorpion7slayer wants to merge 1 commit into
Conversation
…er sanitization Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
scorpion7slayer
marked this pull request as ready for review
March 8, 2026 02:49
Code Review SummaryStatus: No Issues Found | Recommendation: Merge OverviewThis PR correctly addresses the GitHub code scanning alert about incomplete multi-character sanitization. The change replaces the manual regex-based HTML stripping (
Security Analysis
Files Reviewed (1 file)
|
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Potential fix for https://github.com/scorpion7slayer/NxtGit/security/code-scanning/1
General approach: avoid custom regex-based HTML stripping and instead use a well-tested sanitizer (DOMPurify) to convert the description to plain text, ensuring no residual tag fragments (like
<script) remain. DOMPurify can be configured to return a string where all markup is removed but text content is preserved.Best concrete fix here: replace
entry.description.replace(/<[^>]*>/g, '')with a DOMPurify call that produces plain text, then truncate that. Since DOMPurify is already imported at the top ofAppChangelog.tsx, we don’t need new imports. A suitable option isDOMPurify.sanitize(entry.description, { ALLOWED_TAGS: [], ALLOWED_ATTR: [] }), which strips all HTML tags and attributes, leaving only text. We then apply.substring(0, 200)to this sanitized text, just as before.Change location: in
src/components/AppChangelog.tsx, around line 198–201 whereentry.descriptionis rendered. Only that expression needs to be replaced; no extra helpers or methods are strictly required. Functionality remains the same (show up to 200 characters of description text), but we now rely on DOMPurify instead of a brittle regex.Suggested fixes powered by Copilot Autofix. Review carefully before merging.