This repository was archived by the owner on Oct 1, 2026. It is now read-only.
Repository navigation
[CTX-0083] fix(codeql): resolve remaining code scanning alerts - #147
Merged
Merged
Conversation
#6) statSync(path).isFile() ? readFileSync(path) : undefined still checks then uses the same path, so CodeQL js/file-system-race (alert #6, severity high) still flagged it after the prior existsSync -> statSync change. Read directly and treat any read failure (ENOENT, race, wrong type) as "no content" via try/catch, matching CodeQL's own recommended fix and the file-log/config helpers already using this pattern earlier in the same file. Priority: P1 | Area: ci | Labels: fix,P1,area:ci | Milestone: v0.1.0 | RFC: - | Task: CTX-0083
- Remove unused 'rmdirSync' import (alert #4) - Fix file-system-race (TOCTOU) alerts by replacing existsSync checks with try-catch: - Directory existence check before readdirSync - File existence checks before copyFileSync (4 locations) - File existence check before appendFileSync - All local checks pass: just check, type-check, fmt-check, test
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Resolve remaining CodeQL alerts:
appendFileSync,renameSync(fixed by fix(codeql): resolve code scanning alerts #146)ProtocolErrorImpl,decodeResponse(fixed by fix(codeql): resolve code scanning alerts #146)js/file-system-race, high severity): the priorexistsSync(path) && statSync(path).isFile() ? readFileSync(path) : undefinedstill checks then uses the same path, so CodeQL kept flagging it after the
existsSync->statSyncchange. Fixed by readingcurrentDatabasedirectly and mapping any read failure (missing file, race, wrong type) to
undefinedvia try/catch, matching CodeQL's own recommended fix and thepattern already used by the log/config readers earlier in the same file.
main(PR fix(codeql): resolve code scanning alerts #146) to pick up its alert fixes and re-verifiedno remaining alerts for this PR's merge ref.
All tests pass:
Local gates:
just check(fmt, lint, type-check,bun test,cargo test)green.
Closes code scanning alerts #2 (aka #6 after renumbering), #3, #4
Priority: P1 | Area: ci | Labels: fix,P1,area:devtools | Milestone: v0.1.0 | RFC: - | Task: CTX-0083