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

Support authentication #128

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

kyrofa
Copy link

@kyrofa kyrofa commented Apr 22, 2020

vcs_base.load_url() currently doesn't support authentication. Add support for both basic and token-based authentication by parsing netrc-formatted files. Use appdirs to support vcstool-specific authentication files for both the user and the system (user takes precedence).

@kyrofa
Copy link
Author

kyrofa commented Apr 23, 2020

Huh. I'm not sure what I'm doing wrong on the mock bits for earlier pythons.

@kyrofa
Copy link
Author

kyrofa commented Apr 23, 2020

Ah ha, it's an upstream python bug. All fixed now.

@kyrofa kyrofa force-pushed the feature/netrc-support branch 2 times, most recently from 7a1be83 to 042fc24 Compare April 23, 2020 22:29
@dirk-thomas
Copy link
Owner

Note that this borrows heavily from vcstools.

As discussed offline it needs to be double checked that this contribution complies with the license.

`vcs_base.load_url()` currently doesn't support authentication. Add
support for both basic and token-based authentication by parsing
netrc-formatted files. Use `appdirs` to support vcstool-specific
authentication files for both the user and the system (user takes
precedence).

Signed-off-by: Kyle Fazzari <[email protected]>
@kyrofa kyrofa changed the title Support authentication via netrc Support authentication May 18, 2020
@kyrofa
Copy link
Author

kyrofa commented May 18, 2020

Alright, this has been completely redesigned and rewritten from scratch. It does introduce the appdirs dependency, as discussed.

Copy link
Owner

@dirk-thomas dirk-thomas left a comment

Choose a reason for hiding this comment

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

Please add some documentation about the new auth files to the README.

(I haven't looked at the test code yet.)

vcstool/clients/vcs_base.py Outdated Show resolved Hide resolved
vcstool/clients/vcs_base.py Outdated Show resolved Hide resolved
vcstool/clients/vcs_base.py Outdated Show resolved Hide resolved
vcstool/clients/vcs_base.py Outdated Show resolved Hide resolved
.travis.yml Outdated Show resolved Hide resolved
@kyrofa
Copy link
Author

kyrofa commented May 26, 2020

Please add some documentation about the new auth files to the README.

Done in fc361a2, does that seem to be a sensible place to put it?

Copy link
Owner

@dirk-thomas dirk-thomas left a comment

Choose a reason for hiding this comment

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

I made a few minor edits myself but added some more questions / suggestions inline.

README.rst Outdated Show resolved Hide resolved
vcstool/clients/vcs_base.py Show resolved Hide resolved
if e.errno not in (errno.ENOENT, errno.EACCES):
raise
except netrc.NetrcParseError:
# If this file had issues, don't error out so we can try fallbacks
Copy link
Owner

Choose a reason for hiding this comment

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

Would a warning be more helpful to the user rather then silently ignoring it? On the other hand this behavior might match how other programs using .netrc work.

Copy link
Author

@kyrofa kyrofa Jun 15, 2020

Choose a reason for hiding this comment

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

We're a little bit in uncharted territory here, to be honest. My inspiration for the design is apt, but one generally runs that as root, so running into permissions issues accessing those files isn't normally an issue. It could be here, if the machine admin only wanted members of a particular group to be able to fetch repositories using these credentials. I had mixed feelings about warning about this or quietly proceeding, so I'm happy adding a warning if you like.

dirk-thomas and others added 3 commits June 10, 2020 22:25
@kyrofa
Copy link
Author

kyrofa commented Sep 3, 2020

Gentle ping here.

@kyrofa
Copy link
Author

kyrofa commented Oct 22, 2020

Hey @dirk-thomas, how are you feeling about this?

@0xjairo
Copy link

0xjairo commented Jan 11, 2022

@kyrofa / @dirk-thomas is there a reason why this MR was not accepted?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants