Skip to main content

conan-auth-source-plugin

A Conan authentication source plugin, implemented as a python module. Conan supports both a remote and a source authentication, where the remotes are used for interacting with a remote for packages, whereas the source is used for getting source using the get() or download() method in a conanfile.py.

Installation

Install the conan authentication source Python module, then install the plugin in that module into the conan installation.

python -m pip install conan-auth-source-plugin
conan-auth-source-plugin-install

Configuration

This plugin uses the source_creditials.json file for configuration. This file is marked as experimental at this stage. This module further experiments and extends its usage.

Note: The conan source configuration code uses a first match (begins with) strategy with URLs. Thus, it is important to order the credentials in longest url first if there is any overlap in matching the URL being fetched with the configuration.

Sample

{
  "credentials": [
    {
      "url": "https://github.com/...",
      "type": "github.app",
      "app_id": "4459267",
      "app_installation_id": "150620648",
      "app_private_key" : "-----BEGIN RSA PRIVATE KEY-----\n...\n-----END RSA PRIVATE KEY-----"
    }
  ]
}

Create App

The following procedure can be used to create an application in github. This procedure requires an organisation owner, or a team member with app management permissions.

This procedure is documented as a GitHub app that act on their own behalf. This requires an installation access token for authentication.

  1. Go to the organisation (or user) settings

    https://github.com/organizations/conan-py/settings/apps https://github.com//conan-py/settings/apps

  2. App settings

  • provide a github app name
  • write a description
  • add a homepage URL (e.g. to the organisation landing page), even though it isn't explicitly used
  • disable web hook
  • add repository permission 'Contents', set to 'Read-Only'
  1. Once the app is created, the 'App ID' and the 'Client ID' (not used for this workflow) are known

  2. Go to the bottom of the application and generate a private key. This will generate a 2048bit RSA key pair without a pass phrase.

  3. On the side bar of the application, select the "Install App" menu item. Once installed the installation id can be taken from the installation URL. For example if the installation URL is 'https://github.com/organizations/conan-py/settings/installations/150620648', then the installation id is 150620648. The installation id is not displayed in the web UI of github.

Why use this plugin module

This module is a shift-left style strategy for authentication. Instead of using this plugin a build pipeline (or any Conan build) can pre-authenticate with all github organisation/repositores that may be needed during a build.

This module goes half-way towards "authentication on demand". This is a concept where http authentication is only attempted by a client if a 401 (Not authenticated) response is received, and the WWW-Authenticate header provides authentication schemes that are semantically understood by the client. Once authenticated the client should reissue the http request with the new credentials.

Residual: This plugin does not defer authentication until after it is needed. This is not supported by the Conan client.

Known issues

  • this implementation stores private keys by value in memory. e.g. if using AWS it would be better to use a HSM or AWS KMS, but this would require an implementation of the github.Auth.Auth class. Using AWS Secrets Manager at least stores the key more securely at rest, even though it will be stored in memory non-securely.

  • when using the get() method in a conanfile.py, provide a filename parameter with a representative name (e.g. 'archive.tgz') so that conan can write the download to disk. The filename should be expressed in the conandata.yml.

Development

To install the plugin in a local Conan environment, the whole of the plugin repository can be installed, as the .conanignore will exclude everything except the plugin python file that thunks to the module.

conan config install .

Install the plugin Python for development as an editable module. From the root of the repository/project:

pip install --editable .

Links

pygithub

Appendices

github tarball URLs

For getting source from a private github repo, use a URL/http request of the form:

GET https://api.github.com/repos/{owner}/{repo}/tarball/{ref}
Authorization: Bearer <installation_token>

Download files

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

Source Distribution

conan_auth_source_plugin-0.1.1.tar.gz (18.1 kB view details)

Uploaded Source

Built Distribution

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

conan_auth_source_plugin-0.1.1-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file conan_auth_source_plugin-0.1.1.tar.gz.

File metadata

  • Download URL: conan_auth_source_plugin-0.1.1.tar.gz
  • Upload date:
  • Size: 18.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for conan_auth_source_plugin-0.1.1.tar.gz
Algorithm Hash digest
SHA256 bce0e7731c50344d0f0d4da8525003c9ef902fe2cf1da7ac200ceeb87278045b
MD5 4cacffe99109c7c25a6eed0ece6cc9b0
BLAKE2b-256 84d130ffca3d54883033b0d55615aed3d9b4ef73f6730fbd57aad2d9f70408bd

See more details on using hashes here.

Provenance

The following attestation bundles were made for conan_auth_source_plugin-0.1.1.tar.gz:

Publisher: publish.yml on conan-py/conan-auth-source-plugin

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

File details

Details for the file conan_auth_source_plugin-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for conan_auth_source_plugin-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8027d57d9405268c4a7e31831744e6b2c99ad9470c586e0af4f21994675d5f77
MD5 de3a9850ae482760890e620bc8ff487e
BLAKE2b-256 213cf6d04efa9bcc3543541f09de49cc7872b954bd8fa2ee822f06e8ee195561

See more details on using hashes here.

Provenance

The following attestation bundles were made for conan_auth_source_plugin-0.1.1-py3-none-any.whl:

Publisher: publish.yml on conan-py/conan-auth-source-plugin

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

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

2 files

0.0.5

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page