v1.31.0
conocimientosecurity-audittools/

sast-integration.md

Referencia que security-audit carga bajo demanda desde su SKILL.md.

security-auditskill
toolscarpeta
6045 Btamaño
2026-09-21último cambio del pack

Skill: security-audit

Configuracion e integracion de herramientas de analisis estatico de seguridad (SAST) en el ciclo de desarrollo.

Ver tambien: patterns/secure-coding-checklist.md, reports/report-format.md


.NET - Analizadores Integrados

<!-- En .csproj - Habilitar analizadores de seguridad -->
<PropertyGroup>
    <EnableNETAnalyzers>true</EnableNETAnalyzers>
    <AnalysisLevel>latest-all</AnalysisLevel>
</PropertyGroup>

<!-- SecurityCodeScan - Analizador SAST para .NET -->
<ItemGroup>
    <PackageReference Include="SecurityCodeScan.VS2019" Version="5.*">
        <PrivateAssets>all</PrivateAssets>
        <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
    </PackageReference>
</ItemGroup>
# Escaneo de vulnerabilidades en dependencias .NET
dotnet list package --vulnerable --include-transitive

Semgrep (Multi-lenguaje)

# Escaneo de seguridad general
semgrep --config p/default

# Escaneos especificos por lenguaje
semgrep scan --config p/python
semgrep scan --config p/javascript
semgrep scan --config p/golang
semgrep scan --config p/ruby
semgrep scan --config p/java
semgrep scan --config p/csharp

# Reglas OWASP
semgrep --config p/owasp-top-ten

# Multiples configuraciones
semgrep scan --config reglas.yaml --config mas_reglas.yaml

Regla Semgrep Personalizada (Inyeccion SQL)

rules:
  - id: deteccion-inyeccion-sql
    languages: [java]
    severity: ERROR
    mode: taint
    message: Potencial inyeccion SQL - entrada del usuario fluye hacia consulta SQL
    options:
      taint_assume_safe_booleans: true
      taint_assume_safe_numbers: true
      interfile: true
    pattern-sources:
      - patterns:
          - pattern: |
              $X(..., $SRC, ...) { ... }
          - focus-metavariable: $SRC
    pattern-sinks:
      - pattern: Statement.executeQuery(...)
      - pattern: Statement.execute(...)
    pattern-sanitizers:
      - pattern: PreparedStatement.setString(...)

Otras Herramientas SAST

# Python - Bandit
bandit -r /ruta/al/codigo

# JavaScript - ESLint con plugin de seguridad
eslint --config .eslintrc.security.js src/

# Go - GoSec
gosec ./...

# Dependencias multi-lenguaje
npm audit                    # Node.js
pip-audit                    # Python
safety check                 # Python
snyk test                    # Multi-lenguaje
trivy fs .                   # Escaneo de sistema de archivos

# Infraestructura como Code
checkov --directory .        # Terraform, CloudFormation, K8s
tfsec .                      # Especifico de Terraform

Integracion en CI/CD

GitHub Actions

Con cicd.platform = github-actions, /hv:cicd-init ya genera el gate G8 (composite security-scan + security-gate) y el job Security de ci.yml (dotnet list package --vulnerable, falla con Critical/High). El workflow opcional security.yml (skills/cicd-architect/templates/github/security.yml.template) añade CodeQL y dependency review. Todas las acciones van pinneadas por SHA con la versión en comentario (G16); nunca @v4 ni @master.

# .github/workflows/security.yml (extracto; el template completo lleva permisos minimos, concurrency y matriz)
permissions:
  contents: read
jobs:
  codeql:
    permissions: { contents: read, actions: read, security-events: write, packages: read }
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
      - uses: github/codeql-action/init@486fec2a3ea2626afcd8c7e9208b4f515078dd7e # codeql-bundle-v2.26.4
        with: { languages: csharp, build-mode: none, queries: security-extended }
      - uses: github/codeql-action/analyze@486fec2a3ea2626afcd8c7e9208b4f515078dd7e # codeql-bundle-v2.26.4
  dependency-review:
    if: github.event_name == 'pull_request'
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
      - uses: actions/dependency-review-action@a1d282b36b6f3519aa1f3fc636f609c47dddb294 # v5.0.0
        with: { fail-on-severity: high }

Semgrep u otros SAST de terceros se añaden como steps propios, también pinneados por SHA; sus hallazgos se pueden subir a Code scanning como SARIF (github/codeql-action/upload-sarif) si el repo tiene la función.

Funciones nativas de GitHub (opt-in, con degradación)

FunciónCosteActivarSin licencia
Dependabot alerts / security updatesgratisgh api -X PUT repos/{o}/{r}/vulnerability-alerts · .../automated-security-fixes—
Dependency review en PRsgratis (Dependency graph)job dependency-review—
Secret scanning + push protectiongratis en públicos; GHAS en privadosPATCH repos/{o}/{r} con security_and_analysis.secret_scanning{,_push_protection}.status=enabledhook secret-scanner de Ovillo + G5
Code scanning (CodeQL)gratis en públicos; GHAS (Code Security) en privadossecurity.yml o PATCH repos/{o}/{r}/code-scanning/default-setup -f state=configuredgate G8 (security-scan.ps1)

/hv:cicd-init FASE 2.5-gh intenta activarlas y, ante 403/422, lo anota en ops/cicd/SEGURIDAD_PIPELINE.md y sigue.

Azure DevOps

# azure-pipelines.yml
steps:
  - task: DotNetCoreCLI@2
    displayName: 'Vulnerability Scan'
    inputs:
      command: custom
      custom: list
      arguments: 'package --vulnerable --include-transitive'

  - script: semgrep --config p/owasp-top-ten --json -o semgrep-results.json
    displayName: 'Semgrep SAST Scan'

Checklist de Integracion SAST

  • Analizadores .NET habilitados en .csproj (AnalysisLevel: latest-all)
  • SecurityCodeScan instalado como NuGet en proyectos .NET
  • Semgrep configurado con reglas OWASP en pipeline CI
  • dotnet list package --vulnerable ejecutado en cada build
  • Escaneo de dependencias (Trivy/Snyk) en pipeline
  • Resultados de SAST bloquean merge si hay hallazgos criticos/altos

Pattern 1.0.0

← Volver a la ficha de security-audit

Ovillo v1.31.0tag v1.31.0 (2026-10-06) · sin decisiones posteriores69 skills · 19 agents · 22 hooks · 3 reglas · 15 tools · 103 decisionesfuente: ovillo/.claude/skills/security-audit/tools/sast-integration.mdCopyright 2026 Hugo Valer Rojas · Apache-2.0