Update .gitea/workflows/deploy.yml
DevSecOps Pipeline / security-gate-and-deploy (push) Failing after 1m14s
DevSecOps Pipeline / security-gate-and-deploy (push) Failing after 1m14s
This commit is contained in:
+13
-18
@@ -16,20 +16,21 @@ jobs:
|
|||||||
run: docker build -f backend/Dockerfile -t apex-solutions:latest .
|
run: docker build -f backend/Dockerfile -t apex-solutions:latest .
|
||||||
|
|
||||||
# ==========================================
|
# ==========================================
|
||||||
# BLOCO AGRUPADO: SAST, SCA e SECRET SCANNING
|
# ETAPAS ESTÁTICAS DE SEGURANÇA SEPARADAS
|
||||||
# ==========================================
|
# ==========================================
|
||||||
- name: 2. Static Security Scans (SAST, SCA, Secrets)
|
|
||||||
|
- name: 2. Secret Scanning (Gitleaks)
|
||||||
run: |
|
run: |
|
||||||
echo ">>> 2.1 Iniciando Gitleaks (Secret Scanning)..."
|
|
||||||
curl -sL https://github.com/gitleaks/gitleaks/releases/download/v8.18.2/gitleaks_8.18.2_linux_x64.tar.gz | tar -xz -C /tmp
|
curl -sL https://github.com/gitleaks/gitleaks/releases/download/v8.18.2/gitleaks_8.18.2_linux_x64.tar.gz | tar -xz -C /tmp
|
||||||
# Removido o log-opts="-1" para forçar um Full Scan. O || true impede que a pipeline pare aqui.
|
|
||||||
/tmp/gitleaks detect --source . --verbose --redact --exit-code 1 || echo "[ALERTA] Credenciais detetadas! Ignorado temporariamente."
|
/tmp/gitleaks detect --source . --verbose --redact --exit-code 1 || echo "[ALERTA] Credenciais detetadas! Ignorado temporariamente."
|
||||||
|
|
||||||
echo ">>> 2.2 Iniciando Trivy (SCA)..."
|
- name: 3. Software Composition Analysis (Trivy)
|
||||||
|
run: |
|
||||||
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin
|
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin
|
||||||
trivy image --severity HIGH,CRITICAL apex-solutions:latest || echo "[ALERTA] Vulnerabilidades na imagem!"
|
trivy image --severity HIGH,CRITICAL apex-solutions:latest || echo "[ALERTA] Vulnerabilidades de infraestrutura encontradas!"
|
||||||
|
|
||||||
echo ">>> 2.3 Iniciando SonarQube (SAST)..."
|
- name: 4. Static Application Security Testing (SonarQube)
|
||||||
|
run: |
|
||||||
curl -sL https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-5.0.1.3006-linux.zip -o sonar-scanner.zip
|
curl -sL https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-5.0.1.3006-linux.zip -o sonar-scanner.zip
|
||||||
unzip -q sonar-scanner.zip
|
unzip -q sonar-scanner.zip
|
||||||
./sonar-scanner-5.0.1.3006-linux/bin/sonar-scanner \
|
./sonar-scanner-5.0.1.3006-linux/bin/sonar-scanner \
|
||||||
@@ -40,9 +41,10 @@ jobs:
|
|||||||
-Dsonar.qualitygate.wait=true || echo "[ALERTA] SonarQube falhou no Quality Gate."
|
-Dsonar.qualitygate.wait=true || echo "[ALERTA] SonarQube falhou no Quality Gate."
|
||||||
|
|
||||||
# ==========================================
|
# ==========================================
|
||||||
# BLOCO AGRUPADO: DAST (ZAP + SANDBOX)
|
# ETAPAS DINÂMICAS E DEPLOY
|
||||||
# ==========================================
|
# ==========================================
|
||||||
- name: 3. Dynamic Security Scan (OWASP ZAP)
|
|
||||||
|
- name: 5. Dynamic Security Scan (OWASP ZAP)
|
||||||
run: |
|
run: |
|
||||||
echo ">>> Lançando Sandbox Efêmero..."
|
echo ">>> Lançando Sandbox Efêmero..."
|
||||||
docker rm -f apex-sandbox || true
|
docker rm -f apex-sandbox || true
|
||||||
@@ -55,7 +57,6 @@ jobs:
|
|||||||
docker volume rm zap-reports || true
|
docker volume rm zap-reports || true
|
||||||
docker volume create zap-reports
|
docker volume create zap-reports
|
||||||
|
|
||||||
# A flag -I faz o ZAP ignorar os avisos (warnings) e apenas reportar no HTML
|
|
||||||
docker run --user root --name zap-scanner \
|
docker run --user root --name zap-scanner \
|
||||||
--link apex-sandbox:apex-sandbox \
|
--link apex-sandbox:apex-sandbox \
|
||||||
-v zap-reports:/zap/wrk/:rw \
|
-v zap-reports:/zap/wrk/:rw \
|
||||||
@@ -71,10 +72,7 @@ jobs:
|
|||||||
docker volume rm zap-reports || true
|
docker volume rm zap-reports || true
|
||||||
docker rm -f apex-sandbox || true
|
docker rm -f apex-sandbox || true
|
||||||
|
|
||||||
# ==========================================
|
- name: 6. Production Deployment & Local Reports
|
||||||
# BLOCO AGRUPADO: DEPLOY DE PRODUÇÃO
|
|
||||||
# ==========================================
|
|
||||||
- name: 4. Production Deployment & Local Reports
|
|
||||||
run: |
|
run: |
|
||||||
echo ">>> Atualizando Produção..."
|
echo ">>> Atualizando Produção..."
|
||||||
docker rm -f portal-corporativo || true
|
docker rm -f portal-corporativo || true
|
||||||
@@ -85,10 +83,7 @@ jobs:
|
|||||||
echo ">>> Publicando Relatório ZAP no servidor Web..."
|
echo ">>> Publicando Relatório ZAP no servidor Web..."
|
||||||
docker cp qatests/report.html portal-corporativo:/usr/src/app/frontend/zap-report.html || true
|
docker cp qatests/report.html portal-corporativo:/usr/src/app/frontend/zap-report.html || true
|
||||||
|
|
||||||
# ==========================================
|
- name: 7. Archive ZAP Report (Gitea Artifacts)
|
||||||
# ARQUIVO DE RELATÓRIOS
|
|
||||||
# ==========================================
|
|
||||||
- name: 5. Archive ZAP Report (Gitea Artifacts)
|
|
||||||
if: always()
|
if: always()
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
|
|||||||
Reference in New Issue
Block a user