Skip to content

Commit 87250fa

Browse files
committed
Fix TOCTOU bug for search_ql_code tool
1 parent 871bc75 commit 87250fa

File tree

3 files changed

+10
-20
lines changed

3 files changed

+10
-20
lines changed

server/dist/codeql-development-mcp-server.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63058,13 +63058,9 @@ async function searchQlCode(params) {
6305863058
for (const file of filesToSearch) {
6305963059
if (collectedEnough) {
6306063060
try {
63061-
const st = lstatSync(file);
63062-
if (!st.isFile()) continue;
63063-
const content = st.size <= MAX_FILE_SIZE_BYTES ? readFileSync9(file, "utf-8") : null;
63064-
if (content) {
63065-
for (const line of content.replace(/\r\n/g, "\n").split("\n")) {
63066-
if (regex.test(line)) totalMatches++;
63067-
}
63061+
const content = readFileSync9(file, "utf-8");
63062+
for (const line of content.replace(/\r\n/g, "\n").split("\n")) {
63063+
if (regex.test(line)) totalMatches++;
6306863064
}
6306963065
} catch {
6307063066
}

0 commit comments

Comments
 (0)