fix(devsecops): firmar y verificar imagenes por digest, no por tag
Build and Push Medusa / Escaneo de Secretos (Gitleaks) (push) Successful in 58s
Build and Push Frontend / Escaneo de Secretos (Gitleaks) (push) Successful in 32s
Build and Push Docs Portal / Escaneo de Secretos (Gitleaks) (push) Successful in 35s
Build and Push Medusa / Construir y publicar Medusa (push) Successful in 18m58s
Build and Push Frontend / Construir y Subir Imagen (push) Successful in 12m0s
Build and Push Docs Portal / Construir y publicar Docs Portal (push) Successful in 5m43s
Build and Push Medusa / Escaneo de Secretos (Gitleaks) (push) Successful in 58s
Build and Push Frontend / Escaneo de Secretos (Gitleaks) (push) Successful in 32s
Build and Push Docs Portal / Escaneo de Secretos (Gitleaks) (push) Successful in 35s
Build and Push Medusa / Construir y publicar Medusa (push) Successful in 18m58s
Build and Push Frontend / Construir y Subir Imagen (push) Successful in 12m0s
Build and Push Docs Portal / Construir y publicar Docs Portal (push) Successful in 5m43s
Los 3 pipelines (frontend, commerce-backend, docs-portal) ahora capturan el digest real del docker push y lo usan como referencia para cosign sign/verify, en vez del tag mutable :VERSION. Documenta ademas la decision de mantener Rekor deshabilitado (registry privado, evita dependencia de red saliente hacia rekor.sigstore.dev via el tunel). Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_011FqYP3Wf1W63Qmh7qgXAAT
This commit is contained in:
@@ -287,12 +287,21 @@ jobs:
|
||||
# Login ya se hizo arriba; recién acá se sube, después de que la
|
||||
# imagen pasó el gate de CRITICAL.
|
||||
- name: Subir Imagen al Registry
|
||||
id: push
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
docker push "${IMAGE_NAME}:${{ steps.vars.outputs.VERSION }}"
|
||||
PUSH_OUTPUT="$(docker push "${IMAGE_NAME}:${{ steps.vars.outputs.VERSION }}")"
|
||||
echo "${PUSH_OUTPUT}"
|
||||
docker push "${IMAGE_NAME}:latest"
|
||||
|
||||
DIGEST="$(echo "${PUSH_OUTPUT}" | grep -oE 'sha256:[a-f0-9]{64}' | tail -1)"
|
||||
test -n "${DIGEST}" || {
|
||||
echo "ERROR: no se pudo extraer el digest del push."
|
||||
exit 1
|
||||
}
|
||||
echo "digest=${DIGEST}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Instalar Cosign
|
||||
shell: bash
|
||||
run: |
|
||||
@@ -310,7 +319,8 @@ jobs:
|
||||
# todo el registry de este lab. La llave pública se commitea en
|
||||
# cada directorio de app (workloads/commerce-backend/cosign.pub)
|
||||
# para que la verificación quede local a cada workflow, igual que
|
||||
# el frontend.
|
||||
# el frontend. Firma por digest (no por tag), mismo criterio que
|
||||
# build.yaml.
|
||||
- name: Firmar Imagen (Cosign)
|
||||
shell: bash
|
||||
env:
|
||||
@@ -323,7 +333,7 @@ jobs:
|
||||
--use-signing-config=false \
|
||||
--tlog-upload=false \
|
||||
--yes \
|
||||
"${IMAGE_NAME}:${{ steps.vars.outputs.VERSION }}"
|
||||
"${IMAGE_NAME}@${{ steps.push.outputs.digest }}"
|
||||
|
||||
- name: Verificar Firma (smoke test)
|
||||
shell: bash
|
||||
@@ -332,7 +342,7 @@ jobs:
|
||||
/tmp/cosign verify \
|
||||
--key "${APP_DIR}/cosign.pub" \
|
||||
--insecure-ignore-tlog=true \
|
||||
"${IMAGE_NAME}:${{ steps.vars.outputs.VERSION }}"
|
||||
"${IMAGE_NAME}@${{ steps.push.outputs.digest }}"
|
||||
|
||||
- name: Verificar promoción segura
|
||||
id: promotion
|
||||
|
||||
Reference in New Issue
Block a user