mirror of
https://github.com/storytold/figcraft.git
synced 2026-11-28 14:08:42 -08:00
Preserve macOS app signatures in shipped DMGs (#590)
* M9: preserve app signatures in macOS DMGs (#387) * M9: handle EXIT trap diagnostics in CI ShellCheck * #590: use [[ ]] tests in the DMG scripts * #590: SHA-pin actions/checkout in the DMG test job * #590: keep "DMG stapled" in the strict verification summary * Release: DMG integrity job uses harden-runner v2.23.0, matching the other workflows --------- Co-authored-by: bflatastic <bombayapirat@gmail.com> Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>
This commit is contained in:
8 files changed
+204
-15
No files matched your search
@@ -22,7 +22,9 @@ workflows:
|
||||
'.github/workflows/packaging-lint.yml':
|
||||
- 'actions/checkout@v7.0.1'
|
||||
- 'step-security/harden-runner@v2.22.4'
|
||||
'.github/workflows/release.yml': []
|
||||
'.github/workflows/release.yml':
|
||||
- 'actions/checkout@v7.0.1'
|
||||
- 'step-security/harden-runner@v2.23.0'
|
||||
'.github/workflows/sonarcloud.yml': []
|
||||
'.github/workflows/windows-arm64.yml': []
|
||||
dependencies:
|
||||
@@ -51,6 +53,11 @@ dependencies:
|
||||
commit: 'sha1-1d88384fd173af6ecb012dfd0264a306b711241a'
|
||||
owner_id: 88700172
|
||||
repo_id: 422287306
|
||||
'step-security/harden-runner@v2.23.0':
|
||||
ref: 'v2.23.0'
|
||||
commit: 'sha1-aebdcf6156ab6691adf63218240e476564a1ed4c'
|
||||
owner_id: 88700172
|
||||
repo_id: 422287306
|
||||
'storytold/craft-common-actions@f5141455aac7b2eb4708aa259d8ffcdf10fde939':
|
||||
ref: 'main'
|
||||
commit: 'sha1-f5141455aac7b2eb4708aa259d8ffcdf10fde939'
|
||||
|
||||
@@ -29,8 +29,25 @@ jobs:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
uses: storytold/craft-common-actions/.github/workflows/refresh-contributors.yml@main
|
||||
# The DMG round trip with an ad-hoc signed fixture (#387): no signing secrets.
|
||||
dmg-test:
|
||||
name: macOS DMG integrity
|
||||
runs-on: macos-15
|
||||
timeout-minutes: 10
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Harden runner
|
||||
uses: step-security/harden-runner@v2.23.0
|
||||
with:
|
||||
egress-policy: audit
|
||||
- uses: actions/checkout@v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Test signed fixture and installation copy
|
||||
run: bash packaging/macos/dmg-test.sh
|
||||
release:
|
||||
needs: credits
|
||||
needs: [credits, dmg-test]
|
||||
# Intentionally tracked at @main (not SHA-pinned) so org-wide CI improvements, security fixes, and build optimizations propagate without PR churn across all craftapp repos.
|
||||
uses: storytold/craft-common-actions/.github/workflows/release.yml@main
|
||||
with:
|
||||
|
||||
+2
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
**Stage: alpha** · next: beta, ~26 points and ~162–292 h away (one Opus 5.5 agent; ~33–67 h wall-clock with 5 agents)
|
||||
|
||||
> **Last reviewed:** 2026-11-15 · **Last updated:** 2026-11-19 · **Change:** minor (variables export and import as DTCG design tokens (#1687); Uno C# Markup code generation for layers, with auto layout and vectors as paths; M5: prototype arrow-key aliases and explicit document-scoped player controls, including batch rollback; numbers unchanged; M9: clients accept complete legacy welcomes without a reconnect secret and re-authenticate on reconnect (#2365); a boolean group takes a corner radius (and smoothing) that rounds every sharp corner of its result (#2222); a text style binds a number variable to its weight (#2174); mind maps, first step: a first node with three children on curved branches, laid out again after every edit (`board.mindMap`, `board.mindMapAdd`, #2226); the handoff mode reads Developer Mode in the interface, its ids and saved fields unchanged; the left rail's and tab strip's icons are larger, 20 pt (#553); Suggest auto layout adds nested auto layout frames by rows and columns and keeps the placement of the design, as the help center describes (#1823); the Local variables window selects several variables (click, Shift+click for a range, Cmd/Ctrl+click to toggle, Escape to clear) and delete, move to a group and scope act on the selected local variables in one undo step (#2002); the desktop UI takes a system face for Ethiopic, Devanagari, Gurmukhi, Gujarati, Tamil, Telugu, Kannada and Malayalam, Sinhala, Lao, Myanmar, Khmer, Armenian and Georgian as it did for Hebrew and Arabic, so a String variable's Amharic value draws in the panels instead of boxes (#2014); a layer's effect binding takes only a field its effect has; ; the boolean operation menu leads each entry with an original icon (#2003); glass takes one sample instead of its dispersion window where the colours split under 1/256 px; glass bends towards its core, and rounded rectangles work it out in closed form; glass's light is a line on its bevel and splay turns the bend towards the centre; glass bends with a thick-lens profile and splits its colours over 8 steps; glass effects take variables and keep their frost within 0–100; web host bridge: `?host=parent` or `data-host="page"` hands a page the app's files, documented in the hosting guide; a connector end moved with Cmd/Ctrl held goes on any part of an object, and stays there as the object moves or resizes; a tap on a plugin panel's button keeps what was typed in its fields; a Dash cap setting (none, round or square) on Dash and Custom strokes, drawn on both ends of every dash; library analytics list how many layers and files use each style and variable; the Controller menu names each button as PlayStation and Switch controllers do; widgets draw lines and SVG pictures (plugin API 6); a connector end dropped along a side of a shape attaches to that side (#1708); regression tests pin a rounded shape's one-sided stroke and SVG ids and font families without XML-forbidden characters (#1351, #1124); a damaged image is refused with a reason instead of showing as an empty box (#1474); an image copied in another app pastes again on the desktop, and in the browser for the first time (#492); SwiftUI and Compose code names a bound variable by its iOS or Android code syntax; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the Frame tool's Phone presets have the iPhone 17 family (#1691); Show in folder works in the Flatpak build and selects the file on Linux (#1701); a dashed line starts and ends with a half-length dash, on the canvas and in exports; the Pages, Layers and Assets search fields keep their text in the middle of the field (#1703); a board connector's path can be reshaped by dragging its path handles (#1710); boards have 16 more shapes (arrows, polygons, star, plus and flowchart symbols), in pickers that lay them out in a grid; library analytics count insertions and show insertions and detachments over the past 30 days, 90 days or year; a stroke's Custom style takes a dash pattern of any length as a comma-separated list (#1681); a control request can set its own timeout, up to 10 minutes (`timeoutMs`; `figcraft-cli mcp --attach PORT --timeout SECONDS`) (#1696); gap 6: a widget opens its plugin's panel (plugin API 5), whose callbacks redraw it; the keyboard's Menu key opens the context menu, as Shift+F10 does; an Open link action can open in place of the prototype, with "Open in new tab" off (gap 15); a collection of this file can be extended (Extend collection on its row, `variable.extendCollection`), its extension following its edits at once, and extended collections extend again in the file; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; a live session's welcome sends the document compressed to clients that read it, about seven times smaller (#1665); a control request that times out says truthfully whLine truncated
|
||||
> **Last reviewed:** 2026-11-15 · **Last updated:** 2026-11-19 · **Change:** minor (macOS DMGs are built with `hdiutil create -fs HFS+` and the app is verified in the finished image and an installation copy (#387); variables export and import as DTCG design tokens (#1687); Uno C# Markup code generation for layers, with auto layout and vectors as paths; M5: prototype arrow-key aliases and explicit document-scoped player controls, including batch rollback; numbers unchanged; M9: clients accept complete legacy welcomes without a reconnect secret and re-authenticate on reconnect (#2365); a boolean group takes a corner radius (and smoothing) that rounds every sharp corner of its result (#2222); a text style binds a number variable to its weight (#2174); mind maps, first step: a first node with three children on curved branches, laid out again after every edit (`board.mindMap`, `board.mindMapAdd`, #2226); the handoff mode reads Developer Mode in the interface, its ids and saved fields unchanged; the left rail's and tab strip's icons are larger, 20 pt (#553); Suggest auto layout adds nested auto layout frames by rows and columns and keeps the placement of the design, as the help center describes (#1823); the Local variables window selects several variables (click, Shift+click for a range, Cmd/Ctrl+click to toggle, Escape to clear) and delete, move to a group and scope act on the selected local variables in one undo step (#2002); the desktop UI takes a system face for Ethiopic, Devanagari, Gurmukhi, Gujarati, Tamil, Telugu, Kannada and Malayalam, Sinhala, Lao, Myanmar, Khmer, Armenian and Georgian as it did for Hebrew and Arabic, so a String variable's Amharic value draws in the panels instead of boxes (#2014); a layer's effect binding takes only a field its effect has; ; the boolean operation menu leads each entry with an original icon (#2003); glass takes one sample instead of its dispersion window where the colours split under 1/256 px; glass bends towards its core, and rounded rectangles work it out in closed form; glass's light is a line on its bevel and splay turns the bend towards the centre; glass bends with a thick-lens profile and splits its colours over 8 steps; glass effects take variables and keep their frost within 0–100; web host bridge: `?host=parent` or `data-host="page"` hands a page the app's files, documented in the hosting guide; a connector end moved with Cmd/Ctrl held goes on any part of an object, and stays there as the object moves or resizes; a tap on a plugin panel's button keeps what was typed in its fields; a Dash cap setting (none, round or square) on Dash and Custom strokes, drawn on both ends of every dash; library analytics list how many layers and files use each style and variable; the Controller menu names each button as PlayStation and Switch controllers do; widgets draw lines and SVG pictures (plugin API 6); a connector end dropped along a side of a shape attaches to that side (#1708); regression tests pin a rounded shape's one-sided stroke and SVG ids and font families without XML-forbidden characters (#1351, #1124); a damaged image is refused with a reason instead of showing as an empty box (#1474); an image copied in another app pastes again on the desktop, and in the browser for the first time (#492); SwiftUI and Compose code names a bound variable by its iOS or Android code syntax; the colour picker's Image tab shows a placeholder and Upload from computer, an asset preview, and a file dropped on it replaces the image, keeping the fill mode, crop and position (#1682); the Frame tool's Phone presets have the iPhone 17 family (#1691); Show in folder works in the Flatpak build and selects the file on Linux (#1701); a dashed line starts and ends with a half-length dash, on the canvas and in exports; the Pages, Layers and Assets search fields keep their text in the middle of the field (#1703); a board connector's path can be reshaped by dragging its path handles (#1710); boards have 16 more shapes (arrows, polygons, star, plus and flowchart symbols), in pickers that lay them out in a grid; library analytics count insertions and show insertions and detachments over the past 30 days, 90 days or year; a stroke's Custom style takes a dash pattern of any length as a comma-separated list (#1681); a control request can set its own timeout, up to 10 minutes (`timeoutMs`; `figcraft-cli mcp --attach PORT --timeout SECONDS`) (#1696); gap 6: a widget opens its plugin's panel (plugin API 5), whose callbacks redraw it; the keyboard's Menu key opens the context menu, as Shift+F10 does; an Open link action can open in place of the prototype, with "Open in new tab" off (gap 15); a collection of this file can be extended (Extend collection on its row, `variable.extendCollection`), its extension following its edits at once, and extended collections extend again in the file; the eyedropper with Cmd/Ctrl+Shift makes a colour style or variable of what it picks; a live session's welcome sends the Line truncated
|
||||
|
||||
FigCraft is a clean-room, open-source, pure-Rust reimplementation of the Figma design workflow,
|
||||
native on macOS, Windows, Linux and FreeBSD and in the browser, fully drivable by agents through
|
||||
@@ -627,6 +627,7 @@ Ranked; detail and milestones in [`docs/roadmap.md`](docs/roadmap.md).
|
||||
| 2026-10-15 | minor | Drop files anywhere to open them (M7): dragging files over the window shows a "Drop to open" (home) or "Drop to import" (canvas) overlay. On the home screen each supported file opens as a document of its own and other files are turned away with a toast; on the canvas the files import at the drop point. Both wait behind a small card that is on screen before a large file blocks the window. A canvas import stays with the document and page that received the drop even if the tab or page changes meanwhile, and is cancelled with a message if that document or page is gone. Numbers unchanged. |
|
||||
| 2026-10-15 | minor | M7: system font discovery skips entries observed as non-regular files before opening them, avoiding the reproduced named-pipe stall. Regular-file symlinks remain supported; directory depth, font limits and priorities are unchanged. Numbers unchanged. |
|
||||
| 2026-10-15 | minor | Canvas retains a bounded margin while panning so newly exposed strips can reuse the previous render. Numbers unchanged. |
|
||||
| 2026-10-15 | minor | macOS DMG: replace the HFS hybrid image builder that adds FinderInfo after signing; verify the app in the finished read-only image and a normal installation copy, with notarization checks for signed releases. A separate release-workflow job runs the native ad-hoc regression once before the shared release job, covering signature integrity and cleanup (#387). Numbers unchanged. |
|
||||
| 2026-10-15 | minor | Dev Mode tail (M6, gap 16): import lines for connected components inside generated layer trees (definitions, slots and swapped-in instances too); `dev.compare {version}` and the compare view's Compare with menu compare with any saved version; behaviour suite (5 tests; 4 failed before the fixes): an inspect-only Dev Mode canvas with menus, shortcuts, nudges, opacity keys and paste refusing design edits, toolbar drawing tools returning to the design, Changed in the ready list (`inspect.readyForDev {status: changed}`), statuses only on sections and top-level frames; read-only plugins' panels from the Inspect tab. Dev Mode 96%/72% → 97%/76%, 0–1 h → 2–4 h (measurements kept on the canvas and a read-only layers panel counted as missing); header totals not recomputed |
|
||||
| 2026-10-15 | minor | Typography spacing icons scrub with the shared number-field gesture, modifier rates and one Undo step per drag (#373). Units and selected-character targeting are preserved. Numbers unchanged. |
|
||||
| 2026-10-14 | minor | System theme on first run (M7): preferences without a theme default to System; the first frame reads the OS appearance directly, including when returning from a manual theme. Saved Light/Dark choices stay explicit; unavailable OS appearance falls back to Light. Numbers unchanged. |
|
||||
|
||||
+13
-4
@@ -136,10 +136,19 @@ under the size gate in `packaging/web/package.sh`. Packages carry each embedded
|
||||
`Info.plist.in`). The `.icns` is generated at packaging time with `iconutil` from the committed
|
||||
`assets/app-icon/figcraft-<size>.png` (made by `cargo xtask icon`); it is never committed.
|
||||
Signing goes inside-out with the hardened runtime and a timestamp (empty entitlements), then the
|
||||
app is notarized and stapled, put on a DMG with an `Applications` link (`hdiutil makehybrid` +
|
||||
`convert`), and the DMG is signed, notarized and stapled. The CLI is signed with the same
|
||||
identity and notarized as a zip. `packaging/macos/verify.sh` checks the artifacts as shipped
|
||||
(strict with secrets, warnings without).
|
||||
app is notarized and stapled, put on a DMG with an `Applications` link (`hdiutil create -fs HFS+`,
|
||||
with retries for transient device contention), and the DMG is signed, notarized and stapled.
|
||||
The CLI is signed with the same identity and notarized as a zip. `packaging/macos/verify.sh` checks the artifacts as shipped
|
||||
(signature integrity is always required; Developer ID and notarization checks require secrets).
|
||||
Both scripts mount the finished DMG read-only, verify `FigCraft.app` with `codesign --verify
|
||||
--deep --strict`, copy it out with `ditto`, and repeat the check. Notarized builds also validate
|
||||
the app's stapled ticket and Gatekeeper acceptance in both locations. The image is detached on
|
||||
success or failure; neither check repairs metadata. `makehybrid -hfs` is avoided because it adds
|
||||
FinderInfo to resources after signing (#387). `bash packaging/macos/dmg-test.sh` exercises this
|
||||
round trip with an ad-hoc signed fixture, rejects FinderInfo in either the image or installation
|
||||
copy, a missing app and a top-level app symlink, and checks mount cleanup. The release workflow runs it once
|
||||
in a separate `macOS DMG integrity` job, without signing secrets, before the shared release job.
|
||||
Local packaging runs only the real artifact checks, without repeating the fixture test.
|
||||
|
||||
Locally (no certificates: ad-hoc signature, no notarization):
|
||||
|
||||
|
||||
Executable
+94
@@ -0,0 +1,94 @@
|
||||
#!/usr/bin/env bash
|
||||
# Native signature round-trip regression for #387. No build, certificates or notarization needed.
|
||||
set -euo pipefail
|
||||
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
TEST_WORK="$(mktemp -d "${TMPDIR:-/tmp}/figcraft-dmg-test.XXXXXX")"
|
||||
trap 'rm -rf "$TEST_WORK"' EXIT
|
||||
export DIST="$TEST_WORK/dist"
|
||||
# shellcheck source=../env.sh
|
||||
. "$HERE/../env.sh"
|
||||
# shellcheck source=dmg.sh
|
||||
. "$HERE/dmg.sh"
|
||||
mkdir -p "$TEST_WORK/stage/FigCraft.app/Contents/MacOS" "$TEST_WORK/stage/FigCraft.app/Contents/Resources" "$TEST_WORK/checks"
|
||||
APP="$TEST_WORK/stage/FigCraft.app"
|
||||
cp /usr/bin/true "$APP/Contents/MacOS/FigCraft"
|
||||
sed -e 's/@VERSION@/0.0.0/g' -e 's/@SHORT_VERSION@/0.0.0/g' -e 's/@BUILD_SHA@/test/g' \
|
||||
"$HERE/Info.plist.in" >"$APP/Contents/Info.plist"
|
||||
printf 'Test licence\n' >"$APP/Contents/Resources/License.txt"
|
||||
ln -s /Applications "$TEST_WORK/stage/Applications"
|
||||
codesign --force --sign - --timestamp=none "$APP/Contents/MacOS/FigCraft"
|
||||
codesign --force --sign - --timestamp=none "$APP"
|
||||
codesign --verify --deep --strict "$APP"
|
||||
|
||||
# Invoke in a fresh shell: testing a function directly in `if` would disable its errexit.
|
||||
verify_image() {
|
||||
RUNNER_TEMP="$TEST_WORK/checks" bash -c '
|
||||
set -euo pipefail
|
||||
. "$1/../env.sh"
|
||||
. "$1/dmg.sh"
|
||||
verify_dmg_app "$2" 0
|
||||
' _ "$HERE" "$1"
|
||||
}
|
||||
assert_detached() {
|
||||
if [[ -n "$(find "$TEST_WORK/checks" -mindepth 1 -print -quit)" ]]; then
|
||||
echo "error: image check did not detach and remove its temporary directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Both the app in the read-only image and a ditto installation copy must remain valid.
|
||||
create_dmg "$TEST_WORK/stage" "$TEST_WORK/good.dmg"
|
||||
verify_image "$TEST_WORK/good.dmg"
|
||||
assert_detached
|
||||
|
||||
# A copy can acquire metadata independently of the mounted app. Keep real ditto/codesign,
|
||||
# but inject FinderInfo into the installation copy to prove its own check is mandatory.
|
||||
mkdir -p "$TEST_WORK/bin"
|
||||
cat >"$TEST_WORK/bin/ditto" <<'DITTO'
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
/usr/bin/ditto "$@"
|
||||
xattr -wx com.apple.FinderInfo 5445585400000000000000000000000000000000000000000000000000000000 \
|
||||
"$2/Contents/Resources/License.txt"
|
||||
DITTO
|
||||
chmod +x "$TEST_WORK/bin/ditto"
|
||||
if PATH="$TEST_WORK/bin:$PATH" verify_image "$TEST_WORK/good.dmg" >"$TEST_WORK/copy.log" 2>&1; then
|
||||
echo "error: verifier accepted invalid Finder data added to the installation copy" >&2
|
||||
exit 1
|
||||
fi
|
||||
grep -q 'Disallowed xattr com.apple.FinderInfo.*copied/FigCraft.app' "$TEST_WORK/copy.log"
|
||||
assert_detached
|
||||
|
||||
# Reproduce the old image builder: it adds FinderInfo to License.txt after signing.
|
||||
hdiutil makehybrid -hfs -hfs-volume-name FigCraft -hfs-openfolder "$TEST_WORK/stage" \
|
||||
-o "$TEST_WORK/bad.dmg" "$TEST_WORK/stage"
|
||||
if verify_image "$TEST_WORK/bad.dmg" >"$TEST_WORK/rejected.log" 2>&1; then
|
||||
echo "error: verifier accepted an app with invalid attached Finder data" >&2
|
||||
exit 1
|
||||
fi
|
||||
grep -q 'Disallowed xattr com.apple.FinderInfo.*mounted/FigCraft.app' "$TEST_WORK/rejected.log"
|
||||
assert_detached
|
||||
|
||||
mkdir -p "$TEST_WORK/empty"
|
||||
printf 'No application\n' >"$TEST_WORK/empty/README.txt"
|
||||
create_dmg "$TEST_WORK/empty" "$TEST_WORK/missing.dmg"
|
||||
if verify_image "$TEST_WORK/missing.dmg" >"$TEST_WORK/missing.log" 2>&1; then
|
||||
echo "error: verifier accepted a DMG without FigCraft.app" >&2
|
||||
exit 1
|
||||
fi
|
||||
grep -q 'DMG has no FigCraft.app' "$TEST_WORK/missing.log"
|
||||
assert_detached
|
||||
|
||||
# A top-level link can point outside the image at a valid signed app. Verification
|
||||
# must reject the link itself rather than validating and copying its external target.
|
||||
mkdir -p "$TEST_WORK/linked"
|
||||
ln -s "$APP" "$TEST_WORK/linked/FigCraft.app"
|
||||
create_dmg "$TEST_WORK/linked" "$TEST_WORK/linked.dmg"
|
||||
if verify_image "$TEST_WORK/linked.dmg" >"$TEST_WORK/linked.log" 2>&1; then
|
||||
echo "error: verifier accepted a symlink instead of an app stored in the image" >&2
|
||||
exit 1
|
||||
fi
|
||||
grep -q 'DMG has no FigCraft.app' "$TEST_WORK/linked.log"
|
||||
assert_detached
|
||||
|
||||
echo 'DMG round trip: signed app and installation copy pass; FinderInfo in image/copy, missing app and symlink rejected; mounts cleaned up'
|
||||
@@ -0,0 +1,58 @@
|
||||
# shellcheck shell=bash
|
||||
# Shared by package.sh and verify.sh after packaging/env.sh has been sourced.
|
||||
|
||||
create_dmg() {
|
||||
local stage="$1" image="$2"
|
||||
# makehybrid -hfs synthesizes FinderInfo on resources (even plain .txt files), invalidating
|
||||
# strict bundle verification. create preserves the signed app's metadata. It attaches a
|
||||
# temporary device internally: retry transient "Resource busy" failures on release runners.
|
||||
retry hdiutil create -ov -fs HFS+ -volname FigCraft -srcfolder "$stage" \
|
||||
-format UDZO -imagekey zlib-level=9 "$image"
|
||||
}
|
||||
|
||||
# Check the finished, read-only image and a normal installation copy, without repairing either.
|
||||
# Integrity is mandatory for ad-hoc builds too; notarization is checked only when requested.
|
||||
verify_dmg_app() (
|
||||
set -euo pipefail
|
||||
image="$1"
|
||||
notarized="${2:-0}"
|
||||
check_work="$(mktemp -d "${RUNNER_TEMP:-${TMPDIR:-/tmp}}/figcraft-dmg-check.XXXXXX")"
|
||||
mounted=0
|
||||
# Invoked by the EXIT trap, including failures under errexit. ShellCheck 0.9 calls the
|
||||
# nested callback unreachable (SC2317); 0.11 calls it unused (SC2329).
|
||||
# shellcheck disable=SC2317,SC2329
|
||||
cleanup_dmg_check() {
|
||||
local check_exit=$?
|
||||
trap - EXIT
|
||||
if [[ "$mounted" = 1 ]]; then
|
||||
if ! retry hdiutil detach "$check_work/mounted"; then
|
||||
echo "error: could not detach $check_work/mounted; leaving its directory intact" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
rm -rf "$check_work"
|
||||
exit "$check_exit"
|
||||
}
|
||||
trap cleanup_dmg_check EXIT
|
||||
mkdir -p "$check_work/mounted" "$check_work/copied"
|
||||
hdiutil attach -readonly -nobrowse -noautoopen -mountpoint "$check_work/mounted" "$image"
|
||||
mounted=1
|
||||
|
||||
check_app() {
|
||||
local app="$1"
|
||||
# Require the app directory itself, not a link to a signed app outside the image.
|
||||
if [[ -L "$app" || ! -d "$app" ]]; then
|
||||
echo "error: DMG has no FigCraft.app: $app" >&2
|
||||
return 1
|
||||
fi
|
||||
codesign --verify --deep --strict --verbose=2 "$app"
|
||||
if [[ "$notarized" = 1 ]]; then
|
||||
retry xcrun stapler validate "$app"
|
||||
retry spctl --assess --type execute -vvv "$app"
|
||||
fi
|
||||
}
|
||||
|
||||
check_app "$check_work/mounted/FigCraft.app"
|
||||
ditto "$check_work/mounted/FigCraft.app" "$check_work/copied/FigCraft.app"
|
||||
check_app "$check_work/copied/FigCraft.app"
|
||||
)
|
||||
@@ -16,6 +16,8 @@ set -euo pipefail
|
||||
# shellcheck source=../env.sh
|
||||
. "$(dirname "${BASH_SOURCE[0]}")/../env.sh"
|
||||
HERE="$ROOT/packaging/macos"
|
||||
# shellcheck source=dmg.sh
|
||||
. "$HERE/dmg.sh"
|
||||
|
||||
ARCH=universal
|
||||
SKIP_BUILD=0
|
||||
@@ -147,12 +149,7 @@ STAGE="$WORK/dmg"
|
||||
mkdir -p "$STAGE"
|
||||
ditto "$APP" "$STAGE/FigCraft.app"
|
||||
ln -s /Applications "$STAGE/Applications"
|
||||
rm -f "$DMG" "$WORK/raw.dmg"
|
||||
# makehybrid + convert builds the image without attaching a device, unlike `create -srcfolder`,
|
||||
# which is flaky on CI runners ("Resource busy") and hangs in sandboxed sessions.
|
||||
hdiutil makehybrid -hfs -hfs-volume-name "FigCraft" -hfs-openfolder "$STAGE" -o "$WORK/raw.dmg" "$STAGE"
|
||||
hdiutil convert "$WORK/raw.dmg" -format UDZO -imagekey zlib-level=9 -o "$DMG"
|
||||
rm -f "$WORK/raw.dmg"
|
||||
create_dmg "$STAGE" "$DMG"
|
||||
sign "$DMG"
|
||||
codesign --verify --strict --verbose=2 "$DMG"
|
||||
if [[ "$NOTARIZE" = 1 ]]; then
|
||||
@@ -162,6 +159,8 @@ if [[ "$NOTARIZE" = 1 ]]; then
|
||||
spctl --assess --type open --context context:primary-signature -vvv "$DMG"
|
||||
fi
|
||||
|
||||
verify_dmg_app "$DMG" "$NOTARIZE"
|
||||
|
||||
# ---- CLI ---------------------------------------------------------------------------------------
|
||||
if [[ "$HAS_CLI" = 1 ]]; then
|
||||
echo "==> building $CLI_ZIP"
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
set -euo pipefail
|
||||
# shellcheck source=../env.sh
|
||||
. "$(dirname "${BASH_SOURCE[0]}")/../env.sh"
|
||||
# shellcheck source=dmg.sh
|
||||
. "$ROOT/packaging/macos/dmg.sh"
|
||||
|
||||
ARCH=universal
|
||||
while [[ $# -gt 0 ]]; do
|
||||
@@ -135,15 +137,17 @@ if [[ "$STRICT" = 1 ]]; then
|
||||
|| fail "Gatekeeper rejects the DMG"
|
||||
fi
|
||||
|
||||
verify_dmg_app "$DMG" "$STRICT"
|
||||
|
||||
if [[ "$FAILED" != 0 ]]; then
|
||||
echo "error: macOS artifacts failed verification" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$STRICT" = 1 ]]; then
|
||||
result="signed (Developer ID, hardened runtime), notarized; DMG stapled"
|
||||
result="signed (Developer ID, hardened runtime), notarized; DMG stapled; enclosed/copied app verified"
|
||||
else
|
||||
result="signature intact; Developer ID and notarization not required (no signing secrets)"
|
||||
result="DMG and enclosed/copied app signatures intact; Developer ID and notarization not required (no signing secrets)"
|
||||
fi
|
||||
echo "==> verified: $result"
|
||||
if [[ -n "${GITHUB_STEP_SUMMARY:-}" ]]; then
|
||||
|
||||
Reference in new issue
Block a user