Enhances security checks and mocks fs module in tests

Updates security check patterns to include brackets for improved command injection prevention. Enhances test reliability by mocking Node's fs module to replace custom mock functions, aligning test behavior closer to actual usage scenarios and ensuring consistent outcomes.

No specific issue reference.
This commit is contained in:
AlexKucera committed 2025-11-09 15:26:33 +01:00
1 parent d39ddd189e
commit b0f8755a56
3 files changed
+61 -42

No files matched your search

+1 -1
View File
@@ -221,7 +221,7 @@ export class SecurityUtils {
// Check for command injection attempts
const dangerousPatterns = [
/[;&|`$<>]/, // Shell metacharacters that can't appear in safe paths
/[;&|`$<>{}[\]]/, // Shell metacharacters that can't appear in safe paths
// eslint-disable-next-line no-control-regex -- Intentionally checking for null byte character for security validation
/\x00/, // Null bytes
/\n|\r/, // Newlines