diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index d1cd995..8d86c00 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -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 unzip -q sonar-scanner.zip ./sonar-scanner-5.0.1.3006-linux/bin/sonar-scanner \ - -Dsonar.projectKey=website-test \ + -Dsonar.projectKey=website-secure \ -Dsonar.sources=. \ -Dsonar.host.url=https://sonar.each-cs.com \ -Dsonar.token=${{ secrets.SONAR_TOKEN }} \ @@ -47,13 +47,13 @@ jobs: - name: Provision Ephemeral Sandbox run: | # 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. - 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 - 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 sleep 5 @@ -77,10 +77,10 @@ jobs: # Execute ZAP scan mounting the managed volume. # The '-I' flag ensures the pipeline doesn't fail on warnings. 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 \ -t ghcr.io/zaproxy/zaproxy:stable zap-baseline.py \ - -t http://website-test-sandbox \ + -t http://website-secure-sandbox \ -r report.html \ -I || true @@ -95,7 +95,7 @@ jobs: - name: Teardown Ephemeral Sandbox if: always() run: | - docker rm -f website-test-sandbox || true + docker rm -f website-secure-sandbox || true # ========================================== # STAGE 4: PRODUCTION DEPLOYMENT @@ -104,18 +104,18 @@ jobs: - name: Hardened Production Deployment run: | # 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 - docker exec website-test-backend sh -c "rm -rf /usr/share/nginx/html/*" - docker cp index.html website-test-backend:/usr/share/nginx/html/index.html + docker exec website-secure-backend sh -c "rm -rf /usr/share/nginx/html/*" + docker cp index.html website-secure-backend:/usr/share/nginx/html/index.html # Apply strict file system permissions (Hardening) - docker exec website-test-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 chown root:root /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 - 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 @@ -126,8 +126,8 @@ jobs: run: | # 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 - docker cp qatests/report.html website-test-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 cp qatests/report.html website-secure-backend:/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) if: always()