Skip to content

feat: add OIDC credential auto-discovery#276

Open
cloudsmith-iduffy wants to merge 6 commits into
masterfrom
iduffy/oidc-base
Open

feat: add OIDC credential auto-discovery#276
cloudsmith-iduffy wants to merge 6 commits into
masterfrom
iduffy/oidc-base

Conversation

@cloudsmith-iduffy
Copy link
Copy Markdown
Contributor

@cloudsmith-iduffy cloudsmith-iduffy commented Mar 13, 2026

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 owner March 13, 2026 22:26
@cloudsmith-iduffy cloudsmith-iduffy force-pushed the iduffy/credential-provider-chain branch from fd065ae to 8b57884 Compare March 14, 2026 14:01
@cloudsmith-iduffy cloudsmith-iduffy force-pushed the iduffy/credential-provider-chain branch from 8b57884 to 0b0445c Compare March 14, 2026 14:06
@cloudsmith-iduffy cloudsmith-iduffy force-pushed the iduffy/credential-provider-chain branch from 0b0445c to 987c32f Compare March 14, 2026 14:10
@cloudsmith-iduffy cloudsmith-iduffy force-pushed the iduffy/oidc-base branch 2 times, most recently from 4586a50 to 603470a Compare March 14, 2026 14:14
@cloudsmith-iduffy cloudsmith-iduffy force-pushed the iduffy/credential-provider-chain branch from 987c32f to 65d8c53 Compare March 14, 2026 14:17
@cloudsmith-iduffy cloudsmith-iduffy force-pushed the iduffy/credential-provider-chain branch from 65d8c53 to 646c50a Compare March 14, 2026 14:23
@cloudsmith-iduffy cloudsmith-iduffy force-pushed the iduffy/credential-provider-chain branch from 646c50a to 5c2b23d Compare March 14, 2026 14:26
@cloudsmith-iduffy cloudsmith-iduffy force-pushed the iduffy/oidc-base branch 3 times, most recently from 6d0be0f to 0070269 Compare March 14, 2026 14:39
@cloudsmith-iduffy cloudsmith-iduffy force-pushed the iduffy/credential-provider-chain branch from 6e1792c to 8862812 Compare March 14, 2026 14:43
@cloudsmith-iduffy cloudsmith-iduffy marked this pull request as draft March 14, 2026 14:49
@cloudsmith-iduffy cloudsmith-iduffy force-pushed the iduffy/credential-provider-chain branch 2 times, most recently from 368db92 to a60887d Compare March 15, 2026 10:34
@cloudsmith-iduffy cloudsmith-iduffy force-pushed the iduffy/oidc-base branch 2 times, most recently from 04708a3 to 6ac94b8 Compare March 15, 2026 21:58
@cloudsmith-iduffy cloudsmith-iduffy changed the title feat: add OIDC credential auto-discovery for CI/CD environments feat: add OIDC credential auto-discovery Mar 15, 2026
@cloudsmith-iduffy cloudsmith-iduffy marked this pull request as ready for review March 15, 2026 22:26
@cloudsmith-iduffy cloudsmith-iduffy force-pushed the iduffy/credential-provider-chain branch from 1cef871 to b4b2583 Compare March 25, 2026 12:13
@cloudsmith-iduffy cloudsmith-iduffy force-pushed the iduffy/oidc-base branch 2 times, most recently from 207da81 to f51bc86 Compare March 31, 2026 16:07
@cloudsmith-iduffy cloudsmith-iduffy force-pushed the iduffy/credential-provider-chain branch from 74f874c to f30e428 Compare March 31, 2026 16:18
cloudsmith-iduffy and 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 master May 20, 2026 09:49
@BartoszBlizniak
Copy link
Copy Markdown
Member

@copilot resolve the merge conflicts in this pull request

Copilot AI review requested due to automatic review settings May 27, 2026 10:14
@cloudsmith-iduffy cloudsmith-iduffy review requested due to automatic review settings May 27, 2026 10:14
Copy link
Copy Markdown
Contributor

Copilot AI commented May 27, 2026

@copilot resolve the merge conflicts in this pull request

Resolved in 334589f.

Copilot AI requested a review from BartoszBlizniak May 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
…yInstaller path)

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.
- cloudsmith-io#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>
Sign up for free to 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