Skip to main content

Mercurial extension for storing passwords securely

Project description

This is an extension for Mercurial 5.6 or later, allowing you to store HTTP passwords securely. The extension itself does not offer any commands, you simply enable it, and get an extra prompt:

$ hg pull
pulling from https://example.com/private/repo
http authorization required for https://example.com/private/repo
realm: Mercurial
user: me
password: <SECRET>
would you like to save this password? (Y/n)  y
searching for changes
no changes found

That would result an a new item named in your key chain or key ring:

Mercurial (me@example.com)

Once a password is saved, there’s nothing more to do. You’ll get a new prompt, should the password suddenly stop working. To manage or delete your passwords, use the Keychain Services application included with macOS, GNOME Keyring or something similar included in your desktop environment.

Requirements

  • Python 3.6 or later.

  • Mercurial 5.6 or later.

  • SecretStorage on platforms other than macOS.

Windows is not supported, yet.

Installation and usage

Install the extension and its dependencies with Pip:

$ pip install .

Then, add the following lines to your ~/.hgrc:

[extensions]
credentials =

To avoid entering passwords for each and every repository, use auth.schemes:

[auth]
example.prefix = example.com
example.username = me

This will cause all repositories on https://example.com to resolve to the same Keychain item. See hg help config.auth for details.

Alternatives

The most obvious alternative to this extension is the Mercurial Keyring extension. It supports older versions of Mercurial and more backends, but saves passwords in a less readable fashion.

Future plans

  • Consider whether it makes sense to implement a completely custom urllib2 password manager, so passwords aren’t stored in memory any longer than strictly necessary.

Acknowledgements

Thanks you to Octobus and Heptapod for hosting this project, and for making Mercurial development fun again!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hg-credentials-0.1.2.tar.gz (16.7 kB view hashes)

Uploaded Source

Built Distributions

hg_credentials-0.1.2-cp312-cp312-macosx_12_0_x86_64.whl (22.1 kB view hashes)

Uploaded CPython 3.12 macOS 12.0+ x86-64

hg_credentials-0.1.2-cp311-cp311-macosx_12_0_x86_64.whl (22.1 kB view hashes)

Uploaded CPython 3.11 macOS 12.0+ x86-64

hg_credentials-0.1.2-cp310-cp310-macosx_12_0_x86_64.whl (22.1 kB view hashes)

Uploaded CPython 3.10 macOS 12.0+ x86-64

hg_credentials-0.1.2-cp39-cp39-macosx_12_0_x86_64.whl (22.1 kB view hashes)

Uploaded CPython 3.9 macOS 12.0+ x86-64

hg_credentials-0.1.2-cp38-cp38-macosx_12_0_x86_64.whl (22.1 kB view hashes)

Uploaded CPython 3.8 macOS 12.0+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page