Skip to content

fix(gcp-secret-get): handle multiline field values (jwt_key) - #35

Merged
gambe94 merged 1 commit into
mainfrom
fix/gcp-secret-get-multiline-values
Aug 20, 2026
Merged

fix(gcp-secret-get): handle multiline field values (jwt_key)#35
gambe94 merged 1 commit into
mainfrom
fix/gcp-secret-get-multiline-values

Conversation

@gambe94

@gambe94 gambe94 commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • The export step previously wrote every field as NAME=value appended to $GITHUB_ENV. That format is only valid for single-line values — jwt_key is a multi-line PEM, so writing it that way corrupted $GITHUB_ENV (subsequent lines got parsed as bogus separate declarations).
  • Every field now uses $GITHUB_ENV's documented multiline heredoc form (NAME<<DELIM / value / DELIM) with a random per-field delimiter, uniformly for all fields (simpler than branching on single- vs multi-line).
  • Masking also moves to per-line (::add-mask:: on each non-empty line of a value), since log masking matches per line — masking a multi-line blob as one token wouldn't reliably redact its individual lines elsewhere in the log.
  • Verified locally (see PR description on feat(sf-org-login): add credential-source gcp, via new gcp-secret-get action #33 pattern) that this produces exactly the documented $GITHUB_ENV multiline format before pushing.

Second bug from the same live run that caught #34 (export_to_environment) — that fix got past the "secret is empty" guard, then the JWT login step rejected the decoded key with "not a PEM private key". This is the actual root cause.

Test plan

  • actionlint clean
  • Local simulation of the export script against a fake multi-line SECRET_JSON, confirmed exact NAME<<DELIM/value/DELIM output
  • npm run all — unaffected, all green via pre-push hook
  • This PR's CI
  • Third re-run of setup-external-app.yml against devhub once this lands and @v2 moves

🤖 Generated with Claude Code

…redoc form

The naive NAME=value append corrupts $GITHUB_ENV the moment a field's value
contains an embedded newline -- jwt_key is a multi-line PEM. Every field now
goes through the NAME<<DELIM / value / DELIM form with a random per-field
delimiter, and each non-empty line of a value is masked individually rather
than masking the whole multi-line blob as one token (log masking matches
per line).

Caught by the second real end-to-end run of sf-org-login's gcp branch: the
prior export_to_environment fix got past the empty-secret guard, but the
JWT login step then rejected the decoded key with "not a PEM private key" --
verified locally that this fix produces the exact documented GITHUB_ENV
multiline format before pushing.
@gambe94
gambe94 merged commit 63bda00 into main Aug 20, 2026
2 checks passed
@gambe94
gambe94 deleted the fix/gcp-secret-get-multiline-values branch August 20, 2026 17:22
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.

1 participant