Modificar .gitea/workflows/deploy.yaml
DevSecOps Enterprise Pipeline / security-gate-and-deploy (push) Failing after 24s
DevSecOps Enterprise Pipeline / security-gate-and-deploy (push) Failing after 24s
change website-test for website-secure
This commit is contained in:
@@ -34,7 +34,7 @@ jobs:
|
|||||||
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 \
|
||||||
-Dsonar.projectKey=website-test \
|
-Dsonar.projectKey=website-secure \
|
||||||
-Dsonar.sources=. \
|
-Dsonar.sources=. \
|
||||||
-Dsonar.host.url=https://sonar.each-cs.com \
|
-Dsonar.host.url=https://sonar.each-cs.com \
|
||||||
-Dsonar.token=${{ secrets.SONAR_TOKEN }} \
|
-Dsonar.token=${{ secrets.SONAR_TOKEN }} \
|
||||||
@@ -47,13 +47,13 @@ jobs:
|
|||||||
- name: Provision Ephemeral Sandbox
|
- name: Provision Ephemeral Sandbox
|
||||||
run: |
|
run: |
|
||||||
# Remove any residual sandbox containers
|
# Remove any residual sandbox containers
|
||||||
docker rm -f website-test-sandbox || true
|
docker rm -f website-secure-sandbox || true
|
||||||
|
|
||||||
# Deploy sandbox. Using Docker internal network prevents external exposure.
|
# Deploy sandbox. Using Docker internal network prevents external exposure.
|
||||||
docker run -d --name website-test-sandbox nginx:alpine
|
docker run -d --name website-secure-sandbox nginx:alpine
|
||||||
|
|
||||||
# Copy the current codebase to the sandbox container
|
# Copy the current codebase to the sandbox container
|
||||||
docker cp index.html website-test-sandbox:/usr/share/nginx/html/index.html
|
docker cp index.html website-secure-sandbox:/usr/share/nginx/html/index.html
|
||||||
|
|
||||||
# Allow Nginx service to initialize
|
# Allow Nginx service to initialize
|
||||||
sleep 5
|
sleep 5
|
||||||
@@ -77,10 +77,10 @@ jobs:
|
|||||||
# Execute ZAP scan mounting the managed volume.
|
# Execute ZAP scan mounting the managed volume.
|
||||||
# The '-I' flag ensures the pipeline doesn't fail on warnings.
|
# The '-I' flag ensures the pipeline doesn't fail on warnings.
|
||||||
docker run --user root --name zap-scanner \
|
docker run --user root --name zap-scanner \
|
||||||
--link website-test-sandbox:website-test-sandbox \
|
--link website-secure-sandbox:website-secure-sandbox \
|
||||||
-v zap-reports:/zap/wrk/:rw \
|
-v zap-reports:/zap/wrk/:rw \
|
||||||
-t ghcr.io/zaproxy/zaproxy:stable zap-baseline.py \
|
-t ghcr.io/zaproxy/zaproxy:stable zap-baseline.py \
|
||||||
-t http://website-test-sandbox \
|
-t http://website-secure-sandbox \
|
||||||
-r report.html \
|
-r report.html \
|
||||||
-I || true
|
-I || true
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ jobs:
|
|||||||
- name: Teardown Ephemeral Sandbox
|
- name: Teardown Ephemeral Sandbox
|
||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: |
|
||||||
docker rm -f website-test-sandbox || true
|
docker rm -f website-secure-sandbox || true
|
||||||
|
|
||||||
# ==========================================
|
# ==========================================
|
||||||
# STAGE 4: PRODUCTION DEPLOYMENT
|
# STAGE 4: PRODUCTION DEPLOYMENT
|
||||||
@@ -104,18 +104,18 @@ jobs:
|
|||||||
- name: Hardened Production Deployment
|
- name: Hardened Production Deployment
|
||||||
run: |
|
run: |
|
||||||
# Create a backup of the current production state
|
# Create a backup of the current production state
|
||||||
docker exec website-test-backend tar -czf /tmp/index_backup.tar.gz -C /usr/share/nginx/html index.html || true
|
docker exec website-secure-backend tar -czf /tmp/index_backup.tar.gz -C /usr/share/nginx/html index.html || true
|
||||||
|
|
||||||
# Clear the production directory and deploy the approved artifact
|
# Clear the production directory and deploy the approved artifact
|
||||||
docker exec website-test-backend sh -c "rm -rf /usr/share/nginx/html/*"
|
docker exec website-secure-backend sh -c "rm -rf /usr/share/nginx/html/*"
|
||||||
docker cp index.html website-test-backend:/usr/share/nginx/html/index.html
|
docker cp index.html website-secure-backend:/usr/share/nginx/html/index.html
|
||||||
|
|
||||||
# Apply strict file system permissions (Hardening)
|
# Apply strict file system permissions (Hardening)
|
||||||
docker exec website-test-backend chown root:root /usr/share/nginx/html/index.html
|
docker exec website-secure-backend chown root:root /usr/share/nginx/html/index.html
|
||||||
docker exec website-test-backend chmod 444 /usr/share/nginx/html/index.html
|
docker exec website-secure-backend chmod 444 /usr/share/nginx/html/index.html
|
||||||
|
|
||||||
# Healthcheck: Verify local response from the production container
|
# Healthcheck: Verify local response from the production container
|
||||||
docker exec website-test-backend curl --silent --show-error --fail http://localhost:80 || exit 1
|
docker exec website-secure-backend curl --silent --show-error --fail http://localhost:80 || exit 1
|
||||||
|
|
||||||
# ==========================================
|
# ==========================================
|
||||||
# STAGE 5: ARTIFACT MANAGEMENT & REPORTING
|
# STAGE 5: ARTIFACT MANAGEMENT & REPORTING
|
||||||
@@ -126,8 +126,8 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
# Host the report directly on the Nginx container to bypass Gitea's artifact download bug
|
# Host the report directly on the Nginx container to bypass Gitea's artifact download bug
|
||||||
# Accessible at: http://51.89.40.2:8080/zap-report.html
|
# Accessible at: http://51.89.40.2:8080/zap-report.html
|
||||||
docker cp qatests/report.html website-test-backend:/usr/share/nginx/html/zap-report.html || true
|
docker cp qatests/report.html website-secure-backend:/usr/share/nginx/html/zap-report.html || true
|
||||||
docker exec website-test-backend chmod 444 /usr/share/nginx/html/zap-report.html || true
|
docker exec website-secure-backend chmod 444 /usr/share/nginx/html/zap-report.html || true
|
||||||
|
|
||||||
- name: Archive ZAP Report (Raw HTML)
|
- name: Archive ZAP Report (Raw HTML)
|
||||||
if: always()
|
if: always()
|
||||||
|
|||||||
Reference in New Issue
Block a user