feat: add bearer token support for http sync.go#435
feat: add bearer token support for http sync.go#435husira wants to merge 4 commits intocarvel-dev:developfrom
Conversation
Signed-off-by: Raphael Husistein <raphael.husistein@hotmail.com>
joaopapereira
left a comment
There was a problem hiding this comment.
Hello,
Sorry for the very very late reply but this PR felt out of my radar :(
Thanks for creating this PR.
I have some comments that would like for you to address in order to move forward with this PR
Thanks
|
Hey @joaopapereira Thank you for the updates! I am currently traveling until mid-April. Therefore, I am unable to continue working on it at this time. @patrickmx, Do you find time to take a look at this? |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds Bearer-token authentication support for vendir sync HTTP fetches via secretRef, alongside existing HTTP Basic Auth, with validation to reject mixed/incomplete credentials.
Changes:
- Accept
tokenin HTTP auth secrets and setAuthorization: Bearer <token>. - Add stricter validation for basic-auth pairing (username/password) and disallow mixing with token auth.
- Introduce HTTP auth-focused unit tests (basic, bearer, and invalid combinations).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| pkg/vendir/fetch/http/sync.go | Adds bearer token support and credential validation in addAuth. |
| pkg/vendir/fetch/http/sync_test.go | Adds unit tests covering basic auth, bearer token, and invalid credential combinations. |
| pkg/vendir/config/data.go | Defines the token secret key constant used by HTTP auth. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
….go to keep the tests consistent through the project Signed-off-by: Raphael Husistein <raphael.husistein@hotmail.com>
Signed-off-by: Raphael Husistein <raphael.husistein@hotmail.com>
|
Hey @joaopapereira I'm back after a longer vacation :) Thank you again for the review! I have implemented the changes you suggested and tried to make the sync_test.go file consistent with other test files from the project. Could you please review my changes again? Thank you very much and I hope the PR can be merged soon. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This PR adds Bearer token authentication support to vendir sync (http) command:
In addition to existing HTTP Basic Auth (username / password), users can now authenticate using a Bearer token provided via secretRef.
Exactly one authentication method is allowed per secret:
• username + password → HTTP Basic Auth
• token → Authorization: Bearer
Mixed or incomplete credentials are rejected with clear validation errors.
We are using vendir to sync files from JFrog Artifactory. Our organization enforces authentication via access tokens instead of username/password. The authentication with JFrog Artifactory is implemented using Bearer tokens.
I could successfully test the implementation with our registry (JFrog Artifactory) using username/password or a Bearer token.