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 pluing 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 conandat.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.0.5.tar.gz (18.2 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.0.5-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: conan_auth_source_plugin-0.0.5.tar.gz
  • Upload date:
  • Size: 18.2 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.0.5.tar.gz
Algorithm Hash digest
SHA256 f0a2d79ce16122bb20c94749a029872d7bbff4bd5c36a8d39ac5fb2adfcad12f
MD5 5814058724922c1762581a95131fb784
BLAKE2b-256 a09c79008a5022d15bf30aac162654f86221682828f330d3218a2dfe0079cef1

See more details on using hashes here.

Provenance

The following attestation bundles were made for conan_auth_source_plugin-0.0.5.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.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for conan_auth_source_plugin-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 aa536efeea38e6428b59674e23acc59ef8257264d1aae9c21181b2fccf57543e
MD5 28b91e06429bbe64028e46777f7cad36
BLAKE2b-256 c9de7080a69e6b277d3dbce26b02bdf8cfd7791d7f7ecc6cbc14a3d22c4f2077

See more details on using hashes here.

Provenance

The following attestation bundles were made for conan_auth_source_plugin-0.0.5-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

0.1.1

2 files

0.1.0

2 files

This release

0.0.5 This release

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