Repository navigation
fix(no-ticket): show OIDC credentials as OIDC in whoami --verbose - #521
Open
cloudsmith-iduffy wants to merge 5 commits into
Open
cloudsmith-iduffy wants to merge 5 commits into
cloudsmith-iduffy wants to merge 5 commits into
Conversation
Since #383, the OIDC provider returns its exchanged token as a bearer token. whoami treated every bearer token as a SAML session, so it showed an OIDC credential as "SAML Token (primary)", with the keyring as the only possible source. The OIDC label and source were no longer reachable. whoami now detects an OIDC credential from the credential chain before it looks at the headers. The text output shows "OIDC Auto-Discovery" and the source, such as "OIDC via GitHub Actions (org: ..., service: ...)". The JSON output gives active_method "oidc" and the source in auth.oidc. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused fix matches the credential-chain contract, includes regression coverage, and has no identified blocking issues.
No open issues 🎉
What changed in this PR
Corrects whoami --verbose so OIDC credentials are identified by their credential-chain source rather than mistaken for SAML bearer tokens.
Changes:
- Displays OIDC authentication and its source in verbose text and JSON output.
- Adds regression tests for OIDC output and unchanged SAML labeling.
- Documents the JSON authentication-field changes in the changelog.
| File | Description |
|---|---|
cloudsmith_cli/cli/tests/commands/test_whoami.py |
Adds OIDC text/JSON tests and a SAML regression test. |
cloudsmith_cli/cli/commands/whoami.py |
Detects OIDC credentials and reports their authentication source. |
CHANGELOG.md |
Documents the corrected display and JSON fields. |
Review effort: Balanced
The OIDC provider reads the token cache before it detects the CI environment, so a cached token showed "OIDC [cached]" with no vendor. Most commands in a CI job after the first one use the cached token. The cache now stores the name of the detector with the token, and get_cached_token returns both. The source of a cached token is then, for example, "OIDC via GitHub Actions [cached] (org: ..., service: ...)". An entry that an earlier version cached has no vendor name and keeps the old source until it expires. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
|
@copilot resolve the merge conflicts in this pull request |
# Conflicts: # CHANGELOG.md # cloudsmith_cli/core/tests/test_oidc_provider.py Co-authored-by: cloudsmith-iduffy <178375997+cloudsmith-iduffy@users.noreply.github.com>
Contributor
Merged |
* origin/master: (25 commits) fix(ENG-15484): accept --color on click versions before 8.2 (#582) fix(no-ticket): stop retrying unknown hosts and show backoff retries (#542) fix(no-ticket): stop credential helpers from overwriting config files that do not parse (#540) fix(no-ticket): remove the pnpm launcher when .npmrc does not exist (#539) fix(no-ticket): keep the user's Cargo registry credential provider (#532) build(deps): bump pyasn1 (#580) build(deps): bump the actions-all group with 4 updates (#577) build(deps): bump the uv-all group with 7 updates (#578) build(deps): bump alpine from `294b683` to `be26560` (#576) fix(no-ticket): keep credentials.ini sections and save missing API keys (#533) fix(no-ticket): set a default timeout on each API request (#538) fix(no-ticket): print the result count when a list is empty (#545) fix(no-ticket): escape the args in the terraformrc block (#543) fix(no-ticket): show the dependencies help for list deps (#546) fix(no-ticket): show a correct summary for the pnpm credential helper (#547) fix(no-ticket): show a clean error when the SAML IdP response is not a JSON object (#559) fix(no-ticket): show the API error when mcp cannot load the API schema (#561) fix(no-ticket): treat an empty trailing OWNER/REPO part as not given (#550) fix(no-ticket): print a skipped API error one time in copy, move and resync (#552) fix(no-ticket): save credentials.ini with mode 0600 (#553) ... # Conflicts: # CHANGELOG.md
Copilot started work to resolve merge conflicts on behalf of
cloudsmith-iduffy
November 3, 2026 15:59
# Conflicts: # CHANGELOG.md Co-authored-by: cloudsmith-iduffy <178375997+cloudsmith-iduffy@users.noreply.github.com>
auto-merge was automatically disabled
November 3, 2026 16:04
Head branch was pushed to by a user without write access
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
cloudsmith whoami --verboseshows a credential from OIDC auto-discovery as a SAML session. In CI, this hides how the CLI authenticated:The cause:
auth_type="bearer", so the CLI sends it in anAuthorization: Bearerheader._get_active_method()treats every bearer header as a SAML session (sso_token).Sourcefrom the system keyring, so OIDC credentials get no source.OIDC Auto-Discoverylabel from feat: add OIDC credential auto-discovery #276 sat in the API key branch, which an OIDC credential no longer reaches.This PR detects an OIDC credential from the credential chain (
source_name == "oidc") before it looks at the headers. After the fix:With
-F json,auth.active_methodisoidcinstead ofsso_token, and the newauth.oidcobject givesconfiguredandsource.Type of Change
Additional Notes
cloudsmith_cli/cli/tests/commands/test_whoami.pyfor the text output, the JSON output, and a SAML session, which still shows asSAML Token (primary). The OIDC tests failed before the fix. The full unit suite and pre-commit pass.active_methodgetsoidcinstead ofsso_tokenfor OIDC credentials. The changelog entry says so.OIDC [cached] (org: …, service: …)without the CI vendor. The provider reads the cache before it detects the environment. The second commit stores the detector name with the cached token, so the source is now, for example,OIDC via GitHub Actions [cached] (org: …, service: …). A token that an earlier version cached keeps the old source until it expires. Tests: 3 provider tests and a newtest_oidc_cache.pyfor the disk and keyring paths.whoami --verbosetwice with GitHub OIDC. The first run printedAuthentication Method: OIDC Auto-DiscoveryandSource: OIDC via GitHub Actions (org: iduffy-demo, service: github-c3xe). The second run, from the cache, printedSource: OIDC via GitHub Actions [cached] (org: iduffy-demo, service: github-c3xe).🤖 Generated with Claude Code