Skip to main content

No-fuss, pure-Python keyring backend for Azure DevOps Artifacts feeds

Project description

artifacts-keyring-nofuss

Minimal, pure-Python keyring backend for Azure DevOps Artifacts feeds.

Replaces the official artifacts-keyring (which wraps a ~100 MB .NET binary) with a no-fuss implementation that covers the most common Linux auth scenarios using raw HTTP — no msal, no azure-identity, no .NET.

Install

pip install artifacts-keyring-nofuss

Or for development:

pip install -e .

How it works

When pip (or twine, etc.) queries the keyring for credentials to an Azure DevOps Artifacts feed, this backend:

  1. Discovers the Azure AD tenant by making an unauthenticated request to the feed URL and parsing the WWW-Authenticate header.
  2. Obtains a bearer token using one of the supported auth flows (see below).
  3. Exchanges the bearer token for an org-scoped, read-only Azure DevOps session token (vso.packaging scope) — the narrowest viable scope.
  4. Returns the session token to pip as Basic auth credentials.

Auth flows (priority order)

# Flow How it works
1 Azure CLI Runs az account get-access-token. Most common for local dev.
2 Managed Identity Queries the Azure IMDS endpoint. For VMs/containers on Azure.

Configuration

Select a specific flow

By default, providers are tried in the order above. To force a specific one:

# Environment variable
export ARTIFACTS_KEYRING_NOFUSS_PROVIDER=azure_cli  # or: managed_identity

Or in ~/.config/python_keyring/keyringrc.cfg:

[artifacts_keyring_nofuss]
provider = azure_cli

User-assigned managed identity

Set AZURE_CLIENT_ID to the client ID of the user-assigned managed identity:

export AZURE_CLIENT_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

When unset, system-assigned managed identity is used.

Usage with pip

pip install --index-url https://pkgs.dev.azure.com/{org}/_packaging/{feed}/pypi/simple/ my-package

The keyring backend is automatically discovered by pip. No extra flags needed.

Supported feed URLs

Any URL whose host matches one of:

  • pkgs.dev.azure.com
  • pkgs.visualstudio.com
  • pkgs.codedev.ms
  • pkgs.vsts.me

Troubleshooting

Enable verbose debug output to see the full authentication flow:

ARTIFACTS_KEYRING_NOFUSS_DEBUG=1 pip install --index-url https://pkgs.dev.azure.com/{org}/_packaging/{feed}/pypi/simple/ my-package

This prints the provider chain, token exchange steps, and any errors to stderr.

Security model

This package handles authentication tokens. Key security properties:

  • Endpoint validation: Discovery responses are validated against allowlists. The authorization_uri and VSTS authority must point to known hosts over HTTPS, with no non-default ports, userinfo, or deep paths. The authority must be a clean origin (https://host or https://host/). This prevents bearer token exfiltration via DNS hijacking or rogue proxy responses.
  • Minimum scope: Session tokens are requested with vso.packaging (read-only, org-scoped) — the narrowest scope that allows package reads.
  • No secrets at rest: No tokens are persisted to disk. In-memory caching has a 50-minute TTL (tokens typically live 60–75 minutes).
  • No CWD config: Provider configuration is read only from ~/.config/ or environment variables, never from the working directory.
  • Minimal dependencies: Only keyring and requests — no large frameworks with broad attack surface.

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

artifacts_keyring_nofuss-0.5.0.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

artifacts_keyring_nofuss-0.5.0-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file artifacts_keyring_nofuss-0.5.0.tar.gz.

File metadata

  • Download URL: artifacts_keyring_nofuss-0.5.0.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for artifacts_keyring_nofuss-0.5.0.tar.gz
Algorithm Hash digest
SHA256 a53aad9cf7139ebe0ac0fb8ff1ff759752fc930f72badd94239f64bd1b587698
MD5 e64c467ffdb7940121a92e1f57d8bfc8
BLAKE2b-256 748838dd885891ec532a3aea640a1521dec54ced857df0f09e7daa75c1a4649e

See more details on using hashes here.

Provenance

The following attestation bundles were made for artifacts_keyring_nofuss-0.5.0.tar.gz:

Publisher: release.yml on microsoft/artifacts-keyring-nofuss

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file artifacts_keyring_nofuss-0.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for artifacts_keyring_nofuss-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 16a9276997cc4781d0db3e5fb1c8ee8207d16129366ef3ec06c29e5c277d15c4
MD5 52e69251935678c56f6986314c0f6b1a
BLAKE2b-256 b64d07e19a549314c2c708b4c32a76fa50dfb60d4d8f99b8954ffef56af3c65c

See more details on using hashes here.

Provenance

The following attestation bundles were made for artifacts_keyring_nofuss-0.5.0-py3-none-any.whl:

Publisher: release.yml on microsoft/artifacts-keyring-nofuss

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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