feat: vendor permission system source

This commit is contained in:
云服务部-叶林立
2026-08-19 14:35:19 +08:00
parent 198584daf8
commit 410c50a3e5
809 changed files with 157793 additions and 139 deletions
@@ -0,0 +1,18 @@
/**
* Paths that are universally safe and should never trigger external-directory checks.
* These are OS device files: read returns EOF or process streams, write discards or goes to process streams.
*/
export const SAFE_SYSTEM_PATHS: ReadonlySet<string> = new Set([
"/dev/null",
"/dev/stdin",
"/dev/stdout",
"/dev/stderr",
]);
/**
* Returns true if the given normalized path is a safe OS device file
* that should never trigger external-directory checks.
*/
export function isSafeSystemPath(normalizedPath: string): boolean {
return SAFE_SYSTEM_PATHS.has(normalizedPath);
}