Skip to content

feat: add OIDC credential auto-discovery - #276

Merged
BartoszBlizniak merged 6 commits into
masterfrom
iduffy/oidc-base
May 27, 2026
Merged

feat: add OIDC credential auto-discovery#276
BartoszBlizniak merged 6 commits into
masterfrom
iduffy/oidc-base

Conversation

@cloudsmith-iduffy

@cloudsmith-iduffycloudsmith-iduffy commented Mar 13, 2026

Copy link
Copy Markdown
Contributor

Add a new OIDC credential provider to the credential chain that
automatically detects CI/CD environments, retrieves a vendor OIDC JWT,
and exchanges it for a short-lived Cloudsmith API token.

Key changes:

  • New OidcProvider in the credential provider chain (lowest priority)
  • AWS environment detector using boto3/STS (optional aws extra)
  • OIDC token exchange
  • Token caching via system keyring with filesystem fallback
  • whoami command updated to display OIDC auth source
  • README updated with optional dependency install instructions

@cloudsmith-iduffy
cloudsmith-iduffy requested a review from a team as a code ownerMarch 13, 2026 22:26
@cloudsmith-iduffy
cloudsmith-iduffyforce-pushed the iduffy/credential-provider-chain branch from fd065ae to 8b57884CompareMarch 14, 2026 14:01
@cloudsmith-iduffy
cloudsmith-iduffyforce-pushed the iduffy/credential-provider-chain branch from 8b57884 to 0b0445cCompareMarch 14, 2026 14:06
@cloudsmith-iduffy
cloudsmith-iduffyforce-pushed the iduffy/credential-provider-chain branch from 0b0445c to 987c32fCompareMarch 14, 2026 14:10
@cloudsmith-iduffy
cloudsmith-iduffyforce-pushed the iduffy/oidc-base branch 2 times, most recently from 4586a50 to 603470aCompareMarch 14, 2026 14:14
@cloudsmith-iduffy
cloudsmith-iduffyforce-pushed the iduffy/credential-provider-chain branch from 987c32f to 65d8c53CompareMarch 14, 2026 14:17
@cloudsmith-iduffy
cloudsmith-iduffyforce-pushed the iduffy/credential-provider-chain branch from 65d8c53 to 646c50aCompareMarch 14, 2026 14:23
@cloudsmith-iduffy
cloudsmith-iduffyforce-pushed the iduffy/credential-provider-chain branch from 646c50a to 5c2b23dCompareMarch 14, 2026 14:26
@cloudsmith-iduffy
cloudsmith-iduffyforce-pushed the iduffy/oidc-base branch 3 times, most recently from 6d0be0f to 0070269CompareMarch 14, 2026 14:39
@cloudsmith-iduffy
cloudsmith-iduffyforce-pushed the iduffy/credential-provider-chain branch from 6e1792c to 8862812CompareMarch 14, 2026 14:43
@cloudsmith-iduffy
cloudsmith-iduffy marked this pull request as draft March 14, 2026 14:49
@cloudsmith-iduffy
cloudsmith-iduffyforce-pushed the iduffy/credential-provider-chain branch 2 times, most recently from 368db92 to a60887dCompareMarch 15, 2026 10:34
@cloudsmith-iduffy
cloudsmith-iduffyforce-pushed the iduffy/oidc-base branch 2 times, most recently from 04708a3 to 6ac94b8CompareMarch 15, 2026 21:58
@cloudsmith-iduffycloudsmith-iduffy changed the title feat: add OIDC credential auto-discovery for CI/CD environmentsfeat: add OIDC credential auto-discoveryMar 15, 2026
@cloudsmith-iduffy
cloudsmith-iduffy marked this pull request as ready for review March 15, 2026 22:26
@cloudsmith-iduffy
cloudsmith-iduffyforce-pushed the iduffy/credential-provider-chain branch from 1cef871 to b4b2583CompareMarch 25, 2026 12:13
@cloudsmith-iduffy
cloudsmith-iduffyforce-pushed the iduffy/oidc-base branch 2 times, most recently from 207da81 to f51bc86CompareMarch 31, 2026 16:07
@cloudsmith-iduffy
cloudsmith-iduffyforce-pushed the iduffy/credential-provider-chain branch from 74f874c to f30e428CompareMarch 31, 2026 16:18
cloudsmith-iduffyand others added 3 commits March 31, 2026 22:25
Add AWS OIDC support as the final provider in the credential chain
(Keyring → CLIFlag → OIDC). When CLOUDSMITH_ORG and CLOUDSMITH_SERVICE_SLUG
are set, the CLI auto-detects the CI/CD environment, retrieves a vendor
OIDC JWT via STS GetWebIdentityToken, and exchanges it for a short-lived
Cloudsmith API token.
- AWS detector with boto3 session reuse and default audience ('cloudsmith')
- Token cache (keyring with filesystem fallback) checked before detection
- OIDC token exchange against POST /openid/{org}/
- CLI options: --oidc-org, --oidc-service-slug, --oidc-audience,
--oidc-discovery-disabled
- Optional dependency: pip install cloudsmith-cli[aws]
- Warning-level logs on OIDC failures for CI/CD debuggability
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Base automatically changed from iduffy/credential-provider-chain to masterMay 20, 2026 09:49
@BartoszBlizniak

Copy link
Copy Markdown
Member

@copilot resolve the merge conflicts in this pull request

CopilotAI review requested due to automatic review settings May 27, 2026 10:14
@cloudsmith-iduffy
cloudsmith-iduffy removed the request for review from CopilotMay 27, 2026 10:14

CopilotAI commented May 27, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Resolved in 334589f.

CopilotAI requested a review from BartoszBlizniakMay 27, 2026 10:15
BartoszBlizniak added a commit to BartoszBlizniak/cloudsmith-cli that referenced this pull request May 27, 2026
…Windows e2e cwd
Three Windows-only fixes from run 26505942827:
1. Install `cryptography` explicitly during the build step. It is a
transitive dep on Linux (via secretstorage) + macOS, but absent on
Windows (WinVaultKeyring uses the native Windows API). Without it,
PyInstaller logged "Hidden import 'cryptography.fernet' not found"
and the frozen Windows binary's `check cryptography-selftest` failed
with `No module named 'cryptography'`. Move it into setup.py
install_requires once OIDC PR cloudsmith-io#276 lands a real call site.
2. Replace `ctx.exit(N)` with `sys.exit(N)` in the two selftest
subcommands. On the Windows PyInstaller binary, Click's
`ctx.exit(2)` printed the FAIL line but the process exit code
reaching PowerShell was 0 — the in-step `if ($LASTEXITCODE -ne 0)`
guard therefore did not throw and the step was marked green despite
a real failure. `sys.exit` propagates through PyInstaller's
bootloader correctly on every platform. Also drop the now-unused
`@click.pass_context` decorator + `ctx` parameter for cleanliness.
3. Use an absolute path for `$bin` in the Push/pull e2e (Windows) step
so `Set-Location e2e` does not invalidate the relative
`.\out\cloudsmith-windows-amd64.exe` lookup. The matrix legs failed
with "The term '.\out\cloudsmith-windows-amd64.exe' is not
recognized as a name of a cmdlet …" after the cd.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
BartoszBlizniak added a commit to BartoszBlizniak/cloudsmith-cli that referenced this pull request May 27, 2026
Carries the research-followups tracker onto the binary-poc branch and
updates the four "Promote PyInstaller path" items (per §Suggested
execution order):
- #5 keyring round-trip: in-flight; selftest pivot documented (real
keyring usage is SSO-only and not CI-scriptable, so the work uses a
synthetic `check keyring-selftest` set/get/delete via the configured
backend). CI gates the selftest per OS; signed-macOS retest blocked
on Q#16.
- #6 push/pull e2e: in-flight; new setup-test-repo job + per-target
push/download/cmp described, results table populated as CI lands.
- #7 native cryptography: in-flight; audit shows zero direct
cryptography call sites in the CLI today (transitive via keyring →
secretstorage on Linux), selftest covers it pending OIDC PR cloudsmith-io#276.
- #13 cloudsmith-cli-action libc detection: design brief drafted —
algorithm, URL shape, fallback policy, test matrix, implementation
notes for an engineer with push perms to cloudsmith-io/cloudsmith-cli-action.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@BartoszBlizniak

Copy link
Copy Markdown
Member

Tested after merge:

> cloudsmith whoami --verbose
Retrieving your authentication status from the API ... OK
User: teemo (slug: teemo)
Authentication Method: OIDC Auto-Discovery
Source: OIDC via AWS (org: <redacted>, service: teemo)
Token Slug: <redacted>
Created: 2023-07-07T10:43:31.679063Z

@BartoszBlizniak
BartoszBlizniak merged commit f9422d7 into masterMay 27, 2026
40 checks passed
@BartoszBlizniak
BartoszBlizniak deleted the iduffy/oidc-base branch May 27, 2026 16:25
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@cloudsmith-iduffy@BartoszBlizniak@butlerx