Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

P-E-Meunier
Copy link

Motivation

The current implementation of the access-tokens directive in nix.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 of github:.

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.

@P-E-Meunier P-E-Meunier requested a review from edolstra as a code owner December 4, 2024 12:06
@github-actions github-actions bot added the fetching Networking with the outside (non-Nix) world, input locking label Dec 4, 2024
@@ -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));
Copy link
Member

@Mic92 Mic92 Dec 6, 2024

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@Mic92 Mic92 Dec 6, 2024

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.

Copy link
Member

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.

Copy link
Member

@Mic92 Mic92 Dec 6, 2024

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?

Copy link
Author

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?

Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fetching Networking with the outside (non-Nix) world, input locking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants