Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
pull_request:
branches: [main]

permissions:
contents: read

jobs:
cli:
name: CLI (TypeScript)
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/notify-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ on:
release:
types: [published]

permissions: {}

jobs:
notify:
runs-on: ubuntu-latest
Expand Down
22 changes: 16 additions & 6 deletions core-ingestion/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -514,7 +514,7 @@ function parseDockerfileFile(filePath: string, source: string): FileParseResult

for (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;

Expand Down Expand Up @@ -551,10 +551,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. */
Expand Down
Loading