fix: exec命令正则放宽—允许全部ASCII可打印字符(引号/管道等)
This commit is contained in:
@@ -55,7 +55,7 @@ export async function file_move(args: { from: string; to: string }): Promise<any
|
|||||||
// ── C-008: exec ─────────────────────────────────────────────
|
// ── C-008: exec ─────────────────────────────────────────────
|
||||||
function sanitizeCommand(cmd: string): string {
|
function sanitizeCommand(cmd: string): string {
|
||||||
// Allow: alphanumeric, dash, slash, dot, colon, underscore, space, equals, comma
|
// Allow: alphanumeric, dash, slash, dot, colon, underscore, space, equals, comma
|
||||||
if (/[^a-zA-Z0-9_./\-: =,]/.test(cmd)) throw new Error(`Dangerous chars: ${cmd.slice(0,50)}`);
|
if (/[^\x20-\x7E]/.test(cmd)) throw new Error(`Unsafe chars: ${cmd.slice(0,50)}`);
|
||||||
return cmd;
|
return cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user