scan_directory_with_bandit
Scan a directory of Python files with Bandit to uncover security vulnerabilities like SQL injection, hardcoded passwords, and unsafe functions.
Instructions
Scan an entire project directory with Bandit for Python security issues.
This tool scans all Python files in a directory for security issues using Bandit.
Unlike scan_with_bandit which scans code snippets, this tool scans the actual project directory to find issues across all Python files.
Bandit can detect issues like:
Use of insecure functions (pickle, eval, exec)
Hardcoded passwords and secrets
SQL injection vulnerabilities
Command injection risks
Weak cryptographic practices
Insecure random number generation
And many other Python-specific security issues
Args: directory_path: Path to the directory to scan (relative or absolute) severity_threshold: Minimum severity level to report (LOW, MEDIUM, HIGH)
Returns: A dictionary with security findings from Bandit
Note: Bandit must be installed and available in PATH. Install with: - pip: pip install bandit - pipx: pipx install bandit
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| return_output | No | Return full output instead of saving to file (default: False) | |
| directory_path | Yes | Path to the directory to scan | |
| severity_threshold | No | Minimum severity threshold (LOW, MEDIUM, HIGH) | MEDIUM |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |