ci(ai): robust scanners (continue-on-error + no-pipe capture); gate decides hard
Some checks failed
Security / scan (push) Failing after 1m17s
Some checks failed
Security / scan (push) Failing after 1m17s
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
# Feature B (+C) — Security-Scan (HART blockierend) + KI-Klartext-Erklärung.
|
||||
# Pilot: läuft auf Push zum Branch ci-ai/pilot (Validierung) und auf PRs.
|
||||
# python:3.12-slim (Debian: hat bash) + Memory-Cap (Pi-Runner). ⚠ ARM64-Binaries!
|
||||
# Scanner-Schritte fangen ihren Exit-Code ab (kein Abbruch); der Gate-Schritt
|
||||
# entscheidet hart. Clones brauchen ein Token (Instanz verweigert anon).
|
||||
# python:3.12-slim (Debian: bash) + Memory-Cap (Pi-Runner). ⚠ ARM64-Binaries!
|
||||
# Scanner-Schritte: continue-on-error + Exit-Code ohne Pipe abgefangen -> der
|
||||
# Gate-Schritt entscheidet ALLEIN hart. Clones brauchen ein Token (anon verboten).
|
||||
name: Security
|
||||
|
||||
on:
|
||||
@@ -31,23 +31,27 @@ jobs:
|
||||
|
||||
- name: Gitleaks (Secret-Scan, ARM64)
|
||||
id: gl
|
||||
continue-on-error: true
|
||||
run: |
|
||||
set +e +o pipefail
|
||||
set +e
|
||||
curl -sSL "https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION}_linux_arm64.tar.gz" \
|
||||
| tar -xz -C /usr/local/bin gitleaks
|
||||
cd src && gitleaks detect --no-git --source . --redact | tee /tmp/scan.log
|
||||
echo "code=${PIPESTATUS[0]}" >> "$GITHUB_OUTPUT"
|
||||
exit 0
|
||||
cd src
|
||||
gitleaks detect --no-git --source . --redact > /tmp/gl.log 2>&1
|
||||
echo "code=$?" >> "$GITHUB_OUTPUT"
|
||||
tail -n 3 /tmp/gl.log; cat /tmp/gl.log >> /tmp/scan.log
|
||||
|
||||
- name: Trivy (IaC/config, leicht)
|
||||
id: tv
|
||||
continue-on-error: true
|
||||
run: |
|
||||
set +e +o pipefail
|
||||
set +e
|
||||
curl -sSL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh \
|
||||
| sh -s -- -b /usr/local/bin
|
||||
cd src && trivy config --severity HIGH,CRITICAL --exit-code 1 . | tee -a /tmp/scan.log
|
||||
echo "code=${PIPESTATUS[0]}" >> "$GITHUB_OUTPUT"
|
||||
exit 0
|
||||
cd src
|
||||
trivy config --severity HIGH,CRITICAL --exit-code 1 . > /tmp/tv.log 2>&1
|
||||
echo "code=$?" >> "$GITHUB_OUTPUT"
|
||||
tail -n 8 /tmp/tv.log; cat /tmp/tv.log >> /tmp/scan.log
|
||||
|
||||
- name: Gate — hart blockieren bei Funden
|
||||
run: |
|
||||
@@ -57,8 +61,9 @@ jobs:
|
||||
fi
|
||||
echo "Keine HIGH/CRITICAL-Funde."
|
||||
|
||||
- name: KI erklärt die Funde (nur bei Fehler, überspringt ohne Key)
|
||||
- name: KI erklärt die Funde (nur bei Fehler; braucht ci-ai-Zugriff + Key)
|
||||
if: failure()
|
||||
continue-on-error: true
|
||||
env:
|
||||
AI_PROVIDER: anthropic
|
||||
AI_MODEL: claude-3-5-haiku-latest
|
||||
@@ -66,5 +71,6 @@ jobs:
|
||||
GITEA_TOKEN: ${{ github.token }}
|
||||
GITEA_API: https://git.eulernest.eu/api/v1
|
||||
run: |
|
||||
git clone --depth 1 "https://x-access-token:${GITEA_TOKEN}@git.eulernest.eu/user2595/ci-ai.git" /opt/ci-ai
|
||||
python3 /opt/ci-ai/scripts/ai_explain.py security /tmp/scan.log
|
||||
git clone --depth 1 "https://x-access-token:${GITEA_TOKEN}@git.eulernest.eu/user2595/ci-ai.git" /opt/ci-ai \
|
||||
&& python3 /opt/ci-ai/scripts/ai_explain.py security /tmp/scan.log \
|
||||
|| echo "AI-Erklärung übersprungen (ci-ai-Zugriff/Key noch offen)."
|
||||
|
||||
Reference in New Issue
Block a user