Sync eng/common directory with azure-sdk-tools for PR 13875#45038
Open
Sync eng/common directory with azure-sdk-tools for PR 13875#45038
Conversation
The eng/common/scripts/login-to-github.ps1 script was failing because it was using the standard Base64 encoded
signature returned by Azure Key Vault directly in the JWT, instead of converting it to Base64URL format (which
replaces + with -, / with _, and removes trailing =).
I have fixed the script by adding the necessary character replacements and also added a 10-second clock skew buffer
to the iat (issued at) claim to ensure validity.
The script now runs successfully and logs in as azure-sdk-automation[bot].
Changes made:
- Modified eng/common/scripts/login-to-github.ps1:
- Converted the signature from Azure Key Vault to Base64URL format.
- Subtracted 10 seconds from the iat claim to account for potential clock skew.
Verification:
- Ran the script and confirmed it successfully resolved the installation ID for "Azure" and obtained an access
token.
- gh auth status output confirms successful login.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR syncs the eng/common directory with azure-sdk-tools PR #13875, updating the GitHub authentication script to fix JWT token generation issues.
Changes:
- Refactored
Base64UrlEncodefunction to handle both raw strings and pre-encoded base64 strings - Added 10-second clock skew tolerance to JWT issued-at timestamp
- Fixed signature encoding to properly handle Azure Key Vault's base64-encoded signature output
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sync eng/common directory with azure-sdk-tools for PR Azure/azure-sdk-tools#13875 See eng/common workflow