Skip to content

Potential fix for code scanning alert no. 1: Incomplete multi-character sanitization - #1

Merged
PRATHAM777P merged 1 commit into
mainfrom
alert-autofix-1
Apr 27, 2026
Merged

PRATHAM777P merged 1 commit into
mainfrom
alert-autofix-1

Conversation

@PRATHAM777P

Copy link
Copy Markdown
Owner

Potential fix for https://github.com/PRATHAM777P/AlphaMind/security/code-scanning/1

Use a robust sanitization strategy in stripTags by repeatedly applying tag removal until the string stabilizes, then decoding entities, and finally removing raw angle brackets as a defensive final step. This directly addresses incomplete multi-character sanitization without changing the public API or intended behavior (returning plain text).

Best single fix in src/tools/fetch/web-fetch-utils.ts:

  • Replace the body of stripTags (around lines 15–17).
  • Implement a loop (do...while) that repeatedly applies /<[^>]+>/g until no further changes occur.
  • Decode entities after stabilization.
  • Remove any remaining < or > characters with replace(/[<>]/g, "") to prevent residual tag starts/ends.

No new imports or dependencies are required.

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

…er sanitization

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@PRATHAM777P
PRATHAM777P marked this pull request as ready for review April 27, 2026 18:10
@PRATHAM777P
PRATHAM777P merged commit 7e3721a into main Apr 27, 2026
2 checks passed
@PRATHAM777P
PRATHAM777P deleted the alert-autofix-1 branch April 27, 2026 18:11
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.

1 participant