Repository navigation
DevSecOps and Workflows
DRomothewriter edited this page Nov 26, 2026
·
1 revision
Pipeline automatizado de integración continua, seguridad en profundidad (SAST, SCA, Container, DAST), supply chain (SBOM + Cosign) y despliegue sin llaves estáticas en AWS.
flowchart LR
FEAT["PR (feature/*, fix/*, chore/*)"] --> CIDEV["ci-dev.yml (Build, TruffleHog, npm audit, Snyk SCA)"]
CIDEV --> DEV["Branch dev (protect-dev)"]
DEV -->|"PR dev -> main"| SECMAIN["security-main.yml (Jest, SonarCloud, CodeQL, Snyk, Hadolint, Syft/Grype, OWASP ZAP)"]
SECMAIN --> MAIN["Branch main (protect-main)"]
MAIN -->|"GitHub Release vX.Y.Z"| REL["release.yml (ECR Push, SBOM, Grype, Cosign Keyless, SLSA)"]
REL -->|"Manual Approval (environment: production)"| DEPLOY["AWS OIDC + SSM RunCommand -> EC2 Docker Compose"]
| Workflow | Disparador | Gates y Herramientas | ¿Bloquea merge/deploy? |
|---|---|---|---|
ci-dev.yml |
pull_request → dev
|
Bloquea main → dev, npm ci --ignore-scripts && npm run build, TruffleHog (--only-verified), Dependency Review (high), npm audit --omit=dev --audit-level=high, Snyk SCA (high, SARIF) |
Sí — los 3 checks son requeridos por protect-dev
|
security-main.yml |
pull_request → main, push → main, workflow_dispatch
|
Exige head_ref == dev, Jest (npm run test:ci + lcov), SonarCloud (qualitygate.wait=true), CodeQL (security-extended), Snyk Code & Container (high), Hadolint (error), Syft SBOM + Grype (high, only-fixed), OWASP ZAP API Scan (/swagger.json + .zap/rules.tsv) |
Sí — los 7 checks + CodeQL (high_or_higher) + 1 review + Code Owners son requeridos por protect-main
|
release.yml |
release: [published], workflow_dispatch
|
Valida SemVer vX.Y.Z + ancestro de origin/main, push a ECR, Syft SBOM por @sha256, Grype, firma y verificación Cosign Keyless (OIDC), SLSA Build Provenance + SBOM Attestation, deploy a EC2 vía AWS SSM
|
Sí — aborta antes de firmar/desplegar si falla Grype o verificación de firma; requiere aprobación manual en production
|
Note
CodeRabbit (.coderabbit.yaml): Revisa automáticamente PRs hacia dev y main en español (profile: assertive, request_changes_workflow: true) con reglas específicas para NoSQL injection, IDOR, Dockerfile y workflows.
Los rulesets viven en .github/rulesets/ y se aplican de forma idempotente con scripts/apply-github-policies.sh:
-
protect-dev: Bloquea borrado y force-push; exige PR, resolución de threads y los 3 checks deci-dev.yml. -
protect-main: Bloquea borrado y force-push; exige PR desdedev, 1 aprobación, Code Owner (@DRomothewriter,@CodeNoctis,@Adrian-Galindo147), threads resueltos, los 7 checks desecurity-main.ymly alerta CodeQLhigh_or_higher. -
protect-release-tags: Protegerefs/tags/v*contra borrado y reescritura. -
Dependabot (
.github/dependabot.yml): Abre PRs semanales (lunes08:00 America/Mexico_City) haciadevparanpm(agrupado),dockerygithub-actions.
| Tipo | Nombre | Uso |
|---|---|---|
| Secret | AWS_ROLE_ARN |
Rol IAM asumido vía OIDC en release.yml (sin access keys estáticas) |
| Secret | EC2_INSTANCE_ID |
Instancia destino para aws ssm send-command
|
| Secret | SONAR_TOKEN |
Autenticación en SonarCloud (security-main.yml) |
| Secret | SNYK_TOKEN |
Escaneo Snyk SCA, Code y Container (también opcional en Dependabot secrets) |
| Variable | AWS_REGION |
Región AWS (default us-east-2) |
| Variable | ECR_REPOSITORY |
Repositorio ECR (default orbit-backend) |
| Variable | SONAR_ORGANIZATION |
Organización SonarCloud (default dromothewriter) |
| Variable | SONAR_PROJECT_KEY |
Proyecto SonarCloud (default DRomothewriter_Orbit-Backend) |
- Al publicar un GitHub Release (
vX.Y.Z) sobre un commit enmain,build-sign-attestconstruye la imagen multi-stage (node:22.23.5-alpine3.24,USER node), la sube a ECR (:<tag>,:<sha>,:latest), genera SBOMs, pasa Grype y la firma con Cosign Keyless. - El job
deploy-productionespera aprobación manual en el entornoproduction. - Tras aprobarse, re-verifica la firma Cosign del digest exacto y ejecuta
aws ssm send-command(AWS-RunShellScript) en EC2: login en ECR,docker compose -f docker-compose.prod.yml pull backend,up -d --remove-orphans backendydocker image prune -f.
Inicio
Diseño y Contratos
DevSecOps y Operación
Ecosistema Orbit