Skip to content

fix: unset empty App Store Connect API key issuer ID - #117

Merged
jmarek41 merged 1 commit into
mainfrom
feature/unset-empty-issuer-id
Aug 13, 2026
Merged

fix: unset empty App Store Connect API key issuer ID#117
jmarek41 merged 1 commit into
mainfrom
feature/unset-empty-issuer-id

Conversation

@jmarek41

@jmarek41 jmarek41 commented Aug 13, 2026

Copy link
Copy Markdown
Member

Problem

Releases using an individual App Store Connect API key fail on the first ASC call with Authentication credentials are missing or invalid.

2.4.4 (#115) made the issuer ID optional only in the input/secret declarations — both actions still set the env var unconditionally, so an omitted secret reaches fastlane as "" rather than absent. "" is truthy in Ruby, so spaceship takes the team-key branch and signs iss: "" instead of the individual-key sub: "user". Apple rejects that token.

Reproduced on fastlane 2.237.0:

issuer_id=""  -> iss=""  sub=nil
issuer_id=nil -> iss=nil sub="user"

Fix

Unset the variable in beta.sh and release.sh when it is empty or whitespace-only (fastlane's own .strip would collapse a padded value back to ""). unset rather than a conditional export, so a stale value in the self-hosted runner environment can't leak in.

These two scripts are the only place the variable reaches fastlane, so this covers all seven affected workflows — the release ones via ios-fastlane-release, the build/nightly and KMP ones via ios-fastlane-beta (KMP through ios-kmp-build).

Tests

Empty / whitespace-only / valid per action, asserting on the environment the mocked bundle exec actually sees. 24 pass; the two negative cases were confirmed to fail without the fix.

Note

Necessary regardless, but only sufficient if the key really is an Individual Key (that page in ASC shows no Issuer ID). A Team Key produces the identical 401 and needs the issuer secret supplied instead.

Needs a 2.4.5 tag + ref bump as the usual follow-up.

🤖 Generated with Claude Code

Making the issuer ID optional in 2.4.4 only relaxed the input and secret
declarations. Both composite actions still set the env var unconditionally,
so an omitted secret reaches fastlane as "" rather than being absent.

Ruby treats "" as truthy, so spaceship takes the team-key branch in
ConnectAPI::Token#refresh! and signs a JWT with iss: "" instead of the
individual-key sub: "user". Apple rejects it with "Authentication
credentials are missing or invalid", failing the release on the first
App Store Connect call.

Unset the variable when it is empty or whitespace-only, so fastlane sees
it as absent and signs an individual-key token. Whitespace is stripped
first because fastlane's own .strip would collapse a padded value back
to "" and hit the same branch.

Fixing beta.sh and release.sh covers every affected workflow:
ios-selfhosted-release and ios-kmp-selfhosted-release use
ios-fastlane-release; ios-selfhosted-nightly-build and
ios-selfhosted-on-demand-build use ios-fastlane-beta;
ios-kmp-selfhosted-build and kmp-combined-nightly-build reach
ios-fastlane-beta through ios-kmp-build; ios-selfhosted-build is a
deprecated shim over ios-selfhosted-nightly-build.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@jmarek41
jmarek41 force-pushed the feature/unset-empty-issuer-id branch from 6d91b50 to 5c9b0b5 Compare August 13, 2026 09:19
@jmarek41
jmarek41 requested review from janpollak and ssestak August 13, 2026 09:27
@jmarek41
jmarek41 enabled auto-merge August 13, 2026 09:27
@jmarek41
jmarek41 merged commit 6082306 into main Aug 13, 2026
2 checks passed
@jmarek41
jmarek41 deleted the feature/unset-empty-issuer-id branch August 13, 2026 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants