Files
Kill_LIFE/test/test_openclaw_sanitizer.py
T
Clément SAILLANT edc35a62b1 feat: Add onboarding scripts and documentation for OpenClaw
- Created install_packages.sh to automate package installation in Ubuntu VM.
- Developed onboarding_simulation.sh for executing onboarding scripts and displaying guides.
- Added openclaw_check.sh to run OpenClaw doctor and help commands.
- Implemented scan_secrets.sh for scanning sensitive patterns in the VM.
- Introduced onboarding README.md and examples.md for contributor guidance.
- Created guide_contributeur.md and guide_vm_sandbox.md for detailed onboarding instructions.
- Added supports_visuels.md with diagrams and video tutorials for better understanding.
- Developed test_openclaw_actions.py for automated testing of OpenClaw actions.
- Created vm_test_report.md template for documenting VM test results.
- Added setup_python_secure.sh for secure Python environment setup.
- Implemented test_openclaw_sanitizer.py for testing sanitization functionality.
2026-02-19 13:16:22 +01:00

32 lines
937 B
Python

#!/usr/bin/env python3
"""
Test automatisé pour la sanitisation des commentaires OpenClaw.
Vérifie que le sanitizer retire les patterns à risque et ne laisse aucun secret, code ou mention.
"""
import sys
sys.path.insert(0, "../../tools/ai")
from sanitize_issue import sanitize_text
def test_sanitize_basic():
input_text = """
Hello @user, see #123.
```rm -rf /home/user```
Contact: user@example.com
Visit https://evil.com
!dangerous command
<secret>password</secret>
"""
sanitized = sanitize_text(input_text)
assert "@user" not in sanitized
assert "#123" not in sanitized
assert "rm -rf" not in sanitized
assert "user@example.com" not in sanitized
assert "https://evil.com" not in sanitized
assert "!dangerous" not in sanitized
assert "password" not in sanitized
assert "secret" not in sanitized
print("Sanitization test passed.")
if __name__ == "__main__":
test_sanitize_basic()