Files
shell-safe-validator/tests/test_validators/test_security.py
2026-01-29 21:28:07 +00:00

15 lines
453 B
Python

import pytest
from src.validators import SecurityValidator
class TestSecurityValidator:
def setup_method(self):
self.validator = SecurityValidator()
def test_detect_unquoted_variable(self):
findings = self.validator.check("cp $SRC_DIR $DEST_DIR")
assert len(findings) >= 1
def test_safe_quoted_variables(self):
findings = self.validator.check('cp "$SRC_DIR" "$DEST_DIR"')
assert len(findings) == 0