Repository navigation
fix: audit 2026-11-10 CPU, hang, and robustness bugs - #6
Open
rush-skills wants to merge 20 commits into
Open
rush-skills wants to merge 20 commits into
rush-skills wants to merge 20 commits into
Conversation
Empty or whitespace-only strings in detector add/addPhrases lists compiled to a zero-width regex alternative, so exec() never advanced lastIndex. Validate them out, filter them in detectors, and bump lastIndex on any remaining zero-width match. Co-authored-by: Ankur Singh <hello@anks.in>
Each space used to become its own `(…\s)+` group, so a phrase with N spaces against a long blank run backtracked polynomially. Trim and replace each whitespace run with a single flexible group; matching semantics for normal multi-word phrases stay the same. Co-authored-by: Ankur Singh <hello@anks.in>
Walking back over every letter/dot run at each period was O(n^2) on inputs like a.a.a.… Cap the walk at the longest abbreviation length + 1; a longer run can never match an abbreviation, so results are unchanged. Co-authored-by: Ankur Singh <hello@anks.in>
getLineCol re-split the text prefix for every issue (O(issues × n)). Build line-start offsets once and binary-search; output is identical to the old 1-based line/column, including CRLF. Co-authored-by: Ankur Singh <hello@anks.in>
fix_duplicates re-detected after every single removal, so cost grew with (duplicates × n). Detect once and strip from the right; earlier indexes stay valid and the cleaned text plus fix list match the old loop. Co-authored-by: Ankur Singh <hello@anks.in>
An unclosed `<!--` made `/<!--[\s\S]*?-->/g` walk to EOF at every opener. Walk with indexOf and stop when no closer remains; single-line comments still become sentinels and multi-line comments still space-blank. Co-authored-by: Ankur Singh <hello@anks.in>
kept.some() was O(k^2). Sorted spans are covered exactly when they end at or before the furthest kept end, so one running maximum is enough. Co-authored-by: Ankur Singh <hello@anks.in>
…open
NaN from Number('zero') made exitCode treat the gate as unlimited.
Parse --max-warnings as an integer >= -1 up front; otherwise print
an error and exit 2 so a blocking CI check cannot silently pass.
Co-authored-by: Ankur Singh <hello@anks.in>
A JSON body of null crashed handleMcpRequest and returned a non-JSON-RPC 500. Reject null/array/non-objects with -32600 and id null, and use id ?? null on the version error so unknown ids follow the spec. Co-authored-by: Ankur Singh <hello@anks.in>
A line like ```js``` opened a fence and blanked the rest of the document, and a shorter inner fence could close an outer one. Record the opener length, close only on the same character with length >= that, and ignore backtick fences whose info string contains a backtick. Co-authored-by: Ankur Singh <hello@anks.in>
readFile on a directory, FIFO, or huge device could hang or OOM the local MCP server. Require a regular file whose size is within MAX_TEXT_LENGTH * 4 bytes, then keep the character-length check. Co-authored-by: Ankur Singh <hello@anks.in>
Unescaped %, CR/LF, commas, and colons in ::warning annotations split or mis-attribute messages. Apply toolkit escaping so match text and file paths stay on one annotation line. Co-authored-by: Ankur Singh <hello@anks.in>
grep -oE 'Found [0-9]+' took the first hit anywhere, including annotation text like [insert Found 12 here]. Match the CLI summary line instead. Co-authored-by: Ankur Singh <hello@anks.in>
server.ts imports zod but only the MCP SDK listed it, so a future SDK that stops hoisting it would break the install. Add the same range the SDK already peer-depends on. Co-authored-by: Ankur Singh <hello@anks.in>
The catch path swallowed runtime exceptions with no log line. Write the tool name and error to console (no user text) so Workers observability can surface it. Co-authored-by: Ankur Singh <hello@anks.in>
The script still required wsc-mcp 2.0.0 and wsc-lint 1.0.0, which have not matched the packages for several releases, and nothing invokes it. Remove that section; CI already tests the real versions. Co-authored-by: Ankur Singh <hello@anks.in>
static/schema.json forbids additional properties on {word, suggestion}
entries, but validateConfig accepted them. Mirror the schema so a
typo in a .wscrc.json add item fails closed.
Co-authored-by: Ankur Singh <hello@anks.in>
Coverage skipped the markdown masker and the new line-index helper, which is where several of the CPU fixes live. Count them so the regression tests stay in the measured set. Co-authored-by: Ankur Singh <hello@anks.in>
svelte-check rejected Record<string, unknown> as JsonRpcRequest. The plain-object check already rejected null/arrays; go through unknown for the remaining field destructure. Co-authored-by: Ankur Singh <hello@anks.in>
…ells Calling list_word_lists and the byte-size cap, masking a tilde fence, and disabling aiTells in the all-off analyzer case keep coverage above the configured thresholds after markdown.ts joined the include set. Co-authored-by: Ankur Singh <hello@anks.in>
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
wsc | 3c10203 | Nov 11 2026, 10:33 AM |
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.
Fixes from the 2026-11-10 whole-repo audit against
origin/master5ecd1e8. Behaviour for normal input is unchanged except where the old behaviour was a hang, a 500, a fail-open gate, or a CommonMark fence bug.High (all done)
add/addPhrasesentries are rejected byvalidateConfig, filtered in detectors, andexecloops bumplastIndexon a zero-width match so the matcher cannot spin forever.flexibleSourcecollapses whitespace runs to one flexible group, so a 4-space custom phrase against 5 000 blanks finishes in under 50 ms.splitSentencesabbreviation back-walk is capped at longest abbreviation + 1.'a.'.repeat(50000)finishes in under 200 ms.makeLineIndex(line starts + binary search) replaces the fivesubstring(0, i).split('\n')copies. Output is the same 1-based line/column, including CRLF.fix_duplicatesdetects once and removes right-to-left. Text and fix-list order match the old loop; 8k duplicates finish in under 200 ms. No length cap added (needs your call — see below).Medium (done)
indexOf; unclosed<!--is O(n).'<!--'.repeat(25000)under 200 ms.maxKeptEndinstead ofkept.some.--max-warningsmust be an integer ≥ -1 at parse time; otherwiseError: --max-warnings must be an integerand exit 2.action.ymlunchanged beyond the summary-line grep in #20.null/ array / non-object/mcpbodies return JSON-RPC-32600withid: nullinstead of a non-JSON-RPC 500. Version errors useid ?? null.Other low-risk (done)
```js```line is not a fence opener.check_filestats first: require a regular file and size ≤MAX_TEXT_LENGTH * 4bytes, then the character check.::warningdata/properties escaped (%, CR/LF,,,:).total-issuesreads^Found [0-9]+ issue(summary line), not the firstFound Nin annotations.zoddependency onwsc-mcp(^3.25 || ^4.0).console.error('mcp tools/call failed', toolName, err)before-32603.scripts/test-all.sh.validateConfigrejects extra keys on nominalizationadditems (matchesschema.json).markdown.tsandlinecol.tsadded to coverage include; regression tests with timing bounds for each perf fix.Needs your decision — skipped (no new limits or policy changes)
These were called out as owner decisions. Nothing below is in this PR.
fix_duplicatesenforce the same 100 000-char limit ascheck_text?check_text. Easy to add inhandleFixDuplicates/ the npmfix_duplicatestool.Content-Length+ streamed byte count; 1 000 entries of ≤ 200 chars invalidateConfig.MAX_TEXT_LENGTHfrom 100k?/api/*and/mcpno-store/nosniff/ CORS intohooks.server.ts(and drop dead_headersblocks)?Also skipped (behaviour or protocol change, or owned by PR #5):
wsc initoverwrite vs--force.check_fileto MCP roots / cwd.202for notifications +ping.isError: true(response shape).npm ci --ignore-scripts/ SHA-pinsetup-nodein the consumer Action.\|\| true, version strings). Left untouched.No merge, deploy, npm publish, or GitHub/Cloudflare settings changes.
Local CI (this head)
Ran the jobs in
.github/workflows/ci.ymllocally:npm run checknpm testnpm run buildcd mcp-server && npm run buildtimeout 2 node mcp-server/dist/mcp-server/index.js < /dev/null || truecd cli && npm run build--quiet,list,list weaselWords,initExtra, not in CI:
npm run test:coveragemeets thresholds (stmts 96.52, branches 93.52, funcs 96.63, lines 98.30).Perf regression tests (timing bounds) live in:
tests/core/empty-add.test.ts(fix(editor): align highlight overlay with text (was ~2px off) #1, 1s timeout)tests/core/flexible-source.test.ts(Exclude certain files from checking #2, < 50 ms)tests/core/detector-sentences.test.ts(feat(action): add exclude input for skipping files without .wscrc.json #3, < 200 ms)tests/core/linecol.test.ts(fix(action): skip only-changed PRs that match no docs #4, < 200 ms)tests/core/detector.test.ts(fixDuplicateWords, Automate releases with release-please #5, < 200 ms)tests/core/markdown.test.ts(#7, < 200 ms)tests/core/detector-ai-tells.test.ts(#8, < 200 ms)