-
Notifications
You must be signed in to change notification settings - Fork 5
🩹 [Patch]: Prevent Concurrent Access Token Refresh with Mutex Lock #393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
…evention Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
Copilot finished work on behalf of
MariusStorhaug
May 31, 2025 16:15
…move obsolete test file
- Created TEMPLATE.ps1 for structuring Pester tests with authentication cases. - Added Teams.Tests.ps1 to test GitHub Teams API functionalities, including team creation, retrieval, updating, and deletion. - Introduced Users.Tests.ps1 to validate user-related API calls, such as fetching user details and updating user information. - Implemented Variables.Tests.ps1 to cover GitHub repository and organization variable management, including setting, updating, and removing variables.
…nd streamline context resolution
…andling and streamlining conditions
…text resolution visibility
…ling and improve variable usage
…and adjust context resolution logic in Resolve-GitHubContext for improved token handling
… check for improved GitHub App login handling
…for improved GitHub App login handling
…or improved handling of secure strings
…bose flags for improved debugging output
…ensure proper conversion from plain text to SecureString
… for cleaner output and improved verbosity handling
… to prevent concurrent token refresh operations
…for simplified token refresh logic
…ssToken and improve mutex handling
…oken with improved error handling and mutex management
…x handling, timeout parameter, and refined token validity checks
…itHubContext and adjust return value in process block
…oved context retrieval in Update-GitHubUserAccessToken
…serAccessToken with improved validity checks and mutex handling
…rAccessToken to use current datetime for improved accuracy
… by directly accessing Context.AuthClientID
… calls in Update-GitHubUserAccessToken
…rAccessToken and improve token expiration checks in GitHubContext.Types
- Created TEMPLATE.ps1 for standardized test structure. - Implemented Teams.Tests.ps1 to validate GitHub Teams API functionalities, including team creation, retrieval, updating, and deletion. - Developed Users.Tests.ps1 to test user-related API calls, including user retrieval and updates. - Established Variables.Tests.ps1 to cover GitHub variable management, including setting, updating, and removing variables for users, organizations, and repositories. - Added necessary logging and context management for better test output and debugging. - Ensured compatibility with Pester version 5.7.1 and addressed known code analysis warnings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
…ct-GitHubAccount call in Auth tests
Module GitHub - 0.33.5 published to the PowerShell Gallery. |
GitHub release for GitHub v0.33.5 has been created. |
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.
This pull request introduces significant updates to the GitHub authentication and API handling mechanisms, improving token management, adding support for GitHub App private keys, and enhancing concurrency handling. The changes also include adjustments to data types and configurations for better precision and compatibility.
Authentication Updates
PrivateKey
property inAppGitHubContext
and ensuring it is securely processed during authentication.API Handling Improvements
Invoke-GitHubAPI
and centralized it in the context resolution process for better maintainability.Configuration and Type Adjustments
AccessTokenGracePeriodInHours
fromint
todouble
for increased precision in token expiration calculations.[datetime]::Now
instead ofGet-Date
for consistency across the module.