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

Store passwords in the system keychain #210

Closed
osteele opened this issue Jun 13, 2018 · 6 comments
Closed

Store passwords in the system keychain #210

osteele opened this issue Jun 13, 2018 · 6 comments
Labels
area/publishing Related to PyPI/PEP 503 publishing kind/feature Feature requests/implementations

Comments

@osteele
Copy link

osteele commented Jun 13, 2018

Poetry currently requires either that you store your PyPI password in plaintext (via poetry config http-basic.pypi username password), or enter it on each poetry publish. The first is insecure, the second is inconvenient.

I like what Flit does: store the password in Keyring if that package is installed, and prompt the user to install it otherwise. (Keyring uses the system keychain, e.g. Keychain on macOS, the Freedesktop Secret Service standard on supported UN*X, WinVault on Windows.)

This relates to #111.

@osteele
Copy link
Author

osteele commented Jun 13, 2018

I believe this could be implemented by replacing:

if not password:
    password = self._io.ask_hidden("Password:")

by something like:

if not password:
    try:
        import keyring
        if keyring.get_keyring():
            password = keyring.get_password(repository_name, username)
    except ImportError:
        print("Install keyring to store passwords securely")
        keyring = None

if not password:
    password = self._io.ask_hidden("Password:")
    if keyring and keyring.get_keyring():
        keyring.set_password(repository_name, username, password)

in poetry/poetry/masonry/publishing/publisher.py:Publisher.publish.

@jacebrowning
Copy link
Contributor

If this approach was taken, why not simply make keyring a dependency?

@osteele
Copy link
Author

osteele commented Jun 13, 2018

Yeah, that’s probably a better idea. Then it would be available when Poetry is installed via pipsi. I was copying the behavior of Flit, where it’s optional, but the advantages of doing it that way seem minor.

@sdispater sdispater added the area/publishing Related to PyPI/PEP 503 publishing label Oct 25, 2018
abn added a commit to abn/poetry that referenced this issue Jan 3, 2019
This change introduces the use of system keyring to store repository
passwords when one is available. Passwords are added to and removed from
the keyring using the config command.

Resolves: python-poetry#210
abn added a commit to abn/poetry that referenced this issue Jan 4, 2019
This change introduces the use of system keyring to store repository
passwords when one is available. Passwords are added to and removed from
the keyring using the config command.

Resolves: python-poetry#210
abn added a commit to abn/poetry that referenced this issue Jan 4, 2019
This change introduces the use of system keyring to store repository
passwords when one is available. Passwords are added to and removed from
the keyring using the config command.

Resolves: python-poetry#210
abn added a commit to abn/poetry that referenced this issue Jan 4, 2019
This change introduces the use of system keyring to store repository
passwords when one is available. Passwords are added to and removed from
the keyring using the config command.

Resolves: python-poetry#210
@abn
Copy link
Member

abn commented Jan 4, 2019

@jacebrowning @osteele I have attempted an implementation using keyring in #774 . Would be great to get the change tested on different platforms.

abn added a commit to abn/poetry that referenced this issue Jan 15, 2019
This change introduces the use of system keyring to store repository
passwords when one is available. Passwords are added to and removed from
the keyring using the config command.

Resolves: python-poetry#210
abn added a commit to abn/poetry that referenced this issue Jan 15, 2019
This change introduces the use of system keyring to store repository
passwords when one is available. Passwords are added to and removed from
the keyring using the config command.

Resolves: python-poetry#210
@flying-sheep flying-sheep mentioned this issue Feb 13, 2019
@sdispater sdispater added the kind/feature Feature requests/implementations label Mar 2, 2019
abn added a commit to abn/poetry that referenced this issue Apr 24, 2019
This change introduces the use of system keyring to store repository
passwords when one is available. Passwords are added to and removed from
the keyring using the config command.

Resolves: python-poetry#210
abn added a commit to abn/poetry that referenced this issue Apr 24, 2019
This change introduces the use of system keyring to store repository
passwords when one is available. Passwords are added to and removed from
the keyring using the config command.

Resolves: python-poetry#210
abn added a commit to abn/poetry that referenced this issue Apr 27, 2019
This change introduces the use of system keyring to store repository
passwords when one is available. Passwords are added to and removed from
the keyring using the config command.

Resolves: python-poetry#210
abn added a commit to abn/poetry that referenced this issue Apr 27, 2019
This change introduces the use of system keyring to store repository
passwords when one is available. Passwords are added to and removed from
the keyring using the config command.

Resolves: python-poetry#210
abn added a commit to abn/poetry that referenced this issue May 4, 2019
This change introduces the use of system keyring to store repository
passwords when one is available. Passwords are added to and removed from
the keyring using the config command.

Resolves: python-poetry#210
abn added a commit to abn/poetry that referenced this issue Jun 20, 2019
This change introduces the use of system keyring to store repository
passwords when one is available. Passwords are added to and removed from
the keyring using the config command.

Resolves: python-poetry#210
kasteph pushed a commit that referenced this issue Jun 24, 2019
This change introduces the use of system keyring to store repository
passwords when one is available. Passwords are added to and removed from
the keyring using the config command.

Resolves: #210
@kasteph
Copy link
Member

kasteph commented Jun 24, 2019

#774 fixes this issue.

Copy link

github-actions bot commented Mar 3, 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 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/publishing Related to PyPI/PEP 503 publishing kind/feature Feature requests/implementations
Projects
None yet
Development

No branches or pull requests

5 participants