Commit 814b591
committed
feat: add comprehensive security scanning and hardening tools
Implements 11 new security MCP tools across 4 categories:
## Vulnerability Scanning
- scan_container_vulnerabilities: Scan Docker images with Trivy/Grype
- scan_filesystem_vulnerabilities: Scan filesystems for CVEs (LXC containers)
## Secrets Detection
- scan_secrets_in_file: Detect exposed credentials in config files
- scan_secrets_in_directory: Recursive secrets scanning
- scan_docker_config_secrets: Check Docker registry credentials
Detects 16+ secret patterns:
- Cloud credentials (AWS, GitHub, Slack, Stripe, Twilio, etc.)
- Private keys (RSA, DSA, EC, OpenSSH)
- Database connection strings
- JWT tokens, Docker auth, NPM tokens
## Firewall Management
- get_firewall_status: View firewall state (UFW/iptables)
- list_firewall_rules: List all rules with numbers
- add_firewall_rule: Add allow/deny rules
- delete_firewall_rule: Remove rules by number
Supports UFW (Ubuntu/Debian) and iptables fallback.
## CIS Benchmarks
- run_cis_benchmark: Security posture assessment
Profiles: basic (10+ checks), intermediate (15+ checks), comprehensive (20+ checks)
Check categories:
- Filesystem permissions (passwd, shadow, SSH config)
- SSH security (root login, password auth, empty passwords)
- Network hardening (IP forwarding, ICMP redirects)
- System auditing (auditd)
- User account security (UID 0, password complexity)
- Firewall configuration
Returns security score with remediation steps.
## Infrastructure
- New scopes: security:read, security:scan, security:write, security:admin
- Risk levels: low (scanning), moderate (filesystem), critical (firewall changes)
- Approval gates for firewall modifications
- Comprehensive tests with unit and integration coverage
Files:
- src/services/security_scanner.py (Trivy/Grype integration)
- src/services/secrets_scanner.py (16+ regex patterns)
- src/services/firewall_manager.py (UFW/iptables)
- src/services/cis_checker.py (Linux hardening checks)
- src/tools/security_tools.py (11 MCP tools)
- src/auth/scopes.py (security scopes)
- tests/test_security_tools.py (test coverage)1 parent b9ff08f commit 814b591
File tree
8 files changed
+2274
-1
lines changed- src
- auth
- services
- tools
- tests
8 files changed
+2274
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
41 | 47 | | |
42 | 48 | | |
43 | 49 | | |
| |||
210 | 216 | | |
211 | 217 | | |
212 | 218 | | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
213 | 297 | | |
214 | 298 | | |
215 | 299 | | |
| |||
235 | 319 | | |
236 | 320 | | |
237 | 321 | | |
| 322 | + | |
238 | 323 | | |
239 | 324 | | |
240 | 325 | | |
| |||
0 commit comments