fix(ci): share isolated runner workspace safely
GeoIntel release gates / Compile, test, contracts and builds (push) Failing after 1m43s
GeoIntel release gates / Python and npm vulnerability policy (push) Successful in 1m31s
GeoIntel release gates / GIS image, SBOM and container scan (push) Failing after 1m1s
Managed validation / full (pull_request) Canceled after 0s
GeoIntel release gates / Compile, test, contracts and builds (pull_request) Canceled after 0s
GeoIntel release gates / Python and npm vulnerability policy (pull_request) Canceled after 0s
GeoIntel release gates / GIS image, SBOM and container scan (pull_request) Canceled after 0s
GeoIntel release gates / Compile, test, contracts and builds (push) Failing after 1m43s
GeoIntel release gates / Python and npm vulnerability policy (push) Successful in 1m31s
GeoIntel release gates / GIS image, SBOM and container scan (push) Failing after 1m1s
Managed validation / full (pull_request) Canceled after 0s
GeoIntel release gates / Compile, test, contracts and builds (pull_request) Canceled after 0s
GeoIntel release gates / Python and npm vulnerability policy (pull_request) Canceled after 0s
GeoIntel release gates / GIS image, SBOM and container scan (pull_request) Canceled after 0s
This commit is contained in:
@@ -21,6 +21,8 @@ jobs:
|
|||||||
timeout-minutes: 45
|
timeout-minutes: 45
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
- name: Secret scan
|
- name: Secret scan
|
||||||
uses: trufflesecurity/trufflehog@v3.79.0
|
uses: trufflesecurity/trufflehog@v3.79.0
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -15,10 +15,16 @@ esac
|
|||||||
|
|
||||||
docker image inspect "$TARGET_IMAGE" >/dev/null
|
docker image inspect "$TARGET_IMAGE" >/dev/null
|
||||||
mkdir -p "$ROOT/$(dirname "$OUTPUT")"
|
mkdir -p "$ROOT/$(dirname "$OUTPUT")"
|
||||||
|
WORKDIR="/workspace"
|
||||||
|
WORKSPACE_ARGS=(-v "$ROOT:/workspace")
|
||||||
|
if docker inspect "${HOSTNAME:-}" >/dev/null 2>&1; then
|
||||||
|
WORKDIR="$ROOT"
|
||||||
|
WORKSPACE_ARGS=(--volumes-from "$HOSTNAME")
|
||||||
|
fi
|
||||||
docker run --rm \
|
docker run --rm \
|
||||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||||
-v "$ROOT:/workspace" \
|
"${WORKSPACE_ARGS[@]}" \
|
||||||
-w /workspace \
|
-w "$WORKDIR" \
|
||||||
"$SYFT_IMAGE" \
|
"$SYFT_IMAGE" \
|
||||||
"$TARGET_IMAGE" \
|
"$TARGET_IMAGE" \
|
||||||
-o "spdx-json=$OUTPUT"
|
-o "spdx-json=$OUTPUT"
|
||||||
|
|||||||
@@ -7,8 +7,7 @@ OUTPUT="${2:-artifacts/geointel-container-vulnerabilities.json}"
|
|||||||
TRIVY_IMAGE="aquasec/trivy:0.70.0@sha256:be1190afcb28352bfddc4ddeb71470835d16462af68d310f9f4bca710961a41e"
|
TRIVY_IMAGE="aquasec/trivy:0.70.0@sha256:be1190afcb28352bfddc4ddeb71470835d16462af68d310f9f4bca710961a41e"
|
||||||
CACHE_DIR="${GEOINTEL_TRIVY_CACHE:-$ROOT/.cache/trivy}"
|
CACHE_DIR="${GEOINTEL_TRIVY_CACHE:-$ROOT/.cache/trivy}"
|
||||||
PYTHON_CMD="${PYTHON_BIN:-python3}"
|
PYTHON_CMD="${PYTHON_BIN:-python3}"
|
||||||
IGNORE_FILE="$(mktemp)"
|
IGNORE_FILE="$CACHE_DIR/geointel-trivy-ignore.txt"
|
||||||
CONTAINER_IGNORE_FILE="/tmp/geointel-trivy-ignore.txt"
|
|
||||||
trap 'rm -f "$IGNORE_FILE"' EXIT
|
trap 'rm -f "$IGNORE_FILE"' EXIT
|
||||||
|
|
||||||
case "$OUTPUT" in
|
case "$OUTPUT" in
|
||||||
@@ -20,6 +19,14 @@ esac
|
|||||||
|
|
||||||
docker image inspect "$TARGET_IMAGE" >/dev/null
|
docker image inspect "$TARGET_IMAGE" >/dev/null
|
||||||
mkdir -p "$ROOT/$(dirname "$OUTPUT")" "$CACHE_DIR"
|
mkdir -p "$ROOT/$(dirname "$OUTPUT")" "$CACHE_DIR"
|
||||||
|
WORKDIR="/workspace"
|
||||||
|
WORKSPACE_ARGS=(-v "$ROOT:/workspace")
|
||||||
|
if docker inspect "${HOSTNAME:-}" >/dev/null 2>&1; then
|
||||||
|
WORKDIR="$ROOT"
|
||||||
|
WORKSPACE_ARGS=(--volumes-from "$HOSTNAME")
|
||||||
|
fi
|
||||||
|
CONTAINER_CACHE_DIR="$WORKDIR/.cache/trivy"
|
||||||
|
CONTAINER_IGNORE_FILE="$CONTAINER_CACHE_DIR/geointel-trivy-ignore.txt"
|
||||||
"$PYTHON_CMD" "$ROOT/scripts/verify_security_exceptions.py"
|
"$PYTHON_CMD" "$ROOT/scripts/verify_security_exceptions.py"
|
||||||
"$PYTHON_CMD" "$ROOT/scripts/verify_security_exceptions.py" \
|
"$PYTHON_CMD" "$ROOT/scripts/verify_security_exceptions.py" \
|
||||||
--print-container-ids > "$IGNORE_FILE"
|
--print-container-ids > "$IGNORE_FILE"
|
||||||
@@ -27,15 +34,15 @@ mkdir -p "$ROOT/$(dirname "$OUTPUT")" "$CACHE_DIR"
|
|||||||
# Keep the complete report, including vulnerabilities without an available fix.
|
# Keep the complete report, including vulnerabilities without an available fix.
|
||||||
docker run --rm \
|
docker run --rm \
|
||||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||||
-v "$ROOT:/workspace" \
|
"${WORKSPACE_ARGS[@]}" \
|
||||||
-v "$CACHE_DIR:/root/.cache/trivy" \
|
|
||||||
"$TRIVY_IMAGE" \
|
"$TRIVY_IMAGE" \
|
||||||
image \
|
image \
|
||||||
--scanners vuln \
|
--scanners vuln \
|
||||||
--timeout 20m \
|
--timeout 20m \
|
||||||
--skip-version-check \
|
--skip-version-check \
|
||||||
--format json \
|
--format json \
|
||||||
--output "/workspace/$OUTPUT" \
|
--cache-dir "$CONTAINER_CACHE_DIR" \
|
||||||
|
--output "$WORKDIR/$OUTPUT" \
|
||||||
"$TARGET_IMAGE"
|
"$TARGET_IMAGE"
|
||||||
|
|
||||||
# Release policy: fixed HIGH/CRITICAL findings block the build. Unfixed findings
|
# Release policy: fixed HIGH/CRITICAL findings block the build. Unfixed findings
|
||||||
@@ -44,14 +51,14 @@ docker run --rm \
|
|||||||
# but the final filesystem replaces it with the audited setpriv shell wrapper.
|
# but the final filesystem replaces it with the audited setpriv shell wrapper.
|
||||||
docker run --rm \
|
docker run --rm \
|
||||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||||
-v "$CACHE_DIR:/root/.cache/trivy" \
|
"${WORKSPACE_ARGS[@]}" \
|
||||||
-v "$IGNORE_FILE:$CONTAINER_IGNORE_FILE:ro" \
|
|
||||||
"$TRIVY_IMAGE" \
|
"$TRIVY_IMAGE" \
|
||||||
image \
|
image \
|
||||||
--scanners vuln \
|
--scanners vuln \
|
||||||
--timeout 20m \
|
--timeout 20m \
|
||||||
--skip-version-check \
|
--skip-version-check \
|
||||||
--ignore-unfixed \
|
--ignore-unfixed \
|
||||||
|
--cache-dir "$CONTAINER_CACHE_DIR" \
|
||||||
--ignorefile "$CONTAINER_IGNORE_FILE" \
|
--ignorefile "$CONTAINER_IGNORE_FILE" \
|
||||||
--skip-files /usr/local/bin/gosu \
|
--skip-files /usr/local/bin/gosu \
|
||||||
--severity HIGH,CRITICAL \
|
--severity HIGH,CRITICAL \
|
||||||
|
|||||||
Reference in New Issue
Block a user