Understand any codebase instantly. System intelligence for codebases, built for humans and AI.
TypeScript aiai-memoryclaude-codeclicode-analysiscode-mappingcode-memorycodebase-understandingcodexdeveloper-toolsllmopenclawpersistent-memoryprogram-analysissoftware-architecturesystem-intelligencesystem-mapping
Security/codeql alert fixes (#149)
josephismikhaila924e1500292
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex df5ff771..3ac6e7fe 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -6,6 +6,9 @@ on:pull_request:branches: [main]+permissions:+ contents: read+jobs:cli:name: CLI (TypeScript)diff --git a/.github/workflows/notify-sync.yml b/.github/workflows/notify-sync.ymlindex 8a5f368b..a212a8b8 100644--- a/.github/workflows/notify-sync.yml+++ b/.github/workflows/notify-sync.yml@@ -11,6 +11,8 @@ on:release:types: [published]+permissions: {}+jobs:notify:runs-on: ubuntu-latestdiff --git a/core-ingestion/src/index.ts b/core-ingestion/src/index.tsindex 1162820f..d2f3852d 100644--- a/core-ingestion/src/index.ts+++ b/core-ingestion/src/index.ts@@ -312,7 +312,7 @@ function parseYamlFile(filePath: string, source: string): FileParseResult {const lineStarts = computeLineStarts(source);const lines = source.split(/\r?\n/);const stack: Array<{ indent: number; key: string }> = [];- const keyLinePattern = /^(\s*)(?:-\s+)?([A-Za-z0-9_.-]+)\s*:(?:\s*.*)?$/;+ const keyLinePattern = /^(\s*)(?:-\s+)?([A-Za-z0-9_.-]+)\s*:.*$/;for (let index = 0; index < lines.length; index++) {const line = lines[index];@@ -853,7 +853,7 @@ function parseDockerfileFile(filePath: string, source: string): FileParseResultfor (let index = 0; index < lines.length; index++) {const line = lines[index];- const trimmedEnd = line.replace(/\s+$/, '');+ const trimmedEnd = line.trimEnd();const lineContent = pending ? `${pending}\n${line}` : line;if (!pending) logicalStartLine = index + 1;@@ -890,10 +890,20 @@ function parseDockerfileFile(filePath: string, source: string): FileParseResult/** Strip -- line comments and /* block comments *\/ from SQL source. */function stripSqlComments(source: string): string {- // Block comments first, then line comments- return source- .replace(/\/\*[\s\S]*?\*\//g, match => match.replace(/[^\n]/g, ' '))- .replace(/--[^\n]*/g, match => ' '.repeat(match.length));+ // Block comments: use indexOf to avoid ReDoS from regex backtracking+ let result = '';+ let i = 0;+ while (i < source.length) {+ const start = source.indexOf('/*', i);+ if (start === -1) { result += source.slice(i); break; }+ result += source.slice(i, start);+ const end = source.indexOf('*/', start + 2);+ if (end === -1) { result += source.slice(start).replace(/[^\n]/g, ' '); break; }+ result += source.slice(start, end + 2).replace(/[^\n]/g, ' ');+ i = end + 2;+ }+ // Line comments: [^\n]* is always linear (no backtracking possible)+ return result.replace(/--[^\n]*/g, match => ' '.repeat(match.length));}/** Extract unquoted table/view names following FROM, JOIN variants, INTO, UPDATE, REFERENCES. */