---
name: "bandit-python-ast-security"
description: "Scan Python codebases for common security weaknesses and injection risks with Bandit."
metadata:
  author: "PyCQA"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "run bandit security scan"
  - "fix bandit vulnerability python"
  - "configure bandit.yaml"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# Bandit Python AST Vulnerability Scanner

Executes Bandit static analysis: inspecting Python Abstract Syntax Trees (AST) for insecure eval(), shell injection, weak cryptography, hardcoded passwords, and untrusted deserialization.

## When to Invoke
Invoke this skill whenever you need to:
- run bandit security scan
- fix bandit vulnerability python
- configure bandit.yaml

## Execution SOP & Rules
1. Execute bandit -r src/ -f json -o bandit_report.json in automated CI pipelines.
2. Replace shell=True in subprocess calls with explicit argument lists.
3. Replace insecure random module calls with secrets for security-sensitive tokens.
4. Document intentional exceptions using # nosec comments with explicit explanatory notes.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
