Skip to content

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

Merged
mokesano merged 2 commits into
mainfrom
alert-autofix-27
Jun 2, 2026
Merged

Potential fix for code scanning alert no. 27: Incomplete multi-character sanitization#29
mokesano merged 2 commits into
mainfrom
alert-autofix-27

Conversation

@mokesano

Copy link
Copy Markdown
Owner

Potential fix for https://github.com/mokesano/editorial-pro/security/code-scanning/27

Best fix: avoid regex-based HTML stripping and instead parse via the browser DOM, then read textContent. This is safer and avoids incomplete multi-character sanitization issues.

In public/js/app/custom/wizdam/WizdamArticleStyle.js, update the extractTitle function (around line 2270):

  • Keep existing title slicing logic.
  • Replace .replace(/<[^>]*>/g, '') with a call to a helper that decodes/removes markup via a detached DOM node:
    • Create a temporary element (document.createElement('div'))
    • Assign innerHTML to the sliced string
    • Return textContent (or empty string), trimmed.

No new dependency is required; this uses standard browser APIs.

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

@mokesano mokesano self-assigned this Apr 28, 2026
@mokesano mokesano requested a review from archoun April 28, 2026 10:49
@mokesano mokesano added bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request labels Apr 28, 2026
@mokesano mokesano marked this pull request as ready for review April 28, 2026 10:50
…ter sanitization

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@mokesano mokesano merged commit 5159030 into main Jun 2, 2026
12 checks passed
@mokesano mokesano deleted the alert-autofix-27 branch June 2, 2026 11:47
@github-project-automation github-project-automation Bot moved this from Todo to Done in wizdam-fork Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants