You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 21, 2022. It is now read-only.
When URL is github.com it uses GITHUB_TOKEN token, and if gitlab.com uses GITLAB_TOKEN token
OR
Have one generic GIT_AUTH_TOKEN used for authentications (with warning its always used for all connections)
OR
Provide GIT_AUTH_TOKEN array and all tokens be checked/matched for access
Actual Behavior
Regardless of URL if GITHUB_TOKEN is set its always used, always auth is returned.
// Otherwise we check if a GitLab token was provided
gitlabToken:=os.Getenv("GITLAB_TOKEN")
ifgitlabToken!="" {
auth=&http.BasicAuth{
Username: gitUsername,
Password: gitlabToken,
}
returnauth
}
// If no token was provided, we simply return a nil,
// which will make the request to be unauthenticated
returnnil
Steps to Reproduce the Problem
Set dummy/real GITHUB_TOKEN ( export GITHUB_TOKEN="ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
Set real GITLAB_TOKEN ( export GITLAB_TOKEN="glpat-xxxxxxxxxxxxxxxxxxxx" )
Run remote repo scanning in trivy or any other tool using this library ( trivy repo https://gitlab.com/private-organization/private-repo or trivy repo https://gitlab.com/gitlab-org/gitlab )
Expected Behavior
When URL is
github.com
it usesGITHUB_TOKEN
token, and ifgitlab.com
usesGITLAB_TOKEN
tokenOR
Have one generic
GIT_AUTH_TOKEN
used for authentications (with warning its always used for all connections)OR
Provide
GIT_AUTH_TOKEN
array and all tokens be checked/matched for accessActual Behavior
Regardless of URL if
GITHUB_TOKEN
is set its always used, always auth is returned.fanal/artifact/remote/git.go
Lines 111 to 132 in f400923
Steps to Reproduce the Problem
GITHUB_TOKEN
(export GITHUB_TOKEN="ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
)GITLAB_TOKEN
(export GITLAB_TOKEN="glpat-xxxxxxxxxxxxxxxxxxxx"
)trivy repo https://gitlab.com/private-organization/private-repo
ortrivy repo https://gitlab.com/gitlab-org/gitlab
)git error: authentication required
Specifications
The text was updated successfully, but these errors were encountered: