Skip to content

Commit 24fbe58

Browse files
committed
Protect release credentials with environment scope
1 parent 901bf7b commit 24fbe58

3 files changed

Lines changed: 19 additions & 5 deletions

File tree

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ concurrency:
1515
jobs:
1616
release:
1717
name: Sign, notarize, and draft release
18+
environment: release
1819
runs-on: macos-15
1920
timeout-minutes: 45
2021

@@ -51,14 +52,13 @@ jobs:
5152
env:
5253
CERTIFICATE_P12_BASE64: ${{ secrets.APPLE_DEVELOPER_ID_CERTIFICATE_P12_BASE64 }}
5354
CERTIFICATE_PASSWORD: ${{ secrets.APPLE_DEVELOPER_ID_CERTIFICATE_PASSWORD }}
54-
KEYCHAIN_PASSWORD: ${{ secrets.APPLE_KEYCHAIN_PASSWORD }}
5555
shell: bash
5656
run: |
5757
set -euo pipefail
5858
: "${CERTIFICATE_P12_BASE64:?Missing APPLE_DEVELOPER_ID_CERTIFICATE_P12_BASE64 secret}"
5959
: "${CERTIFICATE_PASSWORD:?Missing APPLE_DEVELOPER_ID_CERTIFICATE_PASSWORD secret}"
60-
: "${KEYCHAIN_PASSWORD:?Missing APPLE_KEYCHAIN_PASSWORD secret}"
6160
61+
KEYCHAIN_PASSWORD="$(openssl rand -base64 32)"
6262
keychain="$RUNNER_TEMP/pinative-signing.keychain-db"
6363
certificate="$RUNNER_TEMP/developer-id.p12"
6464
echo "$CERTIFICATE_P12_BASE64" | base64 --decode > "$certificate"

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## 2026-09-02
4+
5+
6+
### Changed
7+
8+
- Scoped official release credentials to a dedicated GitHub environment and replaced the stored temporary-keychain password with a fresh per-run value.
9+
310
## 2026-09-01
411

512

docs/releasing.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ when access is no longer required.
4141

4242
## GitHub Actions configuration
4343

44+
Create a GitHub Actions environment named `release`. The official release job
45+
declares this environment so signing and notarization credentials are unavailable
46+
to pull-request and routine CI jobs. Restrict the environment to protected release
47+
tags matching `v*`; optionally require maintainer approval before deployment.
48+
4449
Add the following **Actions repository variable**. It identifies the signing
4550
team and is not confidential, but keeping it out of the repository lets a fork
4651
or new maintainer configure its own release identity.
@@ -49,19 +54,21 @@ or new maintainer configure its own release identity.
4954
| --- | --- |
5055
| `APPLE_TEAM_ID` | Apple Team ID that owns the Developer ID certificate. |
5156

52-
Add the following **Actions secrets** to the repository. Never add their values
53-
to tracked files, workflow logs, issue comments, or release notes.
57+
Add the following **environment secrets** to the `release` environment. Never add
58+
their values to tracked files, workflow logs, issue comments, or release notes.
5459

5560
| Secret | Value |
5661
| --- | --- |
5762
| `APPLE_DEVELOPER_ID_CERTIFICATE_P12_BASE64` | Base64 encoding of the Developer ID `.p12` file. |
5863
| `APPLE_DEVELOPER_ID_CERTIFICATE_PASSWORD` | Password used when exporting that `.p12`. |
59-
| `APPLE_KEYCHAIN_PASSWORD` | Newly generated, high-entropy temporary-keychain password. |
6064
| `APPLE_NOTARY_API_KEY_ID` | App Store Connect API Key ID. |
6165
| `APPLE_NOTARY_API_ISSUER_ID` | App Store Connect API Issuer ID. |
6266
| `APPLE_NOTARY_API_KEY_P8_BASE64` | Base64 encoding of the downloaded `.p8` private key. |
6367
| `POSTHOG_PROJECT_API_KEY` | PostHog `phc_` project token used by official builds for opt-in product analytics. |
6468

69+
The workflow generates a fresh high-entropy password for its temporary keychain
70+
during every run; no keychain-password secret is stored.
71+
6572
On macOS, copy a file’s Base64 value without saving another credential file:
6673

6774
```sh

0 commit comments

Comments
 (0)