You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e2a0bce
Browse filesBrowse the repository at this point in the historyBrowse files
test(snapshot): compare the written header by string equality, never as a pattern built from the schema URL
The flow and library tests built a RegExp from SNAPSHOT_SCHEMA_URL (dots escaped by hand), which CodeQL reads as a hostname pattern that can match more hosts than intended. The header is now split into lines and the schema pin compared whole; a look-alike host with one dot replaced is pinned as rejected. The unwritable-path assertion drops its path-derived RegExp the same way.
`^# yaml-language-server: \\$schema=${SNAPSHOT_SCHEMA_URL.replaceAll(".","\\.")}\n# Snapshot of o/r taken \\d{4}-\\d{2}-\\d{2}T[\\d:.]+Z\n# actions_secrets: ${SECRET_NOTE.replaceAll("[","\\[").replaceAll("]","\\]")}\nlabels:\n`,
`^cannot write the snapshot to ${cfg.snapshotFile.replaceAll(".","\\.")}: .*(EEXIST|ENOTDIR).*\\. Check that the "snapshot-file" input names a writable path$`,
199
-
),
200
-
),
201
-
});
223
+
const[first]=collected.lines;
224
+
expect(first?.level).toBe("error");
225
+
// The path is compared as text, never as a pattern; the OS error code sits between.
226
+
expect(first?.line.startsWith(`cannot write the snapshot to ${cfg.snapshotFile}: `)).toBe(true);
227
+
expect(first?.line).toMatch(/E(EXIST|NOTDIR)/);
228
+
expect(
229
+
first?.line.endsWith('. Check that the "snapshot-file" input names a writable path'),
230
+
).toBe(true);
202
231
});
203
232
});
204
233
@@ -265,7 +294,7 @@ describe("runSnapshot, dir form", () => {
0 commit comments