Skip to content

[app_store_connect_api_key] Trim key_id / issuer_id to prevent malformed JWT claims#29986

Merged
iBotPeaches merged 3 commits into
masterfrom
copilot/fix-strip-whitespace-key-id-issuer-id
Apr 30, 2026
Merged

[app_store_connect_api_key] Trim key_id / issuer_id to prevent malformed JWT claims#29986
iBotPeaches merged 3 commits into
masterfrom
copilot/fix-strip-whitespace-key-id-issuer-id

Conversation

Copilot AI commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

app_store_connect_api_key was forwarding key_id and issuer_id verbatim into token creation, so trailing whitespace/newlines (common from env vars/secrets copy-paste) could produce invalid JWT kid/iss values and opaque 401 auth failures. This change normalizes those inputs at action boundary and covers nil behavior explicitly.

  • Action input normalization

    • Updated AppStoreConnectApiKeyAction.run to strip surrounding whitespace from key_id and issuer_id.
    • Uses nil-safe handling so unset values remain nil (important for individual API key flows where issuer_id can be absent).
  • Spec coverage for regression-prone cases

    • Added a spec that verifies surrounding whitespace (including trailing newline/tab) is removed before calling Spaceship::ConnectAPI::Token.create.
    • Added a spec that verifies nil key_id / issuer_id are preserved as nil.
key_id = options[:key_id]&.strip
issuer_id = options[:issuer_id]&.strip

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • coveralls.io
    • Triggering command: /usr/bin/ruby3.2 ruby3.2 /home/REDACTED/work/fastlane/fastlane/vendor/bundle/ruby/3.2.0/bin/rspec fastlane/spec/actions_specs/app_store_connect_api_key_spec.rb --gdwarf-5 --64 -o ossl_x509ext.o /tmp/cchFN1Yj.s -I kward -I y-3.2.0 -I by-3.2.0 -I kward -I y-3.2.0 -I x86_64-linux-gnu-I (dns block)
    • Triggering command: /usr/bin/ruby3.2 ruby3.2 /home/REDACTED/work/fastlane/fastlane/vendor/bundle/ruby/3.2.0/bin/rspec fastlane/spec/actions_specs/app_store_connect_api_key_spec.rb -quiet -sha�� -o ruby-3.2.0 ackward crc32_xfer_ext.oas y-3.2.0/ruby/bac-I -L/usr/lib/x86_6. y-3.2.0 -I by-3.2.0 -I kward -I y-3.2.0 -I as (dns block)
    • Triggering command: /usr/bin/ruby3.2 ruby3.2 /home/REDACTED/work/fastlane/fastlane/vendor/bundle/ruby/3.2.0/bin/rspec fastlane/spec/actions_specs/app_store_connect_api_key_spec.rb as -I by-3.2.0 -I kward -I y-3.2.0 -I /usr/bin/ld -plu�� by-3.2.0 /libexec/gcc/x86_64-linux-gnu/13ossl_pkcs7.o kward s-through=-lgcc s-through=-lgcc_-c s-through=-lc s-through=-lgcc (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

fixes: #29985

Copilot AI changed the title [WIP] Fix whitespace handling for key_id and issuer_id in app_store_connect_api_key Trim key_id / issuer_id in app_store_connect_api_key to prevent malformed JWT claims Apr 22, 2026
Copilot AI requested a review from iBotPeaches April 22, 2026 09:47
@iBotPeaches iBotPeaches marked this pull request as ready for review April 22, 2026 10:06
@iBotPeaches iBotPeaches changed the title Trim key_id / issuer_id in app_store_connect_api_key to prevent malformed JWT claims [app_store_connect_api_key] Trim key_id / issuer_id to prevent malformed JWT claims Apr 22, 2026
@iBotPeaches iBotPeaches merged commit af5d8bd into master Apr 30, 2026
14 checks passed
@iBotPeaches iBotPeaches deleted the copilot/fix-strip-whitespace-key-id-issuer-id branch April 30, 2026 00:05

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey @Copilot 👋

Thank you for your contribution to fastlane and congrats on getting this pull request merged 🎉
The code change now lives in the master branch, however it wasn't released to RubyGems yet.
We usually ship about once a month, and your PR will be included in the next one.

Please let us know if this change requires an immediate release by adding a comment here 👍
We'll notify you once we shipped a new release with your changes 🚀"

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Congratulations! 🎉 This was released as part of fastlane 2.234.0 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

app_store_connect_api_key should strip whitespace from key_id / issuer_id

3 participants