-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Missing credentials when attempting to install dependency from private Gitlab project #5955
Comments
Bump this one, #5567 doesn't really solve the issue - as mentioned above, it works only when using |
My post on the linked PR (please don't start discussion there where it is hard to find and tangential):
|
In general, imho that comment from @abn: #2062 (comment) is pretty reasonable here - so don't recommend that, maybe even provide some warning, but anyway - simply don't block people from doing that. It was also nicely summed up by @xinbinhuang here: #2062 (comment). |
The direction we're going is pretty firmly against leaking credentials in the lockfile/distfiles: #3995 is likely going in to 1.3. I'm unclear on what the workflow is, but it sounds like you may be part of a large organization where you can generate deploy tokens or use user credentials to access repos, but you cannot have them add SSH deploy keys or upload to a registry? In that case I'd suggest use of gitcredentials, which pip should support during install. I am still not sure of any use case where credentials in the lockfile/distfiles are the only solution, but please let me know if there's a situation where it's not usable. I firmly believe secrets should be kept in your CI server/deployment tooling and not in your repo/artifacts where they can be leaked easily. |
My point is - even if we don't allow to provide tokens via Personally - I really believe the warning message, maybe even with some note like |
@neersighted You're correct in that I work for a large organization where it can be difficult to get packages uploaded to a private registry (additional CI logic/maintenance). Using deploy keys may be a simpler option, but would require working with each dependent project to accept said key as alluded to by @jaklan. I will look into the gitcredentials route as an alternative in the meantime. |
I do agree that the ask -- letting Poetry validate URLs with your credentials in them is simple. However, there is a reason we haven't fixed this long-standing bug and instead have added more alternatives -- you may be comfortable embedding secrets into your repository/history/build artifacts, but the fact that these files are sensitive (when with other projects/ecosystems they are not) violates the element of least surprise. An explicit gitcredentials or other alternatives (env vars for I think there is room to improve the docs here (e.g. adding a FAQ entry about how to handle private Git deps if you cannot use the preferred alternative of a registry), as well as food for thought for the PR warning on credentials in the lockfile (eventually, we want to make it an error) -- but I don't think making it easier to embed credentials (or encouraging its use) as it currently stands does anything to improve the situation. It may make your specific use case easier, but I am very worried that wider adoption of such a workflow is a footgun for the whole ecosystem. |
Do you really think simply non-failing
Fully agree, I would say even more - it's just crucial here. If you really want to change people mindset, extensive docs would be much more beneficial than just blocking people of doing sth without any obvious alternative (how much people would think about Having that, we would be able to utilise it in a warning / error message when trying to run How I personally would imagine the roadmap here:
and then, if you really decide to make it an error one day:
Imho such a workflow allows you to achieve the final goal, but it also takes into account users' perspective (and emotions) and make the "mindset changing" simply easier to introduce, without unnecessary irritation or even frustration. |
I've confirmed that using gitcredentials (by running additional git commands in my Dockerfile to build the gitcredentials file) works and allows the downstream pip/poetry calls to access the private repo. So this is a workaround, albeit a not particularly graceful one. The deploy token is stored in the Dockerfile (this could be moved to a CI variable, though local non-CI builds would still need this provided from somewhere), though I suppose this is no different than having it stored in |
@cbuffett have you tried with envars? |
-vvv
option).Issue
I have a package I'm using poetry to build and version. This private package has a dependency on another private package in a different repo. This other private package is not published to a package registry, so in order to access it, I've set up basic HTTP credentials to the git project directly (as recommended in #5567)
This works fine when building/installing the package locally using
poetry build
andpoetry install
. However, when attempting to install my package as a dependency in an Airflow Docker image, the install of the private package fails due to missing authentication credentials. I'm using pip to install my package inside the Docker image, so it doesn't appear to have any notion of the Poetry credentials that were configured locally when building the package.I've tried setting environment variables (POETRY_HTTP_BASIC_GITLAB_USERNAME/POETRY_HTTP_BASIC_GITLAB_PASSWORD) for my private repo inside the Dockerfile, but this seems to be ignored by pip. I've tried hardcoding the private repo deploy_token/password in the git URL inside pyproject.toml, but this results in an error saying the git URL is invalid when attempting to build the package
This appears somewhat related to #2062. While the pre-release fix (#5567) seems to address the issue of supporting deploy tokens when adding HTTP basic authentication credentials for private gitlab projects, the absence of these credentials in the dependency URL itself prevents pip from accessing the package.
The text was updated successfully, but these errors were encountered: