Skip to content

Document Sparkle update contract#81

Open
jmcte wants to merge 11 commits into
mainfrom
codex/issue-57-update-contract
Open

Document Sparkle update contract#81
jmcte wants to merge 11 commits into
mainfrom
codex/issue-57-update-contract

Conversation

@jmcte
Copy link
Copy Markdown
Contributor

@jmcte jmcte commented May 24, 2026

Summary

  • Documents Sparkle 2 as APW.app's in-app update mechanism and records the rationale over a custom updater.
  • Defines the stable GitHub release appcast URL, signed appcast requirements, managed disable key, and security-update surfacing contract.
  • Adds a Sparkle appcast template plus scripts/ci/validate-appcast-contract.sh, then wires that validator into fast checks.
  • Validates the appcast template XML directly so the release archive URL, EdDSA signature, and length must be attributes on the <enclosure> element.
  • Adds scripts/prepare-sparkle-appcast.sh and regression coverage for signed update enclosures, signed release-notes links, and critical-update release notes.
  • Wires tagged release automation to publish appcast.xml and a signed APW.app update archive when SPARKLE_GENERATE_APPCAST is configured on the release runner.
  • Factors native app Info.plist rendering into a tested helper and embeds Sparkle update keys when APW_SPARKLE_PUBLIC_ED_KEY is configured.
  • Links the native app to Sparkle 2 through Swift Package Manager, starts SPUStandardUpdaterController behind the managed update-disable policy, and embeds Sparkle.framework into APW.app.
  • Reports the managed in-app update disable policy and feed URL through APW.app status/doctor payloads.
  • Hardens native-host frame reads and daemon response test reads against interrupted socket reads observed in the optional Rust CI job.
  • Removes the native app AuthenticationServices error-mapping exhaustiveness warning under the current SDK.

Related issue: #57.

This now covers the documented Sparkle decision, signed appcast publication path, native bundle metadata, runtime Sparkle linkage, and managed update-disable policy. The remaining acceptance proof for #57 is a signed/notarized update-flow run against a real release appcast.

Verification

  • ./scripts/ci/validate-appcast-contract.sh
  • ./scripts/test-prepare-sparkle-appcast.sh
  • ./scripts/test-render-native-app-info-plist.sh
  • bash -n scripts/prepare-sparkle-appcast.sh scripts/test-prepare-sparkle-appcast.sh scripts/ci/validate-appcast-contract.sh scripts/ci/run-fast-checks.sh
  • ruby -e 'require "yaml"; YAML.load_file(".github/workflows/release.yml"); puts "release.yml parses"'
  • bash scripts/ci/run-fast-checks.sh
  • swift test --package-path native-app
  • bash scripts/build-native-app.sh
  • native-app/dist/APW.app/Contents/MacOS/APW doctor
  • test -d native-app/dist/APW.app/Contents/Frameworks/Sparkle.framework && otool -l native-app/dist/APW.app/Contents/MacOS/APW | rg -q '@loader_path/\\.\\./Frameworks'
  • codesign --verify --deep --strict --verbose=2 native-app/dist/APW.app
  • APW_SPARKLE_PUBLIC_ED_KEY=test-ed25519-public-key bash scripts/build-native-app.sh && grep -q '<key>SUPublicEDKey</key>' native-app/dist/APW.app/Contents/Info.plist && grep -q 'test-ed25519-public-key' native-app/dist/APW.app/Contents/Info.plist && grep -q '<key>SURequireSignedFeed</key>' native-app/dist/APW.app/Contents/Info.plist
  • cargo fmt --manifest-path rust/Cargo.toml -- --check
  • cargo clippy --manifest-path rust/Cargo.toml --all-targets -- -D warnings
  • cargo test --manifest-path rust/Cargo.toml daemon::tests::start_daemon_native_routes_requests_and_tracks_host_disconnect
  • cargo test --manifest-path rust/Cargo.toml
  • git diff --check

Notes

  • Sparkle security requirements are based on the current official Sparkle documentation for SUFeedURL, EdDSA signatures, SUVerifyUpdateBeforeExtraction, SURequireSignedFeed, and sparkle:criticalUpdate.
  • Release automation skips appcast publication with a warning when SPARKLE_GENERATE_APPCAST is absent so it cannot publish unsigned placeholder metadata.

@jmcte jmcte requested a review from pheidon as a code owner May 24, 2026 00:36
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4f85f38132

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/ci/validate-appcast-contract.sh Outdated
require_pattern "$TEMPLATE_PATH" "sparkle:releaseNotesLink sparkle:edSignature=" "signed release notes link"
require_pattern "$TEMPLATE_PATH" "<sparkle:criticalUpdate" "critical update marker"
require_pattern "$TEMPLATE_PATH" "url=\"https://github\\.com/OMT-Global/apw-cli/releases/download/v[0-9]+\\.[0-9]+\\.[0-9]+/APW\\.app\\.zip\"" "release archive URL"
require_pattern "$TEMPLATE_PATH" "sparkle:edSignature=" "signed archive enclosure"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Scope archive signature check to the enclosure element

The signed archive enclosure assertion only greps for sparkle:edSignature= anywhere in the template, so it still passes if the archive <enclosure> loses its signature while sparkle:releaseNotesLink keeps one. In that case, fast checks would report the appcast contract as valid even though the update archive is no longer guaranteed to be signed, which weakens the security gate this script is intended to enforce.

Useful? React with 👍 / 👎.

Comment thread scripts/ci/validate-appcast-contract.sh Outdated
require_pattern "$TEMPLATE_PATH" "<sparkle:criticalUpdate" "critical update marker"
require_pattern "$TEMPLATE_PATH" "url=\"https://github\\.com/OMT-Global/apw-cli/releases/download/v[0-9]+\\.[0-9]+\\.[0-9]+/APW\\.app\\.zip\"" "release archive URL"
require_pattern "$TEMPLATE_PATH" "sparkle:edSignature=" "signed archive enclosure"
require_pattern "$TEMPLATE_PATH" "length=\"[0-9]+\"" "archive length"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Tie archive length validation to the enclosure entry

The archive length check matches length="[0-9]+" globally, which is satisfied by sparkle:length on sparkle:releaseNotesLink even if the archive <enclosure> no longer has a length attribute. That creates a false pass for a malformed appcast item and undermines this CI contract check for update metadata integrity.

Useful? React with 👍 / 👎.

@athena-omt athena-omt added area:infra Infrastructure, CI, release, governance, scripts, or repo setup. lane:daedalus Daedalus implementation/forge lane. review:athena Athena review governance requested. risk:medium Medium-risk change; normal care required. state:waiting-checks Waiting for CI/check status to settle. status:needs-review PR is ready for Athena review. labels May 24, 2026
jmcte added 9 commits May 24, 2026 03:52
…-contract

# Conflicts:
#	docs/SECURITY_POSTURE_AND_TESTING.md
#	scripts/ci/run-fast-checks.sh
Retry interrupted native-host socket reads so transient EINTR does not surface as a disconnected native helper while reading frame headers or payloads.

Verification:

- cargo fmt --manifest-path rust/Cargo.toml -- --check

- cargo clippy --manifest-path rust/Cargo.toml --all-targets -- -D warnings

- cargo test --manifest-path rust/Cargo.toml daemon::tests::start_daemon_native_routes_requests_and_tracks_host_disconnect

- cargo test --manifest-path rust/Cargo.toml

- bash scripts/ci/run-fast-checks.sh

- git diff --check
Retry interrupted UDP receives in the daemon test helper so Linux CI does not fail when recv returns EINTR while waiting for the daemon response.

Verification:

- cargo fmt --manifest-path rust/Cargo.toml -- --check

- cargo clippy --manifest-path rust/Cargo.toml --all-targets -- -D warnings

- cargo test --manifest-path rust/Cargo.toml daemon::tests::start_daemon_native_routes_requests_and_tracks_host_disconnect

- cargo test --manifest-path rust/Cargo.toml

- bash scripts/ci/run-fast-checks.sh

- git diff --check
Wire the documented Sparkle managed-update disable key into APW.app status and doctor payloads so the runtime can enforce enterprise update policy before enabling Sparkle checks.

Also silence the AuthenticationServices error mapping warning by retaining a stable unknown fallback for newer SDK cases.

Verification:

- swift test --package-path native-app

- bash scripts/build-native-app.sh

- bash scripts/ci/validate-appcast-contract.sh

- bash scripts/ci/run-fast-checks.sh

- git diff --check
Add Sparkle as the native app update framework, start SPUStandardUpdaterController behind the managed update-disable policy, and package Sparkle.framework into APW.app with the correct runtime search path.

Verification:

- swift test --package-path native-app

- bash scripts/build-native-app.sh

- native-app/dist/APW.app/Contents/MacOS/APW doctor

- test -d native-app/dist/APW.app/Contents/Frameworks/Sparkle.framework && otool -l native-app/dist/APW.app/Contents/MacOS/APW | rg -q '@loader_path/\.\./Frameworks'

- codesign --verify --deep --strict --verbose=2 native-app/dist/APW.app

- bash scripts/ci/run-fast-checks.sh

- git diff --check
Parse the Sparkle template XML and verify the archive URL, EdDSA signature, and length directly on the enclosure element so unrelated attributes cannot satisfy the contract.
@jmcte jmcte removed the state:waiting-checks Waiting for CI/check status to settle. label May 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:infra Infrastructure, CI, release, governance, scripts, or repo setup. lane:daedalus Daedalus implementation/forge lane. review:athena Athena review governance requested. risk:medium Medium-risk change; normal care required. status:needs-review PR is ready for Athena review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants