Skip to content

fix: remove dead try/catch in insertNode and fix SENSITIVE_PATHS case sensitivity#327

Merged
colbymchenry merged 2 commits into
colbymchenry:mainfrom
zichen0116:fix/remove-dead-try-catch-and-fix-case-sensitivity
May 22, 2026
Merged

fix: remove dead try/catch in insertNode and fix SENSITIVE_PATHS case sensitivity#327
colbymchenry merged 2 commits into
colbymchenry:mainfrom
zichen0116:fix/remove-dead-try-catch-and-fix-case-sensitivity

Conversation

@zichen0116
Copy link
Copy Markdown
Contributor

Changes

Two small fixes:

1. Remove dead try/catch in QueryBuilder.insertNode()

src/db/queries.ts — The try/catch block around this.stmts.insertNode.run() only re-throws the error, adding no value. Removed it to reduce noise.

- try {
-   this.stmts.insertNode.run({...});
- } catch (error) {
-   throw error;
- }
+ this.stmts.insertNode.run({...});

2. Fix SENSITIVE_PATHS case-sensitivity bug on Windows

src/utils.ts — The SENSITIVE_PATHS Set contained PascalCase entries (C:\Windows) but the comparison used resolved.toLowerCase(), so Windows paths would never match the sensitive path check.

Normalized all entries to lowercase to fix the comparison.

Both fixes are minimal, low-risk code quality improvements.

… sensitivity

1. Remove no-op try/catch in QueryBuilder.insertNode() that just
   re-throws the error without adding any value.

2. Fix SENSITIVE_PATHS case-sensitivity bug on Windows: the Set contained
  PascalCase entries ('C:\\Windows') but the comparison used
  resolved.toLowerCase(), which would never match. Normalize all entries
  to lowercase so the comparison works correctly.
@colbymchenry colbymchenry force-pushed the fix/remove-dead-try-catch-and-fix-case-sensitivity branch from c510421 to e5a06b1 Compare May 22, 2026 18:36
Adds cross-platform coverage that POSIX system dirs are blocked, that a
normal dir is allowed, and a Windows-gated case (C:\Windows vs c:\windows)
that locks in the SENSITIVE_PATHS case-insensitivity fix.
@colbymchenry colbymchenry force-pushed the fix/remove-dead-try-catch-and-fix-case-sensitivity branch from e5a06b1 to fefcaaf Compare May 22, 2026 19:09
@colbymchenry colbymchenry merged commit 7d5dd4c into colbymchenry:main May 22, 2026
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.

2 participants