fix: remove dead try/catch in insertNode; fix SENSITIVE_PATHS case-sensitivity (#327)

Drop the no-op try/catch around insertNode.run, and lowercase the Windows
SENSITIVE_PATHS entries so validateProjectPath's case-insensitive check
actually blocks c:\windows. Adds a validateProjectPath test (POSIX +
Windows-gated); the Windows-gated case was validated on a real Windows 11 VM.

Closes #327
This commit is contained in:
Leon.C
2026-05-22 14:13:42 -05:00
committed by GitHub
parent c9d2a25b73
commit 7d5dd4cda7
3 changed files with 54 additions and 28 deletions
+22 -26
View File
@@ -230,32 +230,28 @@ export class QueryBuilder {
// deleteNode below).
this.nodeCache.delete(node.id);
try {
this.stmts.insertNode.run({
id: node.id,
kind: node.kind,
name: node.name,
qualifiedName: node.qualifiedName ?? node.name,
filePath: node.filePath,
language: node.language,
startLine: node.startLine ?? 0,
endLine: node.endLine ?? 0,
startColumn: node.startColumn ?? 0,
endColumn: node.endColumn ?? 0,
docstring: node.docstring ?? null,
signature: node.signature ?? null,
visibility: node.visibility ?? null,
isExported: node.isExported ? 1 : 0,
isAsync: node.isAsync ? 1 : 0,
isStatic: node.isStatic ? 1 : 0,
isAbstract: node.isAbstract ? 1 : 0,
decorators: node.decorators ? JSON.stringify(node.decorators) : null,
typeParameters: node.typeParameters ? JSON.stringify(node.typeParameters) : null,
updatedAt: node.updatedAt ?? Date.now(),
});
} catch (error) {
throw error;
}
this.stmts.insertNode.run({
id: node.id,
kind: node.kind,
name: node.name,
qualifiedName: node.qualifiedName ?? node.name,
filePath: node.filePath,
language: node.language,
startLine: node.startLine ?? 0,
endLine: node.endLine ?? 0,
startColumn: node.startColumn ?? 0,
endColumn: node.endColumn ?? 0,
docstring: node.docstring ?? null,
signature: node.signature ?? null,
visibility: node.visibility ?? null,
isExported: node.isExported ? 1 : 0,
isAsync: node.isAsync ? 1 : 0,
isStatic: node.isStatic ? 1 : 0,
isAbstract: node.isAbstract ? 1 : 0,
decorators: node.decorators ? JSON.stringify(node.decorators) : null,
typeParameters: node.typeParameters ? JSON.stringify(node.typeParameters) : null,
updatedAt: node.updatedAt ?? Date.now(),
});
}
/**
+1 -1
View File
@@ -43,7 +43,7 @@ import * as path from 'path';
const SENSITIVE_PATHS = new Set([
'/', '/etc', '/usr', '/bin', '/sbin', '/var', '/tmp', '/dev', '/proc', '/sys',
'/root', '/boot', '/lib', '/lib64', '/opt',
'C:\\', 'C:\\Windows', 'C:\\Windows\\System32',
'c:\\', 'c:\\windows', 'c:\\windows\\system32',
]);
/**