Skip to content
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

deployclient: add support for auto-renewing github tokens #296

Merged
merged 3 commits into from
Mar 21, 2025

Conversation

tronghn
Copy link
Contributor

@tronghn tronghn commented Mar 20, 2025

Fixes #229.

@tronghn tronghn requested a review from Copilot March 20, 2025 08:00
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request adds support for auto-renewing GitHub tokens by introducing a new interceptor and updating configuration and connection logic.

  • Added a GitHubTokenInterceptor in the gRPC auth package to automatically fetch and renew tokens.
  • Updated configuration flags to deprecate the old GitHub token and add separate fields for the token URL and bearer token.
  • Modified the gRPC connection setup to select the appropriate interceptor based on available GitHub authentication parameters.

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
pkg/grpc/interceptor/auth/client.go Introduces GitHubTokenInterceptor with token renewal logic.
pkg/deployclient/config.go Renames GithubToken to GitHubToken and adds new config flags for token URL and bearer token.
pkg/deployclient/grpc.go Updates interceptor selection based on new GitHub token fields.
Files not reviewed (1)
  • actions/deploy/entrypoint.sh: Language not supported
Comments suppressed due to low confidence (1)

pkg/grpc/interceptor/auth/client.go:130

  • [nitpick] Consider renaming variable 'j' to a more descriptive name (e.g., 'parsedToken') to improve code clarity.
j, err := jwt.ParseString(tokenResponse.Token,

@tronghn tronghn requested a review from Copilot March 20, 2025 08:53

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request introduces support for auto-renewing GitHub tokens for deployments by adding a new interceptor and updating configuration and gRPC connection logic accordingly.

  • Added a GitHubTokenInterceptor with token renewal support.
  • Updated configuration to favor new GitHub token URL and bearer token flags.
  • Modified gRPC connection initialization to prioritize the new token mechanism over the legacy token.

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.

File Description
pkg/grpc/interceptor/auth/client.go Introduces GitHubTokenInterceptor with auto-renewal logic.
pkg/deployclient/config.go Renames and adds config flags to support new token authentication.
pkg/deployclient/grpc.go Updates gRPC connection setup to use new GitHub token authentication.
Files not reviewed (1)
  • actions/deploy/entrypoint.sh: Language not supported
Comments suppressed due to low confidence (2)

pkg/grpc/interceptor/auth/client.go:132

  • [nitpick] Skipping JWT signature verification can expose potential security risks if tokens are used beyond simple expiration checks. Consider documenting the security implications or ensuring that signature verification is performed in environments where it is necessary.
// Skip signature verification; we only care about the expiration time here.

pkg/deployclient/grpc.go:26

  • [nitpick] When both new and legacy GitHub token configurations are provided, the new mechanism takes precedence. Consider adding an inline comment to clarify this precedence for future maintainers.
if cfg.GitHubBearerToken != "" && cfg.GitHubTokenURL != "" {
@tronghn tronghn merged commit 61731a8 into master Mar 21, 2025
11 checks passed
@tronghn tronghn deleted the renew-github-tokens branch March 21, 2025 07:33
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.

actions/deploy: authentication token may expire before wait timeout
1 participant