Skip to content

fix(readme): strip link-text markup to a fixed point - #9

Merged
kanywst merged 2 commits into
mainfrom
fix/codeql-strip
Oct 24, 2026
Merged

kanywst merged 2 commits into
mainfrom
fix/codeql-strip

Conversation

@kanywst

@kanywst kanywst commented Oct 24, 2026

Copy link
Copy Markdown
Member

CodeQL default setup, enabled today with the extended suite for actions, JavaScript/TypeScript and Python, raised one alert: js/incomplete-multi-character-sanitization at src/lib/readme.ts:62. A single pass of the tag-stripping regex over link text leaves <script behind from <scr<b>ipt>.

Was it exploitable? No. Segments only ever reach the page as text, through Astro's escaping and textContent.

What changes. The strip now repeats until nothing changes and then drops any stray angle brackets. A unit test covers the nested-tag case.

Checks. Unit tests 37 passed, e2e 43 passed.

CodeQL (js/incomplete-multi-character-sanitization) flagged the single-pass tag
strip: '<scr<b>ipt>' left '<script' behind. The text was only ever rendered as
text, but it now reads as plain text too, with no angle brackets left.
@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0d8514cf-134a-42c4-900f-6c928c514a02
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@claude

claude Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Clean against injection, CSP, two-views, input/focus and sync checks. The diff only touches src/lib/readme.ts (stripTags) and its test. Link text still reaches the page as text only, with no new hosts, inline styles or DOM changes. The stripped text is also free of < and > before entity decoding.

@kanywst
kanywst merged commit dcf751c into main Oct 24, 2026
12 checks passed
@kanywst
kanywst deleted the fix/codeql-strip branch October 24, 2026 15:53
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