From 801fbd497c0f49028427567f6d2e4278d3501ab1 Mon Sep 17 00:00:00 2001 From: Djeex Date: Sun, 22 Nov 2026 11:25:08 +0000 Subject: [PATCH] Use the shared remediate action --- .gitea/workflows/ci.yml | 41 ++++------------------------------------- 1 file changed, 4 insertions(+), 37 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 32ac28f..cce257f 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -23,7 +23,7 @@ jobs: uses: actions/checkout@v7 with: repository: labeex/cicdeex - ref: 1.0.0 + ref: 1.1.0 token: ${{ secrets.CICDEEX_TOKEN }} path: .cicdeex persist-credentials: false @@ -57,42 +57,9 @@ jobs: - name: Handle CRITICAL findings if: steps.trivy_critical.outcome == 'failure' - run: | - if [ "${{ github.event_name }}" != "schedule" ]; then - echo "::error::CRITICAL vulnerabilities found, failing the build." - exit 1 - fi - - echo "Scheduled scan found CRITICAL vulnerabilities — attempting an automatic apk upgrade + rescan." - - sed -i '/^FROM .* AS base$/a RUN apk upgrade --no-cache' Dockerfile - docker build -t socat-proxy:remediated . - - if docker run --rm \ - -e DOCKER_HOST=tcp://dockerhost:2375 \ - --add-host=dockerhost:host-gateway \ - aquasec/trivy:0.76.2 image --exit-code 1 --severity CRITICAL socat-proxy:remediated; then - echo "apk upgrade clears the CRITICAL finding(s) — opening a PR for review." - - BRANCH="auto/cve-fix-$(date +%Y%m%d)-$(echo "${{ github.sha }}" | cut -c1-7)" - git config user.name "socat-proxy-ci" - git config user.email "ci@git.djeex.fr" - git checkout -b "$BRANCH" - git add Dockerfile - git commit -m "Auto-remediate CRITICAL CVE via apk upgrade" - git config --unset-all http.https://git.djeex.fr/.extraheader || true - git push "https://Djeex:${{ secrets.CI_PUSH_TOKEN }}@git.djeex.fr/Djeex/socat-proxy.git" "HEAD:$BRANCH" - - PR_JSON=$(curl -s -X POST \ - -H "Authorization: token ${{ secrets.CI_PUSH_TOKEN }}" \ - -H "Content-Type: application/json" \ - -d "$(jq -n --arg head "$BRANCH" '{title: "🔒 Auto: remediate CRITICAL CVE via apk upgrade", head: $head, base: "main", body: "Opened automatically by the scheduled CVE scan. An `apk upgrade --no-cache` cleared the CRITICAL Trivy finding(s) in a rebuild — review the diff and merge to publish the fix."}')" \ - "https://git.djeex.fr/api/v1/repos/Djeex/socat-proxy/pulls") - echo "PR API response: $(echo "$PR_JSON" | jq -r '.html_url // .message // "unknown"')" - else - echo "::error::apk upgrade does not clear the CRITICAL finding(s) — no automatic fix available, needs manual review." - exit 1 - fi + uses: ./.cicdeex/remediate + with: + push-token: ${{ secrets.CI_PUSH_TOKEN }} - name: Scan with Trivy (high - informative) uses: ./.cicdeex/trivy