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:
3 files changed
+61
-42
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user