wip: contenido inicial + test de reusable workflow / composite action
This commit is contained in:
1 parent
e9fe7d0567
commit
262c0f271a
22 files changed
+1480
No files matched your search
@@ -0,0 +1,65 @@
|
||||
name: "Trivy imagen — CVE de la imagen construida"
|
||||
description: >-
|
||||
Escanea la imagen Docker ya construida y cargada localmente (load:
|
||||
true en el build, no hace falta push todavía). CRITICAL bloquea el
|
||||
pipeline; HIGH es informativo. --timeout 15m0s siempre — el default
|
||||
de Trivy (5m) no alcanza bajo carga real del host (visto en vivo en
|
||||
commerce-backend, "context deadline exceeded" a los 4m52s).
|
||||
|
||||
inputs:
|
||||
image_ref:
|
||||
description: "Referencia completa imagen:tag a escanear (ej. \\${{ env.IMAGE_NAME }}:\\${{ steps.vars.outputs.VERSION }})."
|
||||
required: true
|
||||
trivy_version:
|
||||
description: "Versión de Trivy a instalar."
|
||||
required: false
|
||||
default: "0.74.0"
|
||||
ignorefile:
|
||||
description: >-
|
||||
Ruta a un .trivyignore con excepciones documentadas (opcional).
|
||||
Cada excepción debe tener justificación y fecha en el propio
|
||||
archivo — no es un mecanismo para silenciar sin revisar. Ver
|
||||
devsecops-snippets/trivy-image-step/README.md.
|
||||
required: false
|
||||
default: ""
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Instalar Trivy
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
curl -sSfL \
|
||||
"https://github.com/aquasecurity/trivy/releases/download/v${{ inputs.trivy_version }}/trivy_${{ inputs.trivy_version }}_Linux-64bit.tar.gz" \
|
||||
-o /tmp/trivy.tar.gz
|
||||
tar -xzf /tmp/trivy.tar.gz -C /tmp trivy
|
||||
chmod +x /tmp/trivy
|
||||
/tmp/trivy version
|
||||
|
||||
- name: Escanear imagen (Trivy) — CRITICAL bloquea
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
IGNOREFILE_ARGS=()
|
||||
if [ -n "${{ inputs.ignorefile }}" ]; then
|
||||
IGNOREFILE_ARGS=(--ignorefile "${{ inputs.ignorefile }}")
|
||||
fi
|
||||
/tmp/trivy image \
|
||||
--severity CRITICAL \
|
||||
--exit-code 1 \
|
||||
--ignore-unfixed \
|
||||
--timeout 15m0s \
|
||||
"${IGNOREFILE_ARGS[@]}" \
|
||||
"${{ inputs.image_ref }}"
|
||||
|
||||
- name: Escanear imagen (Trivy) — HIGH informativo
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
/tmp/trivy image \
|
||||
--severity HIGH \
|
||||
--exit-code 0 \
|
||||
--ignore-unfixed \
|
||||
--timeout 15m0s \
|
||||
"${{ inputs.image_ref }}"
|
||||
Reference in new issue
Block a user