Ersetzt die private LAN-IP des Jetson durch jetson.local in Doku, Beispiel-Workflows und als Default in scripts/llm.py. Betrifft nur Fallback-Werte -- die Org-Variable JETSON_OLLAMA_URL bzw. AI_BASE_URL hat weiterhin Vorrang. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
64 lines
2.5 KiB
YAML
64 lines
2.5 KiB
YAML
# Feature B (+C) — Security-Scan (HART blockierend) + KI-Klartext-Erklärung.
|
|
# Kopie -> .gitea/workflows/security.yml
|
|
#
|
|
# Schlankes alpine-Image + Memory-Cap (Pi-Runner, capacity 1). ⚠ ARM64-Binaries!
|
|
# Gitleaks (Secrets) + Trivy config (IaC/Misconfig) — bewusst OHNE schweren
|
|
# Vuln-DB-Scan (RAM-/zeitschonend auf dem Pi). Funde lassen den Check hart
|
|
# fehlschlagen; danach erklärt die KI sie im PR (überspringt sauber ohne Key).
|
|
name: Security
|
|
|
|
on:
|
|
workflow_dispatch: {}
|
|
pull_request:
|
|
|
|
env:
|
|
GITLEAKS_VERSION: "8.18.4"
|
|
|
|
jobs:
|
|
scan:
|
|
runs-on: eulernest
|
|
container:
|
|
image: alpine:3.20
|
|
options: "--memory=768m --memory-swap=1024m"
|
|
steps:
|
|
- name: Tooling
|
|
run: apk add --no-cache git curl bash tar python3
|
|
|
|
- name: Repo auschecken (git.eulernest.eu -> LAN via Runner-add-host)
|
|
run: git clone --depth 1 "https://git.eulernest.eu/${GITHUB_REPOSITORY}.git" src
|
|
|
|
- name: Gitleaks (Secret-Scan, ARM64)
|
|
id: gl
|
|
run: |
|
|
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 -v 2>&1 | tee /tmp/scan.log
|
|
echo "code=${PIPESTATUS[0]}" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Trivy (IaC/config, leicht)
|
|
id: tv
|
|
run: |
|
|
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 --no-progress . 2>&1 | tee -a /tmp/scan.log
|
|
echo "code=${PIPESTATUS[0]}" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Gate — hart blockieren bei Funden
|
|
run: |
|
|
if [ "${{ steps.gl.outputs.code }}" != "0" ] || [ "${{ steps.tv.outputs.code }}" != "0" ]; then
|
|
echo "Security-Funde -> Check schlägt fehl (hart blockierend)."; exit 1
|
|
fi
|
|
echo "Keine HIGH/CRITICAL-Funde."
|
|
|
|
- name: KI erklärt die Funde (nur bei Fehler, überspringt ohne Key)
|
|
if: failure()
|
|
env:
|
|
AI_PROVIDER: ollama
|
|
AI_MODEL: coder
|
|
AI_BASE_URL: http://jetson.local:11434/v1
|
|
GITEA_TOKEN: ${{ github.token }}
|
|
GITEA_API: https://git.eulernest.eu/api/v1
|
|
run: |
|
|
git clone --depth 1 https://git.eulernest.eu/user2595/ci-ai.git /opt/ci-ai
|
|
python3 /opt/ci-ai/scripts/ai_explain.py security /tmp/scan.log
|