fix(filesystem): bound and verify admitted file and JSON reads

This commit is contained in:
morluto
2026-10-11 00:28:24 +08:00
parent 6d8f95e38d
commit abb8e81d3a
8 changed files with 268 additions and 59 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
import { resolve } from "node:path";
import { readCliJsonFile } from "./cliJsonFile.js";
import { readJsonInputFile } from "./application/JsonInputFile.js";
import { NonRegularFileReadError } from "./filesystem/RegularFile.js";
import {
AnalysisAccessDeniedError,
@@ -21,7 +21,7 @@ export const parseCliJsonInput = async (
const inline = safeParseJson(value);
if (inline.ok) return { ok: true, value: inline.value };
try {
const parsed = await readCliJsonFile(value, operation);
const parsed = await readJsonInputFile(value, operation);
return parsed.ok
? { ok: true, value: parsed.value }
: {