-
Notifications
You must be signed in to change notification settings - Fork 293
*: bump jwt (#12343) #12346
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
base: release-7.1
Are you sure you want to change the base?
*: bump jwt (#12343) #12346
Conversation
Signed-off-by: ti-chi-bot <[email protected]>
|
This cherry pick PR is for a release branch and has not yet been approved by triage owners. To merge this cherry pick:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
@wk989898 This PR has conflicts, I have hold it. |
|
@ti-chi-bot: ## If you want to know how to resolve it, please read the guide in TiDB Dev Guide. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Summary of ChangesHello @ti-chi-bot, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a new OAuth2 server component, which is crucial for handling authentication and authorization flows. Concurrently, it updates various Go module dependencies across the project, ensuring that the system benefits from the latest features, bug fixes, and security patches, particularly for the JWT and OAuth2 related libraries. This change aims to enhance the project's authentication capabilities and maintain up-to-date external library usage. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request aims to update JWT dependencies and introduces a new OAuth2 server, likely for testing purposes. However, the go.mod and go.sum files contain merge conflict markers, which is a critical issue that will break the build and must be resolved. Additionally, the new server implementation in cmd/oauth2-server/main.go has some issues, including a misconfigured command-line flag, a potential security weakness, and incorrect usage of the http.ResponseWriter API. My review includes suggestions to fix these problems.
| <<<<<<< HEAD | ||
| github.com/aws/aws-sdk-go v1.44.259 | ||
| ======= | ||
| github.com/apache/pulsar-client-go v0.13.0 | ||
| github.com/aws/aws-sdk-go v1.55.5 | ||
| github.com/aws/aws-sdk-go-v2 v1.38.1 | ||
| github.com/aws/aws-sdk-go-v2/config v1.27.37 | ||
| github.com/aws/aws-sdk-go-v2/credentials v1.17.35 | ||
| >>>>>>> 4b7fe4b517 (*: bump jwt (#12343)) |
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.
| "SJhX36_KapYSybBtJq35lxX_Brr4LRURSkm7QmXJGmy8pUFW9EIOcVQPsykz9-jj", "Secret to sign token") | ||
| cmd.Flags().StringVar(&serverConfig.clientID, "client-id", "1234", "Client ID of oauth2") | ||
| cmd.Flags().StringVar(&serverConfig.clientSecret, "client-secret", "e0KVlA2EiBfjoN13olyZd2kv1KL", "Client secret of oauth2") | ||
| cmd.Flags().IntVar(&serverConfig.port, "log-file", 9096, "log file path") |
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.
The command-line flag for setting the server port is incorrectly named log-file and has a misleading description log file path. This should be corrected to avoid confusion and accurately reflect its purpose.
| cmd.Flags().IntVar(&serverConfig.port, "log-file", 9096, "log file path") | |
| cmd.Flags().IntVar(&serverConfig.port, "port", 9096, "Port for the server to listen on") |
| manager.MapClientStorage(clientStore) | ||
|
|
||
| srv := server.NewDefaultServer(manager) | ||
| srv.SetAllowGetAccessRequest(true) |
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.
Allowing GET requests for access tokens (SetAllowGetAccessRequest(true)) is discouraged by the OAuth 2.0 specification (RFC 6749, Section 3.2). It can lead to access tokens being leaked via browser history, server logs, and referrer headers. It's recommended to only allow POST requests for the token endpoint by removing this line, as the default is false.
| _, _ = w.Write([]byte(fmt.Sprintf(openIDConfiguration, serverConfig.port, serverConfig.port, serverConfig.port))) | ||
| w.WriteHeader(200) |
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.
The WriteHeader function is called after Write. The first call to w.Write() implicitly sends a 200 OK status header, making the subsequent w.WriteHeader(200) call redundant and ineffective. The correct order is to set headers, then write the body. Also, it's good practice to set the Content-Type header for JSON responses.
| _, _ = w.Write([]byte(fmt.Sprintf(openIDConfiguration, serverConfig.port, serverConfig.port, serverConfig.port))) | |
| w.WriteHeader(200) | |
| w.Header().Set("Content-Type", "application/json") | |
| _, _ = w.Write([]byte(fmt.Sprintf(openIDConfiguration, serverConfig.port, serverConfig.port, serverConfig.port))) |
|
@ti-chi-bot: The following tests failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
This is an automated cherry-pick of #12343
What problem does this PR solve?
Issue Number: close #12340 ref #12249
What is changed and how it works?
Check List
Tests
Questions
Will it cause performance regression or break compatibility?
Do you need to update user documentation, design documentation or monitoring documentation?
Release note