-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Allowing tokens on non-gitlab/github/srht git repos #12006
base: master
Are you sure you want to change the base?
Conversation
@@ -29,7 +29,9 @@ std::regex hostRegex(hostRegexS, std::regex::ECMAScript); | |||
|
|||
struct GitArchiveInputScheme : InputScheme | |||
{ | |||
virtual std::optional<std::pair<std::string, std::string>> accessHeaderFromToken(const std::string & token) const = 0; | |||
virtual std::optional<std::pair<std::string, std::string>> accessHeaderFromToken(const std::string & token) const { | |||
return std::pair<std::string, std::string>("Authorization", fmt("Bearer %s", token)); |
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.
Do we know which type of git hosters/software support this scheme? This works with github and who else?
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.
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.
Ok. This seems common enough. Also because it seems to be related to oauth2.
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.
We can also remove accessHeaderFromToken
from SourceHut in this case.
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.
So what I am wondering is that you mentioned this would help with git+https
. But I don't think this implementation is used for the git input scheme and all the other input types in this pull request are already handled. So which case did you fix here?
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.
Ok, so I get a clearer picture: where is the handler for git+https
?
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.
fetchTree.cc
is what you are looking for.
Motivation
The current implementation of the
access-tokens
directive innix.conf
doesn't obey its documentation nor the intuition behind it: indeed, while the docs mention "or other locations", in practice there are custom implementations for GitHub, GitLab and Sr.ht, while other providers aren't handled.This causes flakes to fail authenticating when using the
git+https:
scheme instead ofgithub:
.This fix only adds a default implementation.
Context
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.