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

HTTP 407 error when using a git source #6485

Closed
3 tasks done
jakecoffman opened this issue Sep 12, 2022 · 8 comments
Closed
3 tasks done

HTTP 407 error when using a git source #6485

jakecoffman opened this issue Sep 12, 2022 · 8 comments
Labels
kind/bug Something isn't working as expected

Comments

@jakecoffman
Copy link

  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

Issue

Hi Poetry friends 👋

In Dependabot we're seeing an issue where when pyproject.toml contains a git source for a dependency we get a 407 Proxy Authentication Required. Dependabot uses a proxy that requires authentication to do updates. To reproduce the issue, I created https://github.com/dsp-testing/poetry-407 since it takes a bit of setup.

It seems that when the git source is present, Poetry loses the username and password to the proxy.

Let me know if you have other questions or I've left something out. Thanks!

@jakecoffman jakecoffman added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Sep 12, 2022
@dimbleby
Copy link
Contributor

if this is specifically a problem with git dependencies then probably it's a dulwich issue and wants reporting there.

Even better if you can create a standalone repro using dulwich code.

Looks like dulwich does have code to try to handle this - https://github.com/jelmer/dulwich/blob/3d4322c06fa79ddfff95e09dbc365b83d9b3f15b/dulwich/client.py#L1834. I could believe either that that's not working properly, or that poetry is somehow doing it wrong.

meanwhile you could try sidestepping dulwich and falling back to system git per https://python-poetry.org/docs/configuration/#experimentalsystem-git-client

@jakecoffman
Copy link
Author

meanwhile you could try sidestepping dulwich and falling back to system git

That's great to know! Dependabot will have to run this way since we have to force https. We do this with a shim to the system git.

I tried adding that setting to my repro and it still fails with a 407. I think that should eliminate dulwich as the problem? But also like I said we'll have to use the system git in Dependabot anyway.

Also I mentioned I tested this with previous versions (1.1.15) and it fails in the same way. It looks like dulwich was introduced in 1.2.0? We had reports of this happening back in January here and here.

@dimbleby
Copy link
Contributor

dimbleby commented Sep 12, 2022

well now - and in earlier releases - poetry should just be shelling out to git. So now you seem to have a question about how to get git to use http proxy.

I've no idea whether it respects those environment variables, I see that git has config settings for http.proxy, at this point I think you want to experiment with calling git directly and take poetry out of the equation altogether

@dimbleby
Copy link
Contributor

Just to confirm: I updated your repro so that script.sh ends with git clone https://github.com/uiri/toml and doesn't do anything poetry at all.

That sees the same output:

Cloning into 'toml'...
127.0.0.1:59226: client connect
127.0.0.1:59226: CONNECT github.com:443
              << 407 Proxy Authentication Required 129b

which seems to make clear that poetry is not introducing a problem here.

@jakecoffman
Copy link
Author

Yes I did the same thing! I think the repro isn't quite right and your analysis that it may be dulwich is correct.

I'm updating Dependabot to use Poetry's experimental.system-git-client feature which seems to have taken care of it locally for me.

Thanks for the help!

@dimbleby
Copy link
Contributor

No worries.

dulwich is reasonably active, if you do find the time to reproduce accurately they'd likely welcome the report.

@neersighted
Copy link
Member

I would encourage getting support into dulwich -- long-term we don't plan to keep the system-git-client option, but only after dulwich proves stable/feature complete for our uses.

@mkniewallner mkniewallner removed the status/triage This issue needs to be triaged label Sep 18, 2022
Copy link

github-actions bot commented Mar 1, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

4 participants