Create security_service.py
Browse files
ai-bot/services/security_service.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from utils.security_scanner import scan_input
|
| 2 |
+
|
| 3 |
+
def check_security(input_text: str):
|
| 4 |
+
threats = scan_input(input_text)
|
| 5 |
+
|
| 6 |
+
if threats:
|
| 7 |
+
return {
|
| 8 |
+
"blocked": True,
|
| 9 |
+
"reason": f"Dangerous patterns detected: {threats}"
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
return {"blocked": False}
|