Skip to content

Commit 2e6a7c0

Browse files
committed
fix(release): protect CLI notarization keys before writing them
1 parent ffc3153 commit 2e6a7c0

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

‎.github/workflows/release-desktop.yml‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -429,9 +429,10 @@ jobs:
429429
extra_args=()
430430
if [[ "${{ inputs.platform }}" == "mac" ]]; then
431431
if [[ -n "${APPLE_API_KEY:-}" ]]; then
432-
key_path="$RUNNER_TEMP/AuthKey_cli_${APPLE_API_KEY_ID}.p8"
433-
printf '%s' "$APPLE_API_KEY" > "$key_path"
434-
trap 'rm -f "$key_path"' EXIT
432+
key_dir="$(mktemp -d "$RUNNER_TEMP/t3-cli-notary.XXXXXXXX")"
433+
trap 'rm -rf "$key_dir"' EXIT
434+
key_path="$key_dir/AuthKey.p8"
435+
(umask 077 && printf '%s' "$APPLE_API_KEY" > "$key_path")
435436
export APPLE_API_KEY="$key_path"
436437
fi
437438
# Older release refs lack deferred notarization and still wait here.
@@ -645,9 +646,10 @@ jobs:
645646
run: |
646647
set -euo pipefail
647648
if [[ -n "${APPLE_API_KEY:-}" ]]; then
648-
key_path="$RUNNER_TEMP/AuthKey_cli_${APPLE_API_KEY_ID}.p8"
649-
printf '%s' "$APPLE_API_KEY" > "$key_path"
650-
trap 'rm -f "$key_path"' EXIT
649+
key_dir="$(mktemp -d "$RUNNER_TEMP/t3-cli-notary.XXXXXXXX")"
650+
trap 'rm -rf "$key_dir"' EXIT
651+
key_path="$key_dir/AuthKey.p8"
652+
(umask 077 && printf '%s' "$APPLE_API_KEY" > "$key_path")
651653
export APPLE_API_KEY="$key_path"
652654
fi
653655
node scripts/build-cli-archive.ts await-notarization \

0 commit comments

Comments
 (0)