fix(ci): clear 0pt security/scan baseline #648
@@ -95,7 +95,7 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
|
||||
+19
-11
@@ -33,8 +33,8 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||||
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version: "22"
|
||||
cache: "pnpm"
|
||||
@@ -134,8 +134,8 @@ jobs:
|
||||
--health-timeout 5s
|
||||
--health-retries 60
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||||
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version: "22"
|
||||
cache: "pnpm"
|
||||
@@ -271,10 +271,18 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install Trivy
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||||
- name: Install Trivy (pinned + checksum verified)
|
||||
run: |
|
||||
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin
|
||||
set -euo pipefail
|
||||
TRIVY_VERSION=0.76.2
|
||||
BASE="https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}"
|
||||
curl -fsSLO "${BASE}/trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz"
|
||||
curl -fsSLO "${BASE}/trivy_${TRIVY_VERSION}_checksums.txt"
|
||||
grep " trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz$" "trivy_${TRIVY_VERSION}_checksums.txt" | sha256sum -c -
|
||||
tar -xzf "trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz" -C /usr/local/bin trivy
|
||||
rm -f "trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz" "trivy_${TRIVY_VERSION}_checksums.txt"
|
||||
trivy --version
|
||||
# `siax/sbom/` är CycloneDX-evidenens för REDAN BYGGDA images (release-kedjan),
|
||||
# inte källberoenden. Att scanna dem här återrapporterar gamla image-versioner
|
||||
# (next 16.3.x, sharp 0.35.4) och blockerar källfixar som redan är patchade.
|
||||
@@ -292,7 +300,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: SonarQube analysis (self-hosted sonar.siax.dev)
|
||||
@@ -316,12 +324,12 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||||
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version: '22'
|
||||
- name: Checkout canonical siax-standard (SSOT)
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||||
with:
|
||||
repository: admin/siax-standard
|
||||
token: ${{ secrets.SIAX_CI_TOKEN }}
|
||||
|
||||
@@ -12,12 +12,21 @@ jobs:
|
||||
health:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||||
- name: Required files
|
||||
run: |
|
||||
for f in README.md LICENSE .gitignore; do [ -f "$f" ] || echo "::warning file=$f,title=Missing::$f is missing"; done
|
||||
[ -f .gitea/workflows/ci.yml ] || echo "::warning title=No CI::No CI workflow found"
|
||||
- name: Install Trivy
|
||||
run: curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin
|
||||
- name: Install Trivy (pinned + checksum verified)
|
||||
run: |
|
||||
set -euo pipefail
|
||||
TRIVY_VERSION=0.76.2
|
||||
BASE="https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}"
|
||||
curl -fsSLO "${BASE}/trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz"
|
||||
curl -fsSLO "${BASE}/trivy_${TRIVY_VERSION}_checksums.txt"
|
||||
grep " trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz$" "trivy_${TRIVY_VERSION}_checksums.txt" | sha256sum -c -
|
||||
tar -xzf "trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz" -C /usr/local/bin trivy
|
||||
rm -f "trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz" "trivy_${TRIVY_VERSION}_checksums.txt"
|
||||
trivy --version
|
||||
- name: Secret scan
|
||||
run: trivy fs --scanners secret --exit-code 0 .
|
||||
@@ -21,6 +21,6 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||||
- name: Masterplan lock check
|
||||
run: sh scripts/check-masterplan-lock.sh
|
||||
@@ -17,8 +17,8 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||||
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version: "22"
|
||||
cache: "pnpm"
|
||||
@@ -43,10 +43,18 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install Trivy
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||||
- name: Install Trivy (pinned + checksum verified)
|
||||
run: |
|
||||
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin
|
||||
set -euo pipefail
|
||||
TRIVY_VERSION=0.76.2
|
||||
BASE="https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}"
|
||||
curl -fsSLO "${BASE}/trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz"
|
||||
curl -fsSLO "${BASE}/trivy_${TRIVY_VERSION}_checksums.txt"
|
||||
grep " trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz$" "trivy_${TRIVY_VERSION}_checksums.txt" | sha256sum -c -
|
||||
tar -xzf "trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz" -C /usr/local/bin trivy
|
||||
rm -f "trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz" "trivy_${TRIVY_VERSION}_checksums.txt"
|
||||
trivy --version
|
||||
# A nightly scan exists to catch CVEs published against code that did
|
||||
# not change. With `--exit-code 0` it could never report failure, so it
|
||||
# could never raise that alarm -- the one job whose entire purpose is
|
||||
|
||||
@@ -53,10 +53,13 @@ jobs:
|
||||
echo "::warning::SIAX_CI_TOKEN is not set — cannot compare with main; commit $running is live"
|
||||
exit 0
|
||||
fi
|
||||
expected="$(curl -fsS --max-time 15 \
|
||||
# Ladda ner först och parsea sedan: curl | tolk leder till Semgrep
|
||||
# gha-curl-pipe-shell och gör det omöjligt att verifiera svaret.
|
||||
curl -fsS --max-time 15 \
|
||||
-H "Authorization: token ${SIAX_CI_TOKEN}" \
|
||||
"https://git.siax.io/api/v1/repos/admin/0pt/commits?limit=1" \
|
||||
| python3 -c 'import sys,json; print(json.load(sys.stdin)[0]["sha"])')"
|
||||
-o "${RUNNER_TEMP}/0pt-main.json" \
|
||||
"https://git.siax.io/api/v1/repos/admin/0pt/commits?limit=1"
|
||||
expected="$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))[0]["sha"])' "${RUNNER_TEMP}/0pt-main.json")"
|
||||
echo "running=$running expected(main)=$expected"
|
||||
[ -n "$expected" ] || { echo "::error::could not read main SHA from Gitea"; exit 1; }
|
||||
[ "$running" = "$expected" ] || {
|
||||
|
||||
@@ -162,8 +162,10 @@ jobs:
|
||||
if [ $rc -eq 1 ]; then echo "::error::Trivy filesystem scan hittade fynd"; exit 1; fi
|
||||
echo "::error::Trivy filesystem scan kunde inte koras (rc=$rc) - scannerfel, inte fynd; grinden far inte bli tyst gron"; exit 1
|
||||
|
||||
# Dockerfile- och IaC-misconfig är informativt: DS-0002 (root-USER)
|
||||
# kräver ändrade runtime-användare och hanteras per repo, inte i grinden.
|
||||
# Dockerfile- och IaC-misconfig är informativt. DS-0002 (root-USER),
|
||||
# KSV-0014/KSV-0118 (readOnlyRootFilesystem + icke-root) är åtgärdade i
|
||||
# services/*/Dockerfile och deploy/k8s/deployment.yaml; steget finns kvar
|
||||
# som tidig varning för nya misconfigs, inte som en tyst grön grind.
|
||||
- name: Trivy config informational
|
||||
continue-on-error: true
|
||||
run: |
|
||||
|
||||
@@ -36,8 +36,8 @@ jobs:
|
||||
# requires" section are actually done.
|
||||
VEHIQ_INGEST_MODE: preview
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||||
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version: "22"
|
||||
- name: Enable corepack + pin pnpm@9
|
||||
|
||||
@@ -15,9 +15,23 @@ spec:
|
||||
labels:
|
||||
app: 0pt-web
|
||||
spec:
|
||||
# Den här manifesten är referens-only (se README.md), men den ska vara
|
||||
# säker att använda. Imagebygget kör redan USER node (uid 1000).
|
||||
securityContext:
|
||||
runAsNonRoot: true
|
||||
runAsUser: 1000
|
||||
runAsGroup: 1000
|
||||
fsGroup: 1000
|
||||
seccompProfile:
|
||||
type: RuntimeDefault
|
||||
containers:
|
||||
- name: 0pt-web
|
||||
image: REPLACE_ME/0pt-web:REPLACE_ME_TAG
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
readOnlyRootFilesystem: true
|
||||
capabilities:
|
||||
drop: ["ALL"]
|
||||
ports:
|
||||
- containerPort: 3000
|
||||
env:
|
||||
@@ -50,6 +64,18 @@ spec:
|
||||
limits:
|
||||
cpu: "1"
|
||||
memory: "512Mi"
|
||||
# readOnlyRootFilesystem above needs explicit writable scratch space:
|
||||
# Node/Next writes temp files and caches here at runtime.
|
||||
volumeMounts:
|
||||
- name: tmp
|
||||
mountPath: /tmp
|
||||
- name: next-cache
|
||||
mountPath: /app/.next/cache
|
||||
volumes:
|
||||
- name: tmp
|
||||
emptyDir: {}
|
||||
- name: next-cache
|
||||
emptyDir: {}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
|
||||
@@ -4,6 +4,10 @@ ENV PYTHONUNBUFFERED=1 PIP_NO_CACHE_DIR=1
|
||||
COPY requirements.txt .
|
||||
RUN pip install -r requirements.txt
|
||||
COPY app.py ingest_aud0.py ./
|
||||
# Kör som icke-root (DS-0002). Inga skrivningar till /app krävs.
|
||||
RUN useradd --create-home --uid 10001 appuser
|
||||
USER appuser
|
||||
|
||||
EXPOSE 8096
|
||||
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
|
||||
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8096/health', timeout=3)"
|
||||
|
||||
@@ -15,6 +15,11 @@ RUN pip install -r requirements.txt
|
||||
|
||||
COPY . .
|
||||
|
||||
# Kör som icke-root (DS-0002). Beroendena ligger i globala /usr/local och är
|
||||
# läsliga för alla användare; appens egen kod skrivs inte vid körning.
|
||||
RUN useradd --create-home --uid 10001 appuser
|
||||
USER appuser
|
||||
|
||||
EXPOSE 8000
|
||||
# API: uvicorn orchestrator.main:app --host 0.0.0.0 --port 8000
|
||||
# Worker: python -m workers.run
|
||||
|
||||
@@ -14,8 +14,11 @@ RUN pip install --no-cache-dir -r requirements.txt
|
||||
# Copy scraper code
|
||||
COPY . .
|
||||
|
||||
# Create data directories
|
||||
RUN mkdir -p /data/output /data/checkpoints /data/sources
|
||||
# Create data directories (writable by the non-root runtime user, DS-0002)
|
||||
RUN mkdir -p /data/output /data/checkpoints /data/sources \
|
||||
&& useradd --create-home --uid 10001 appuser \
|
||||
&& chown -R appuser:appuser /data
|
||||
USER appuser
|
||||
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
ENV S3_ENDPOINT=https://s3.siax.io
|
||||
|
||||
Reference in New Issue
Block a user