-
Notifications
You must be signed in to change notification settings - Fork 619
Avoid caching the credential, instead get the credential value whenever it is required through the request filter #1712
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
Avoid caching the credential, instead get the credential value whenever it is required through the request filter #1712
Conversation
|
|
Hi @arechavarria Thanks for the PR! But where is the item for the "Link to relevant issues in GitHub or Jira" you have indicated in the checklist that there is one? |
Hello, with pleasure I added the relationship with the issue: |
|
Hi @daniel-beck would it be able for you to take a look also and see if this PR would have any security issue(s) if merged as is? |
krisstern
left a comment
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.
I have a gut feeling we should be more careful about retricting any external use of the two methods concerned?
src/main/java/com/dabsquared/gitlabjenkins/connection/GitlabCredentialResolver.java
Show resolved
Hide resolved
src/main/java/com/dabsquared/gitlabjenkins/connection/GitlabCredentialResolver.java
Show resolved
Hide resolved
…edentialResolver.java Co-authored-by: Kris Stern <krisstern@outlook.com>
…edentialResolver.java Co-authored-by: Kris Stern <krisstern@outlook.com>
src/main/java/com/dabsquared/gitlabjenkins/connection/GitlabCredentialResolver.java
Show resolved
Hide resolved
src/main/java/com/dabsquared/gitlabjenkins/connection/GitlabCredentialResolver.java
Show resolved
Hide resolved
…edentialResolver.java Co-authored-by: Kris Stern <krisstern@outlook.com>
…edentialResolver.java Co-authored-by: Kris Stern <krisstern@outlook.com>
|
Hi @arechavarria I will let this PR sit here for 24 to 48 hours. If there is no objection from the community within that time frame, I will proceed to merge it. |
krisstern
left a comment
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.
LGTM
|
Thanks @krisstern |
|
@krisstern I ask you at what point the release is managed so that the plugin is available in the marketplace? |
|
Hi @arechavarria we have another PR #1713 pending to be merged soon. So we will need to wait until afterwards when a new release will be cut. |
Fixes #963.
Description
This pull request introduces a new
GitlabCredentialResolverclass to manage the retrieval of credentials for GitLab connections more centrally and securely within the Jenkins GitLab plugin. The previous logic for handling API tokens has been refactored out ofGitLabConnectionand related classes into this new resolver class, improving code readability and maintainability.Key changes include:
GitlabCredentialResolverclass to handle credential resolution based onItemcontext and credential IDs.GitLabClientBuilderand its implementations to accept aGitlabCredentialResolverinstead of a plain API token string.ApiHeaderTokenFilterto utilizeGitlabCredentialResolverfor injecting API tokens into HTTP requests.Testing done
GitlabCredentialResolver, ensuring they pass with the refactored code. This includes modifying tests likeAutodetectingGitLabClientTestandTestUtility.GitlabCredentialResolverproperly tracks credentials when associated with specific Jenkins items.PRIVATE_TOKENheader for both global and job-specific tokens.Submitter checklist