Input Sanitizer
Add input sanitization to prevent injection attacks
2 security findings detected
HIGH Tool Misuse · Tool Parameter Abuse 90% confidence
Match: rm -rf /
Line 20
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
5. For URL parameters and form fields, validate against whitelist patterns using `validator.js` before processing
6. For command execution, pass arguments as array elements to functions like `child_process.execFile()` instead of shell string interpolation
7. Implement a centralized sanitization middleware in your application framework that runs on all incoming requests
8. Test your sanitization by attempting common payloads: `<script>alert('xss')</script>`, `'; DROP TABLE users; --`, `$(rm -rf /)` and verify they are neutralized
## Code
```javascript
Validate all tool parameters against an allowlist. Reject dangerous parameter values (shell=True, --force, -rf /) and use safe defaults.
HIGH Tool Misuse · Tool Parameter Abuse 85% confidence
Match: rm -rf /
Line 20
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
5. For URL parameters and form fields, validate against whitelist patterns using `validator.js` before processing
6. For command execution, pass arguments as array elements to functions like `child_process.execFile()` instead of shell string interpolation
7. Implement a centralized sanitization middleware in your application framework that runs on all incoming requests
8. Test your sanitization by attempting common payloads: `<script>alert('xss')</script>`, `'; DROP TABLE users; --`, `$(rm -rf /)` and verify they are neutralized
## Code
```javascript
Validate all tool parameters against an allowlist. Reject dangerous parameter values (shell=True, --force, -rf /) and use safe defaults.