bandit_pip_audit

Análisis de seguridad estático del código Python y escaneo de dependencias en busca de CVEs

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "bandit_pip_audit" with this command: npx skills add davidcastagnetoa/skills/davidcastagnetoa-skills-bandit-pip-audit

bandit_pip_audit

Bandit analiza el código Python en busca de patrones de código inseguro (SQL injection via f-strings, uso de eval, algoritmos criptográficos débiles). pip-audit escanea las dependencias instaladas contra bases de datos de CVEs (PyPI Advisory Database, OSV).

When to use

Ejecutar en pre-commit hooks y en CI. Un CVE crítico en una dependencia o un subprocess(shell=True) deben bloquear el merge.

Instructions

  1. Instalar: pip install bandit pip-audit
  2. Ejecutar bandit: bandit -r backend/ -ll -x backend/tests/
    • -ll = reportar solo severidad MEDIUM y HIGH.
    • -x backend/tests/ = excluir tests (usan assert que bandit marca como warning).
  3. Configurar .bandit en raíz:
    [bandit]
    exclude_dirs = ["tests", "migrations"]
    skips = ["B101"]  # skip assert_used en tests
    
  4. Ejecutar pip-audit: pip-audit -r requirements.txt --format=json --output=audit-report.json
  5. En CI, fallar si hay vulnerabilidades de severidad CRITICAL o HIGH:
    pip-audit -r requirements.txt --severity HIGH --fail-on-severity HIGH
    
  6. Añadir en pre-commit hooks (ver skill pre_commit_hooks).

Notes

  • Bandit detecta patrones como: pickle.loads() (deserialization), hashlib.md5() (weak hash), random.random() (en lugar de secrets.token_hex() para tokens).
  • pip-audit complementa a Trivy (que escanea imágenes) — pip-audit es más rápido en CI porque no requiere build de imagen.
  • Actualizar dependencias vulnerables tan pronto como haya parche disponible — documentar en el ADR si hay motivo para no actualizar.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

traefik

No summary provided by upstream source.

Repository SourceNeeds Review
General

c4_model_structurizr

No summary provided by upstream source.

Repository SourceNeeds Review
General

fastapi

No summary provided by upstream source.

Repository SourceNeeds Review
General

exif_metadata_analyzer

No summary provided by upstream source.

Repository SourceNeeds Review