Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 23 additions & 17 deletions .github/workflows/publish-current-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
TARGET_IMAGE: ghcr.io/pasturestack/server:${{ inputs.release_tag }}
LAYERED_CANDIDATE_IMAGE: local/pasturestack/server-layered:${{ inputs.release_tag }}-${{ github.run_id }}
CANDIDATE_IMAGE: local/pasturestack/server:${{ inputs.release_tag }}-${{ github.run_id }}
SECURITY_PROBE_IMAGE: local/pasturestack/security-builder:${{ github.run_id }}
CANDIDATE_NAME: pasturestack-server-release-${{ github.run_id }}
CATTLE_VOLUME: pasturestack-server-release-cattle-${{ github.run_id }}
MYSQL_VOLUME: pasturestack-server-release-mysql-${{ github.run_id }}
Expand Down Expand Up @@ -117,6 +118,27 @@ jobs:
set -Eeuo pipefail
bash scripts/check-server-source-gates.sh

- name: Verify real signed payload recovery in the exact security builder
shell: bash
run: |
set -euo pipefail
evidence="$RUNNER_TEMP/server-evidence"
# Reuse the exact completed build stage and its real signature tools.
# Final runtime installs offline and deliberately excludes gpgv.
docker build --target runtime_security_packages \
--file source/server/Dockerfile.web-compose-release \
--tag "$SECURITY_PROBE_IMAGE" source/server
docker run --rm --read-only --security-opt no-new-privileges \
--tmpfs /tmp:rw,nosuid,size=256m \
--mount "type=bind,source=$GITHUB_WORKSPACE/source/scripts/probe-security-payload-recovery.sh,target=/probe/run.sh,readonly" \
--mount "type=bind,source=$GITHUB_WORKSPACE/source/server/scripts/download-ubuntu-security-updates.sh,target=/probe/download.sh,readonly" \
--mount "type=bind,source=$GITHUB_WORKSPACE/source/server/security/ubuntu-security-approved-records.tsv,target=/probe/approved.tsv,readonly" \
--mount "type=bind,source=$GITHUB_WORKSPACE/source/server/security/ubuntu-security-packages.lock,target=/probe/versions.lock,readonly" \
--entrypoint /bin/sh "$SECURITY_PROBE_IMAGE" /probe/run.sh \
>"$evidence/security-payload-recovery.json"
jq -e '.status == "PASS_NATIVE_OFFICIAL_PAYLOAD_RECOVERY" and .scope == "security-package-builder" and .forcedPayloadFailures == 1 and .actualAptHelper and .packageSetUnchanged and .aptSourcesUnchanged' \
"$evidence/security-payload-recovery.json"

- name: Build exact release image once
shell: bash
working-directory: source
Expand Down Expand Up @@ -187,22 +209,6 @@ jobs:
cleanup_extract
trap - EXIT

- name: Verify real signed payload recovery on the isolated candidate
shell: bash
run: |
set -euo pipefail
evidence="$RUNNER_TEMP/server-evidence"
docker run --rm --read-only --security-opt no-new-privileges \
--tmpfs /tmp:rw,nosuid,size=256m \
--mount "type=bind,source=$GITHUB_WORKSPACE/source/scripts/probe-security-payload-recovery.sh,target=/probe/run.sh,readonly" \
--mount "type=bind,source=$GITHUB_WORKSPACE/source/server/scripts/download-ubuntu-security-updates.sh,target=/probe/download.sh,readonly" \
--mount "type=bind,source=$GITHUB_WORKSPACE/source/server/security/ubuntu-security-approved-records.tsv,target=/probe/approved.tsv,readonly" \
--mount "type=bind,source=$GITHUB_WORKSPACE/source/server/security/ubuntu-security-packages.lock,target=/probe/versions.lock,readonly" \
--entrypoint /bin/sh "$CANDIDATE_IMAGE" /probe/run.sh \
>"$evidence/security-payload-recovery.json"
jq -e '.status == "PASS_NATIVE_OFFICIAL_PAYLOAD_RECOVERY" and .forcedPayloadFailures == 1 and .actualAptHelper and .runtimePackageSetUnchanged and .aptSourcesUnchanged' \
"$evidence/security-payload-recovery.json"

- name: Verify the actual candidate JDK security runtime
shell: bash
working-directory: source
Expand Down Expand Up @@ -1025,7 +1031,7 @@ jobs:
docker rm -f "$CANDIDATE_NAME" >/dev/null 2>&1 || true
docker volume rm "$CATTLE_VOLUME" "$MYSQL_VOLUME" "$MYSQL_LOG_VOLUME" \
>/dev/null 2>&1 || true
docker image rm "$TARGET_IMAGE" "$CANDIDATE_IMAGE" "$TRIVY_IMAGE" \
docker image rm "$TARGET_IMAGE" "$CANDIDATE_IMAGE" "$SECURITY_PROBE_IMAGE" "$TRIVY_IMAGE" \
>/dev/null 2>&1 || true
sudo rm -rf \
"$RUNNER_TEMP/server-rootfs" \
Expand Down
4 changes: 2 additions & 2 deletions scripts/probe-security-payload-recovery.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
# Isolated release-image probe: real signed APT indexes and apt-helper, with one
# Isolated exact security-builder probe: real signed APT indexes and apt-helper, with one
# test-only payload transport fault. Never installs packages or changes sources.
set -eu
test "$#" -eq 0
Expand Down Expand Up @@ -61,5 +61,5 @@ test "$(dpkg-deb -f "$file" Version)" = "$version"
test "$(dpkg-deb -f "$file" Architecture)" = "$expected_arch"
test "$packages_before" = "$(dpkg-query -W -f='${Package}\t${Version}\t${db:Status-Status}\n' | sha256sum)"
test "$sources_before" = "$(find /etc/apt -type f -exec sha256sum {} + | LC_ALL=C sort | sha256sum)"
printf '{"status":"PASS_NATIVE_OFFICIAL_PAYLOAD_RECOVERY","package":"%s","version":"%s","sha256":"%s","bytes":%s,"snapshot":"%s","forcedPayloadFailures":1,"actualAptHelper":true,"runtimePackageSetUnchanged":true,"aptSourcesUnchanged":true}\n' \
printf '{"status":"PASS_NATIVE_OFFICIAL_PAYLOAD_RECOVERY","scope":"security-package-builder","package":"%s","version":"%s","sha256":"%s","bytes":%s,"snapshot":"%s","forcedPayloadFailures":1,"actualAptHelper":true,"packageSetUnchanged":true,"aptSourcesUnchanged":true}\n' \
"$package" "$version" "$expected_sha" "$expected_size" "$snapshot"