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
7 changes: 6 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,12 @@ jobs:
# The per-archive .sha256 files exist only to carry each build job's
# digest here; SHA256SUMS covers every archive, so publishing both
# would just give readers two things to disagree.
cat > hardware-checklist.md <<'CHECKLIST'
Before publishing this draft:
- [ ] Follow docs/RELEASING.md on Apple Silicon for this tag and its packaged helper.
- [ ] Attach metadata.txt and test.json, then confirm the archive hash still matches.
CHECKLIST
gh release create "$GITHUB_REF_NAME" \
--repo "$GITHUB_REPOSITORY" --verify-tag \
--title "$GITHUB_REF_NAME" --draft --generate-notes \
--title "$GITHUB_REF_NAME" --draft --generate-notes --notes-file hardware-checklist.md \
"${archives[@]}" SHA256SUMS
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,9 @@ QuantumCat trusts explicitly paired device identities, not relay infrastructure.

For the details and caveats, read [DESIGN.md](DESIGN.md) and [PROTOCOL.md](PROTOCOL.md).

Before publishing a release, validate the packaged Secure Enclave helper on
Apple Silicon using the [release checklist](docs/RELEASING.md).

## Project status

QuantumCat is experimental. The implementation includes automated tests for authentication tampering, replay, identity/source binding, PSK freshness, forwarding policy, revocation, TCP/UDP transport, fragmentation, storage permissions, and local runtime control, but that is not a substitute for independent review.
Expand Down
26 changes: 26 additions & 0 deletions docs/RELEASING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Secure Enclave validation before publication

The release workflow leaves each tag in draft. On an Apple Silicon Mac running
macOS 26 or later, use a clean checkout of the release tag, the Go toolchain
from `go.mod`, and GitHub CLI authenticated for the release repository.
Run as your normal user so qcat honors the explicit helper path.

```sh
git fetch --tags origin
git switch --detach vX.Y.Z
bash scripts/validate-enclave-release.sh vX.Y.Z
```

The script downloads the draft's Darwin ARM64 archive and `SHA256SUMS`,
checks the archive digest and signatures, and compares the packaged CLI's
version and full commit with the local tag. From the same archive it stages
`qcat-se` in a private directory and runs the tag's interoperability test
against that helper. The test exercises Enclave client and server signing,
Go signature verification, and Enclave decapsulation with Go key confirmation.

Attach `metadata.txt` and `test.json` from the printed directory to the draft.
Check that the metadata names the intended tag, commit and archive digest and
that the named hardware test passed. Record the evidence in the release
checklist. If the tag, archive or checksum changes, rerun validation before
publishing. Missing hardware, a skipped test, or a failure leaves the release
in draft.
78 changes: 78 additions & 0 deletions scripts/validate-enclave-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#!/usr/bin/env bash
# Validate the exact binaries attached to a draft release on an Apple Silicon Mac.
set -euo pipefail
umask 077
die() { echo "$*" >&2; exit 1; }
[[ $# == 1 ]] || die "Usage: bash scripts/validate-enclave-release.sh vX.Y.Z"
tag=$1
[[ $tag == v* ]] || die "Expected a v-prefixed release tag"
cd "$(dirname "$0")/.."
[[ $(uname -s) == Darwin && $(uname -m) == arm64 ]] || die "Run on Apple Silicon macOS"
os=$(sw_vers -productVersion)
[[ ${os%%.*} -ge 26 ]] || die "macOS 26 or later is required"
[[ $EUID != 0 ]] || die "Run as your normal user so the helper override is honored"
commit=$(git rev-parse --verify "refs/tags/$tag^{commit}")
[[ $(git rev-parse HEAD) == "$commit" ]] || die "Check out the exact release tag: $tag"
changes=$(git status --porcelain)
[[ -z $changes ]] || die "Hardware validation requires a clean checkout"

repo=$(gh repo view --json nameWithOwner --jq .nameWithOwner)
draft=$(gh release view "$tag" --repo "$repo" --json isDraft --jq .isDraft)
[[ $draft == true ]] || die "$repo release $tag must be a draft"
stage=$(mktemp -d /private/tmp/qcat-enclave.XXXXXXXX)
echo "Validation directory: $stage"
package=qcat-darwin-arm64
archive=$package.tar.gz
gh release download "$tag" --repo "$repo" --dir "$stage" --pattern "$archive" --pattern SHA256SUMS
expected=$(awk -v name="$archive" '$2 == name && NF == 2 { print $1 }' "$stage/SHA256SUMS")
sha256() { shasum -a 256 "$1" | awk '{print $1}'; }
archive_hash=$(sha256 "$stage/$archive")
[[ $expected == "$archive_hash" ]] || die "Missing, duplicate, or mismatched $archive checksum"
build_commit=$(tar -xOzf "$stage/$archive" "$package/BUILD_COMMIT")
[[ $build_commit == "$commit" ]] || die "Archive BUILD_COMMIT differs from $tag"

# Copy only the two binary payloads to private regular files. Their signatures
# are embedded in the Mach-O binaries and survive this extraction.
for binary in qcat qcat-se; do
tar -xOzf "$stage/$archive" "$package/$binary" > "$stage/$binary"
chmod 700 "$stage/$binary"
codesign --verify --strict "$stage/$binary"
done
version=$("$stage/qcat" version)
[[ ${version%%$'\n'*} == "qcat $tag" ]] || die "Packaged qcat did not report the clean release tag $tag"
embedded=$(awk '$1 == "commit" && NF == 2 {print $2}' <<< "$version")
[[ $embedded == "$commit" ]] || die "Packaged qcat commit differs from $tag"
helper_hash=$(sha256 "$stage/qcat-se")
os_build=$(sw_vers -buildVersion)
model=$(sysctl -n hw.model)
chip=$(sysctl -n machdep.cpu.brand_string)
toolchain=$(go version)

test_name=TestSecureEnclaveStandardLibraryInteroperability
QCAT_TEST_ENCLAVE=1 QCAT_ENCLAVE_HELPER="$stage/qcat-se" GOWORK=off GOFLAGS= \
go test -mod=readonly -count=1 -json -run "^$test_name$" ./internal/crypto/provider/se > "$stage/test.json"
python3 - "$stage/test.json" "$test_name" <<'PY'
import json
import sys

with open(sys.argv[1]) as events:
outcomes = [e["Action"] for e in map(json.loads, events)
if e.get("Test") == sys.argv[2] and e["Action"] in ("pass", "skip", "fail")]
if outcomes != ["pass"]:
sys.exit("Missing, skipped, or failed Secure Enclave interoperability test")
PY

{
echo "release: $repo $tag"
echo "commit: $embedded"
echo "archive: $archive"
echo "archive SHA256: $archive_hash"
echo "qcat-se SHA256: $helper_hash"
echo "macOS: $os ($os_build)"
echo "hardware: $model / $chip"
echo "test toolchain: $toolchain"
echo "operator: $(id -un)"
echo "tested at: $(date -u +%FT%TZ)"
echo "result: PASS $test_name"
} > "$stage/metadata.txt"
echo "Attach $stage/metadata.txt and $stage/test.json to the draft release."
Loading