fix: resolve CodeQL security-and-quality findings#354
Merged
Conversation
- redact: rewrite the internal-host mask with indexOf + a flat char-class test; the previous end-anchored nested-quantifier regex backtracked quadratically on input like ".-.-.-.-". - core: strip the spool-system-prelude marker via indexOf scanning instead of a `<open>[\s\S]*?<close>` regex, which backtracked quadratically on many unterminated open markers. - app: HTML-escape search-snippet text before dangerouslySetInnerHTML so only the highlight markers we inject become elements; indexed session content is shown as inert text. - share-kit: decode `&` last in decodeEntities so `&lt;` resolves to the literal `<` rather than being double-unescaped; replace the overly-broad CJK character range with disjoint CJK/kana/hangul blocks. - ci: add a minimal `contents: read` permissions block to the e2e workflow. - test(e2e): drop two no-op identity `.replace()` calls. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Clears the open CodeQL code-scanning alerts. Each change is the high-confidence true positive; the lower-value/false-positive alerts (title tag-stripping, internal-only binary-name lookups) were left alone.
Changes
mask.ts) —internal-hostmask now extracts the domain suffix withindexOf+ a flat character-class check. The previous end-anchored, nested-quantifier regex backtracked quadratically on input like.-.-.-.-. Output is unchanged for real hostnames.spool-prelude.ts) —stripSpoolSystemPreludescans withindexOfinstead of/<open>[\s\S]*?<close>/g, which backtracked quadratically when many unterminated open markers appeared. Behavior is identical for normal input; an unterminated marker is left intact.snippet.ts) — search-snippet text is HTML-escaped beforedangerouslySetInnerHTML, so only the<mark>highlight markers we inject become elements and indexed session content renders as inert text.source.ts) —decodeEntitiesnow decodes&last, so&lt;resolves to the literal<instead of being double-unescaped to<. ThestatsCJK character class drops the redundant Hiragana/Katakana sub-ranges (they sit insideU+3000–U+9FFF), removing the overlap warning with no change to what matches.e2e.yml) — added a minimal top-levelpermissions: contents: readblock..replace()calls.Tests