fix(ci): clear 0pt security/scan baseline (pinned tooling, non-root runtime)
CI (SIAX Cloud) / sonar (pull_request) Skipped
masterplan-lock / check (pull_request) Successful in 5s
CI (SIAX Cloud) / Component conformance (blocking) (pull_request) Successful in 8s
CI (SIAX Cloud) / security (pull_request) Successful in 15s
security / scan (pull_request) Successful in 39s
CI (SIAX Cloud) / integration (pull_request) Successful in 1m8s
CI (SIAX Cloud) / quality (pull_request) Successful in 1m44s
CI (SIAX Cloud) / sonar (pull_request) Skipped
masterplan-lock / check (pull_request) Successful in 5s
CI (SIAX Cloud) / Component conformance (blocking) (pull_request) Successful in 8s
CI (SIAX Cloud) / security (pull_request) Successful in 15s
security / scan (pull_request) Successful in 39s
CI (SIAX Cloud) / integration (pull_request) Successful in 1m8s
CI (SIAX Cloud) / quality (pull_request) Successful in 1m44s
This commit is contained in:
@@ -95,7 +95,7 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
|
|||||||
+19
-11
@@ -33,8 +33,8 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||||
with:
|
with:
|
||||||
node-version: "22"
|
node-version: "22"
|
||||||
cache: "pnpm"
|
cache: "pnpm"
|
||||||
@@ -134,8 +134,8 @@ jobs:
|
|||||||
--health-timeout 5s
|
--health-timeout 5s
|
||||||
--health-retries 60
|
--health-retries 60
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||||
with:
|
with:
|
||||||
node-version: "22"
|
node-version: "22"
|
||||||
cache: "pnpm"
|
cache: "pnpm"
|
||||||
@@ -271,10 +271,18 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||||||
- name: Install Trivy
|
- name: Install Trivy (pinned + checksum verified)
|
||||||
run: |
|
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),
|
# `siax/sbom/` är CycloneDX-evidenens för REDAN BYGGDA images (release-kedjan),
|
||||||
# inte källberoenden. Att scanna dem här återrapporterar gamla image-versioner
|
# 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.
|
# (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
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 20
|
timeout-minutes: 20
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: SonarQube analysis (self-hosted sonar.siax.dev)
|
- name: SonarQube analysis (self-hosted sonar.siax.dev)
|
||||||
@@ -316,12 +324,12 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||||
with:
|
with:
|
||||||
node-version: '22'
|
node-version: '22'
|
||||||
- name: Checkout canonical siax-standard (SSOT)
|
- name: Checkout canonical siax-standard (SSOT)
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||||||
with:
|
with:
|
||||||
repository: admin/siax-standard
|
repository: admin/siax-standard
|
||||||
token: ${{ secrets.SIAX_CI_TOKEN }}
|
token: ${{ secrets.SIAX_CI_TOKEN }}
|
||||||
|
|||||||
@@ -12,12 +12,21 @@ jobs:
|
|||||||
health:
|
health:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||||||
- name: Required files
|
- name: Required files
|
||||||
run: |
|
run: |
|
||||||
for f in README.md LICENSE .gitignore; do [ -f "$f" ] || echo "::warning file=$f,title=Missing::$f is missing"; done
|
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"
|
[ -f .gitea/workflows/ci.yml ] || echo "::warning title=No CI::No CI workflow found"
|
||||||
- name: Install Trivy
|
- 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
|
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
|
- name: Secret scan
|
||||||
run: trivy fs --scanners secret --exit-code 0 .
|
run: trivy fs --scanners secret --exit-code 0 .
|
||||||
@@ -21,6 +21,6 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||||||
- name: Masterplan lock check
|
- name: Masterplan lock check
|
||||||
run: sh scripts/check-masterplan-lock.sh
|
run: sh scripts/check-masterplan-lock.sh
|
||||||
@@ -17,8 +17,8 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 45
|
timeout-minutes: 45
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||||
with:
|
with:
|
||||||
node-version: "22"
|
node-version: "22"
|
||||||
cache: "pnpm"
|
cache: "pnpm"
|
||||||
@@ -43,10 +43,18 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 20
|
timeout-minutes: 20
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||||||
- name: Install Trivy
|
- name: Install Trivy (pinned + checksum verified)
|
||||||
run: |
|
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
|
# 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
|
# 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
|
# 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"
|
echo "::warning::SIAX_CI_TOKEN is not set — cannot compare with main; commit $running is live"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
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}" \
|
-H "Authorization: token ${SIAX_CI_TOKEN}" \
|
||||||
"https://git.siax.io/api/v1/repos/admin/0pt/commits?limit=1" \
|
-o "${RUNNER_TEMP}/0pt-main.json" \
|
||||||
| python3 -c 'import sys,json; print(json.load(sys.stdin)[0]["sha"])')"
|
"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"
|
echo "running=$running expected(main)=$expected"
|
||||||
[ -n "$expected" ] || { echo "::error::could not read main SHA from Gitea"; exit 1; }
|
[ -n "$expected" ] || { echo "::error::could not read main SHA from Gitea"; exit 1; }
|
||||||
[ "$running" = "$expected" ] || {
|
[ "$running" = "$expected" ] || {
|
||||||
|
|||||||
@@ -162,8 +162,10 @@ jobs:
|
|||||||
if [ $rc -eq 1 ]; then echo "::error::Trivy filesystem scan hittade fynd"; exit 1; fi
|
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
|
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)
|
# Dockerfile- och IaC-misconfig är informativt. DS-0002 (root-USER),
|
||||||
# kräver ändrade runtime-användare och hanteras per repo, inte i grinden.
|
# 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
|
- name: Trivy config informational
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ jobs:
|
|||||||
# requires" section are actually done.
|
# requires" section are actually done.
|
||||||
VEHIQ_INGEST_MODE: preview
|
VEHIQ_INGEST_MODE: preview
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||||
with:
|
with:
|
||||||
node-version: "22"
|
node-version: "22"
|
||||||
- name: Enable corepack + pin pnpm@9
|
- name: Enable corepack + pin pnpm@9
|
||||||
|
|||||||
@@ -15,9 +15,23 @@ spec:
|
|||||||
labels:
|
labels:
|
||||||
app: 0pt-web
|
app: 0pt-web
|
||||||
spec:
|
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:
|
containers:
|
||||||
- name: 0pt-web
|
- name: 0pt-web
|
||||||
image: REPLACE_ME/0pt-web:REPLACE_ME_TAG
|
image: REPLACE_ME/0pt-web:REPLACE_ME_TAG
|
||||||
|
securityContext:
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
readOnlyRootFilesystem: true
|
||||||
|
capabilities:
|
||||||
|
drop: ["ALL"]
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 3000
|
- containerPort: 3000
|
||||||
env:
|
env:
|
||||||
@@ -50,6 +64,18 @@ spec:
|
|||||||
limits:
|
limits:
|
||||||
cpu: "1"
|
cpu: "1"
|
||||||
memory: "512Mi"
|
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
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
|
|||||||
@@ -4,6 +4,10 @@ ENV PYTHONUNBUFFERED=1 PIP_NO_CACHE_DIR=1
|
|||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
RUN pip install -r requirements.txt
|
RUN pip install -r requirements.txt
|
||||||
COPY app.py ingest_aud0.py ./
|
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
|
EXPOSE 8096
|
||||||
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
|
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)"
|
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 . .
|
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
|
EXPOSE 8000
|
||||||
# API: uvicorn orchestrator.main:app --host 0.0.0.0 --port 8000
|
# API: uvicorn orchestrator.main:app --host 0.0.0.0 --port 8000
|
||||||
# Worker: python -m workers.run
|
# Worker: python -m workers.run
|
||||||
|
|||||||
@@ -14,8 +14,11 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|||||||
# Copy scraper code
|
# Copy scraper code
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Create data directories
|
# Create data directories (writable by the non-root runtime user, DS-0002)
|
||||||
RUN mkdir -p /data/output /data/checkpoints /data/sources
|
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 PYTHONUNBUFFERED=1
|
||||||
ENV S3_ENDPOINT=https://s3.siax.io
|
ENV S3_ENDPOINT=https://s3.siax.io
|
||||||
|
|||||||
Reference in New Issue
Block a user