fix(cli): stricter path validation to only permit safe characters

permitted characters: alphanumeric characters, hyphens, and underscores
This commit is contained in:
Amaan Bilwar 2026-04-09 16:54:02 +05:30
parent 9492422f28
commit 1ab411addd

View file

@ -255,8 +255,8 @@ export async function parseArguments(
return 'The --session-id flag requires a non-empty value';
}
if (trimmedSessionId === '.' || trimmedSessionId === '..') {
return 'Invalid --session-id value. "." and ".." are not allowed.';
if (!/^[a-zA-Z0-9_-]+$/.test(trimmedSessionId)) {
return 'Invalid --session-id value. Only alphanumeric characters, hyphens, and underscores are allowed.';
}
argv['sessionId'] = trimmedSessionId;
}