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:
+22
-26
@@ -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
@@ -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',
|
||||
]);
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user