Skip to content

fix(auth): never cache ambient provider credentials in the keyring - #2819

Merged
Andriy Knysh (aknysh) merged 10 commits into
cloudposse:mainfrom
thejrose1984:claude/github-issue-2695-4d2p62
Jul 30, 2026
Merged

Andriy Knysh (aknysh) merged 10 commits into
cloudposse:mainfrom
thejrose1984:claude/github-issue-2695-4d2p62

Conversation

@thejrose1984

@thejrose1984 thejrose1984 commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

what

Stops the auth manager persisting credentials to the keyring for providers
that re-resolve their principal from the environment on every authentication
(gcp/adc, gcp/workload-identity-federation, azure/cli, azure/oidc, github/oidc).
Such chains are never served from, nor written to, the keyring, and stale
entries are purged so poisoned keyrings self-heal.

why

gcp/adc is documented as stateless, but its short-lived token was cached and
replayed, so after gcloud auth application-default login switched accounts
Atmos kept authenticating as the previous principal. atmos/pro is deliberately
excluded: it mints a single-use token, so cached reuse is load-bearing.

references

Closes #2695
Suggested release label: patch

Summary by CodeRabbit

  • New Features
    • Ambient authentication providers now explicitly declare non-persisted credentials for fresh resolution from current environment on each login.
  • Bug Fixes
    • Prevented stale ambient credentials from being replayed from cache or written to the keychain.
    • auth logout, auth logout provider, and auth logout --all now clear ambient-related keyring entries even without --keychain.
    • Improved ambient-aware --dry-run logout previews to match real cleanup behavior.
  • Documentation
    • Updated ambient provider docs describing token/credential rotation and non-caching behavior.
  • Tests
    • Added expanded ambient-aware coverage across caching and identity/provider/logout-all flows.

@thejrose1984
thejrose1984 requested a review from a team as a code owner July 28, 2026 10:20
@atmos-pro

atmos-pro Bot commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Note

Atmos Pro  

Waiting for your GitHub Actions workflow to upload affected stacks.
Learn More.

@github-actions github-actions Bot added the size/l Large size PR label Jul 28, 2026
@thejrose1984
thejrose1984 force-pushed the claude/github-issue-2695-4d2p62 branch from 5987c1b to f6b3ca3 Compare July 28, 2026 10:20
@coderabbitai

coderabbitai Bot commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Ambient-provider contracts are added across authentication providers. Auth managers bypass and purge persistent credentials for ambient chains, apply ambient-aware logout cleanup, and show deterministic dry-run previews. Tests and documentation cover caching, logout, and provider classification.

Changes

Ambient authentication behavior

Layer / File(s) Summary
Ambient provider contracts and implementations
pkg/auth/types/*, pkg/auth/providers/*, website/docs/.../auth/providers.mdx
Ambient interfaces and detection helpers are added. Azure, GCP, and GitHub OIDC providers report ambient behavior, while Atmos Pro remains non-ambient.
Ambient chain cache control
pkg/auth/manager_chain.go, pkg/auth/manager_whoami.go, pkg/auth/manager_ambient_provider_test.go
Ambient chains skip cached credentials, purge realm and legacy entries, and avoid keyring writes while preserving non-ambient caching.
Ambient-aware logout deletion
pkg/auth/manager_logout.go, pkg/auth/manager_ambient_provider_test.go, website/docs/cli/commands/auth/logout.mdx
Identity, provider, and global logout remove ambient entries without requiring --keychain, with best-effort handling for expected missing entries.
Ambient-aware dry-run previews
cmd/auth/logout.go, cmd/auth/logout_test.go
Dry-run previews include ambient-provider cleanup and centralize deterministic global logout rendering.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant IdentityChain
  participant AuthManager
  participant AmbientProvider
  participant CredentialStore
  IdentityChain->>AuthManager: authenticate identity chain
  AuthManager->>CredentialStore: check ambient-chain cache
  AuthManager->>AmbientProvider: resolve current credentials
  AmbientProvider-->>AuthManager: return fresh credentials
  AuthManager->>CredentialStore: purge stale ambient entries
Loading

Suggested reviewers: osterman, aknysh

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 69.23% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main auth caching change and is concise.
Linked Issues check ✅ Passed The PR fixes ambient-provider caching and stale keyring reuse for gcp/adc and related ambient providers, and updates logout/docs for cleanup.
Out of Scope Changes check ✅ Passed The changes stay focused on ambient-provider caching, logout cleanup, and supporting tests/docs; no unrelated feature work is evident.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@thejrose1984

Copy link
Copy Markdown
Contributor Author

CodeRabbit (@coderabbitai) review

@coderabbitai

coderabbitai Bot commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@thejrose1984 thejrose1984 changed the title Claude/GitHub issue 2695 4d2p62 fix(auth): never cache ambient provider credentials in the keyring Jul 28, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
pkg/auth/manager_ambient_provider_test.go (1)

251-278: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add coverage for logout against an ambient chain with no existing keyring entry.

Every case here pre-populates the store before calling Logout/LogoutProvider/LogoutAll, so the delete always succeeds. The more realistic steady state for ambient identities is an empty store (since purgeCachedCredentials already deletes entries during authentication), and that path isn't exercised here — see the related finding on deleteIdentityKeyringEntries in pkg/auth/manager_logout.go.

Also applies to: 283-311, 316-336

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/auth/manager_ambient_provider_test.go` around lines 251 - 278, Extend the
logout tests around TestLogout_AmbientChainDeletesKeyringWithoutFlag and the
related LogoutProvider/LogoutAll cases to cover an empty store with no existing
ambient identity or keyring entry. Assert that Logout, LogoutProvider, and
LogoutAll complete successfully and preserve the expected ambient versus
non-ambient behavior when deletion has nothing to remove.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@pkg/auth/manager_ambient_provider_test.go`:
- Around line 251-278: Extend the logout tests around
TestLogout_AmbientChainDeletesKeyringWithoutFlag and the related
LogoutProvider/LogoutAll cases to cover an empty store with no existing ambient
identity or keyring entry. Assert that Logout, LogoutProvider, and LogoutAll
complete successfully and preserve the expected ambient versus non-ambient
behavior when deletion has nothing to remove.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 8102495d-e4d1-402b-82c6-8f1086fb39ac

📥 Commits

Reviewing files that changed from the base of the PR and between b0dcb79 and f6b3ca3.

📒 Files selected for processing (22)
  • cmd/auth/logout.go
  • cmd/auth/logout_test.go
  • pkg/auth/manager_ambient_provider_test.go
  • pkg/auth/manager_chain.go
  • pkg/auth/manager_logout.go
  • pkg/auth/manager_whoami.go
  • pkg/auth/providers/atmospro/provider_test.go
  • pkg/auth/providers/azure/cli.go
  • pkg/auth/providers/azure/oidc.go
  • pkg/auth/providers/azure/oidc_test.go
  • pkg/auth/providers/gcp_adc/doc.go
  • pkg/auth/providers/gcp_adc/provider.go
  • pkg/auth/providers/gcp_adc/provider_test.go
  • pkg/auth/providers/gcp_wif/doc.go
  • pkg/auth/providers/gcp_wif/provider.go
  • pkg/auth/providers/gcp_wif/provider_test.go
  • pkg/auth/providers/github/oidc.go
  • pkg/auth/providers/github/oidc_test.go
  • pkg/auth/types/ambient.go
  • pkg/auth/types/ambient_test.go
  • website/docs/cli/commands/auth/logout.mdx
  • website/docs/cli/configuration/auth/providers.mdx

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 28, 2026
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 28, 2026
@osterman Erik Osterman (Cloud Posse) (osterman) added the patch A minor, backward compatible change label Jul 29, 2026
@codecov

codecov Bot commented Jul 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.89%. Comparing base (ca66b09) to head (3185f10).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2819      +/-   ##
==========================================
+ Coverage   81.87%   81.89%   +0.02%     
==========================================
  Files        1794     1795       +1     
  Lines      173530   173625      +95     
==========================================
+ Hits       142076   142198     +122     
+ Misses      23664    23648      -16     
+ Partials     7790     7779      -11     
Flag Coverage Δ
unittests 81.89% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
cmd/auth/logout.go 74.07% <100.00%> (+1.38%) ⬆️
pkg/auth/manager_chain.go 93.69% <100.00%> (+1.55%) ⬆️
pkg/auth/manager_logout.go 84.65% <100.00%> (+13.49%) ⬆️
pkg/auth/manager_whoami.go 100.00% <100.00%> (ø)
pkg/auth/providers/azure/cli.go 65.64% <100.00%> (+0.53%) ⬆️
pkg/auth/providers/azure/oidc.go 90.94% <100.00%> (+0.06%) ⬆️
pkg/auth/providers/gcp_adc/provider.go 89.36% <100.00%> (+0.23%) ⬆️
pkg/auth/providers/gcp_wif/provider.go 94.90% <100.00%> (+0.03%) ⬆️
pkg/auth/providers/github/oidc.go 71.87% <100.00%> (+0.44%) ⬆️
pkg/auth/types/ambient.go 100.00% <100.00%> (ø)

... and 14 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

The gcp/adc provider is documented as stateless: it re-resolves the active
principal from the environment (GOOGLE_APPLICATION_CREDENTIALS, the gcloud
config, or the metadata server) on every call and mints a short-lived token
from it. The auth manager, however, persisted that token to the system keyring
and replayed it on the next login, so after switching accounts with
`gcloud auth application-default login` Atmos kept authenticating as the
previous principal until the user ran
`atmos auth logout --provider gcp-adc --keychain --force`.

Introduce types.AmbientProvider, an optional interface a provider implements to
declare that it resolves credentials from ambient environment state. The
manager now treats chains rooted at such a provider as non-cacheable:

- findFirstValidCachedCredentials returns -1, forcing re-resolution from the
  provider on every authentication.
- authenticateWithProvider, authenticateIdentityChain, and buildWhoamiInfo skip
  the keyring write, and purge any pre-existing entry so installations that
  already have a poisoned keyring self-heal without the workaround.
- Logout, LogoutProvider, and LogoutAll clear those entries whether or not
  --keychain was passed; there is nothing durable to preserve.

Both gcp/adc and gcp/workload-identity-federation opt in — WIF has the same
shape, exchanging an OIDC token read from the environment on every call. The
process-level in-memory cache still applies, so a single Atmos command performs
at most one resolution. Providers that do not implement the interface are
cached exactly as before.

Also guard resolveProviderForIdentity against a nil config, which the new
buildWhoamiInfo call path can reach.

Fixes cloudposse#2695

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018E2ZZsjCoEsJVF8mXgJwoN
Follow-up from code review of the ambient-provider fix. No behavior change;
these close paths the first round left unverified.

- Add a realm-aware credential store double. The shared testStore keys entries
  by alias alone, so it could not distinguish a realm-scoped entry from the
  legacy pre-realm one — the exact distinction the self-healing purge depends
  on. The legacy purge was previously untested.
- Cover purgeCachedCredentials: realm + legacy deletion, the empty-realm case
  that must skip the redundant second delete, and the nil-store guard.
- Cover chainRootIsAmbient's guards (empty chain, chain root that is not a
  registered provider, as happens for standalone identities).
- Cover LogoutAll, which decides per provider, and add the missing non-ambient
  counterpart for LogoutProvider so every ambient fallback has a negative-path
  test as the repo conventions require.
- Cover a multi-hop `via` chain for identityChainRootIsAmbient and a 3-step
  ambient chain whose intermediate credentials must also be purged.
- Cover resolveProviderForIdentity's new nil-config guard directly.
- Move exhaustive ProviderIsAmbient coverage beside the code in
  pkg/auth/types, leaving pkg/auth with the one assertion that matters there:
  the shared testProvider double must stay non-ambient, or that package's
  non-ambient assertions are vacuous.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018E2ZZsjCoEsJVF8mXgJwoN
A provider audit for the gcp/adc fix found three more providers with the
identical bug. Each re-resolves its principal from ambient state on every
Authenticate, has a no-op Logout, and manages no credential files — yet the
auth manager persisted their short-lived tokens to the keyring and replayed
them:

- azure/cli shells out to `az account get-access-token`, so it reproduces
  issue cloudposse#2695 verbatim: `az login` as a different account, and Atmos keeps
  authenticating as the previous one.
- azure/oidc re-reads its federated token from token_file_path,
  AZURE_FEDERATED_TOKEN_FILE, or the GitHub Actions endpoint on every call.
- github/oidc requests a fresh token from the Actions token endpoint on every
  call. Its own Logout comment documented the anti-pattern outright
  ("Credentials are only stored in keyring") — corrected here.

All three now implement types.AmbientProvider, so the existing manager logic
covers them with no further changes.

Deliberately NOT marked, verified rather than assumed:

- atmos/pro mints a SINGLE-USE token that cannot be re-exchanged, so cached
  reuse is load-bearing for it (see the EnsureIdentityEnvironment contract in
  pkg/auth/types/interfaces.go). Marking it ambient would break authentication.
  Added TestProProvider_IsNotAmbient as a regression guard, since it is
  superficially similar to the ambient providers — short-lived token, no
  credential files. What makes a provider ambient is that it CAN re-resolve,
  not that its token is short-lived.
- aws/sso, aws/saml, and azure/device-code run interactive flows backed by
  their own purpose-built caches. The azure test asserts device-code stays
  non-ambient alongside its two ambient siblings.

Also generalizes the manager comments that enumerated the ambient providers by
name, so they do not go stale as more providers opt in.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018E2ZZsjCoEsJVF8mXgJwoN
Regression from the ambient-provider fix. Logout forces keyring deletion for
ambient chains inside the manager, but the dry-run preview runs in the cmd
layer and only sees the user's --keychain flag. Without --keychain it therefore
listed no keyring entries while the real run removed them — dry-run's one job
is an accurate preview.

The preview now asks whether the provider is ambient, via a new optional
interface types.AmbientProviderReporter plus a types.ManagerReportsAmbient
helper that falls back to false for implementations lacking it.

Deliberately NOT added to types.AuthManager. That interface is already ~35
methods with a generated mock and six hand-written doubles across the repo;
adding a method for a display concern churned all of them for no behavioral
gain (tried it first — it cascaded through five files before I stopped).
Optional interfaces are the established pattern here: types.AmbientProvider,
types.StandaloneIdentity, types.Provisioner, types.ConsoleAccessProvider.
The final change touches five files and neither the interface nor the mock.

Also fixes a double GetProviders() call the first attempt introduced in the
--all preview, by fetching once and sharing it with ambientProviderNames.

Tests use a decorator over the generated mock rather than a hand-written one,
with a compile-time assertion that it really satisfies the reporter — without
that, a rename would silently turn the assertions into no-ops, since the
helper falls back to false for types that do not implement it.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018E2ZZsjCoEsJVF8mXgJwoN
…r fix

Ran the repo's actual lint gate for the first time in this branch. It needed a
custom-gcl binary built with the go1.26.4 toolchain (the stock one is built
with go1.25 and refuses the repo's go.mod target; the repo also wires in a
`lintroller` plugin, so the stock binary cannot load the config at all).

Diffing findings against the base commit showed six regressions from the
earlier commits, now fixed:

- godot x3: sentences opening with a lowercase identifier.
- revive add-constant x3: new log-key string literals crossing the
  four-occurrence threshold. Added logKeyChain / logKeyIdentityStep /
  logKeyRealm / logKeyName, placed in manager_chain.go rather than the shared
  block in manager.go so that file stays untouched by this branch.
- revive function-length in Logout and buildWhoamiInfo: extracted
  deleteIdentityKeyringEntries and cacheWhoamiCredentials. The former also
  removes a nestif finding.
- revive cyclomatic in performLogoutAll, from the ambient branch added to the
  --all preview: extracted printLogoutAllDryRun and
  printLogoutAllKeyringPreview.

Net effect on the package: 243 findings at the base commit, 239 now. The four
remaining deltas are all severity: warning revive/nestif findings on functions
this branch does not modify (NewAuthManager, (*manager).Authenticate,
executeAuthLogoutCommand), each paired with an equivalent function-length
warning that disappeared from the same function — golangci-lint's uniq-by-line
keeps one issue per line, so which of two co-located revive rules surfaces
shifts as the global issue set changes. The nestif entry is the
deleteKeychain -> deleteProviderKeychain rename, net zero.

No behavior change; all auth and cmd/auth tests pass.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018E2ZZsjCoEsJVF8mXgJwoN
Addresses CodeRabbit's docstring-coverage finding (61.54% vs an 80% threshold).

Every undocumented function it flagged was in a test file, and most were
mechanical interface-satisfying stubs on doubles written from scratch here —
duplicating doubles this package already had. Rather than paper over that with
~20 filler comments, the doubles now reuse what exists:

- ambientTestProvider embeds the shared testProvider and keeps only the two
  methods it actually specializes: IsAmbient, and an Authenticate that counts
  calls and returns an arbitrary ICredentials so a test can watch the ambient
  environment resolve to a different principal.
- passthroughIdentity embeds countingIdentity and keeps only Kind and the
  echo-the-upstream-credentials Authenticate.

That removes 20 duplicated stub methods outright, which the repo's code-reuse
rule says should not have been written in the first place.

The genuinely new helpers keep real documentation: realmStore's realm-aware
methods (including why Delete counts calls, since the realm and legacy keys are
separate deletes), recordingStore.Store, the ambientReportingManager decorator,
and the stubProvider block in pkg/auth/types, which now also states why those
methods return zero values.

Docstring coverage on functions this branch adds: 100% (75/75), up from 46/95.
The function count fell because of the dedup, not because anything was hidden.

Lint unchanged at 242 findings vs 243 on the base commit, with zero findings in
the edited files. No behavior change; all auth and cmd/auth tests pass.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018E2ZZsjCoEsJVF8mXgJwoN
CodeRabbit flagged that every ambient logout test pre-populated the store before
calling Logout, so the delete always succeeded. Following that up turned out to
expose a real regression from this branch rather than just a test gap.

Because ambient chains never write to the keyring, the normal state at logout is
that no entry exists. This branch forces the deletion for ambient chains, the
forced delete then misses, and the miss was accumulated into ErrPartialLogout —
so `atmos auth logout <gcp-adc-identity>` reported a failure on a perfectly
clean system. The existing tests could not catch it: testStore.Delete always
returns nil, so no delete ever fails there.

The two reasons for deleting are now tracked separately. A deletion the user
explicitly asked for via --keychain still reports failures; one forced because
the chain is ambient is best-effort, logging the miss instead of returning it.

LogoutProvider had a second instance of the same mistake: it passed its
already-forced flag down to the per-identity Logout, which made that call treat
an ambient-forced delete as explicitly requested and report the miss. It now
passes the user's original request and lets each identity re-derive its own
forcing.

Also extracts deleteProviderKeyringEntries, shared by LogoutProvider and
LogoutAll, which were carrying near-identical copies of the deletion block.

Tests use the realm-aware store double, which returns ErrCredentialsNotFound for
a missing key and so can actually reproduce this, and cover all three entry
points plus the negative path: an explicit --keychain delete that fails must
still surface, so the new tolerance cannot swallow genuine keyring errors.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018E2ZZsjCoEsJVF8mXgJwoN
@thejrose1984
thejrose1984 force-pushed the claude/github-issue-2695-4d2p62 branch from 02ceb81 to 3b953a0 Compare July 29, 2026 13:49

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@website/docs/cli/commands/auth/logout.mdx`:
- Around line 271-277: Update the “Ambient Providers” note in the logout
documentation to list azure/cli, azure/oidc, and github/oidc alongside gcp/adc
and gcp/workload-identity-federation, preserving the explanation that logout
always clears their keychain entries and login re-resolves credentials.

In `@website/docs/cli/configuration/auth/providers.mdx`:
- Around line 542-546: Update the “Credentials are never cached” note to state
that gcp/workload-identity-federation re-reads its configured OIDC token source
on every authentication, covering url, file, and environment modes. Preserve the
existing explanation that Atmos does not write resulting tokens or derived
credentials to the keyring.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 9bfc46c3-a597-4665-b9ba-2da58ef75bd0

📥 Commits

Reviewing files that changed from the base of the PR and between 02ceb81 and 3b953a0.

📒 Files selected for processing (22)
  • cmd/auth/logout.go
  • cmd/auth/logout_test.go
  • pkg/auth/manager_ambient_provider_test.go
  • pkg/auth/manager_chain.go
  • pkg/auth/manager_logout.go
  • pkg/auth/manager_whoami.go
  • pkg/auth/providers/atmospro/provider_test.go
  • pkg/auth/providers/azure/cli.go
  • pkg/auth/providers/azure/oidc.go
  • pkg/auth/providers/azure/oidc_test.go
  • pkg/auth/providers/gcp_adc/doc.go
  • pkg/auth/providers/gcp_adc/provider.go
  • pkg/auth/providers/gcp_adc/provider_test.go
  • pkg/auth/providers/gcp_wif/doc.go
  • pkg/auth/providers/gcp_wif/provider.go
  • pkg/auth/providers/gcp_wif/provider_test.go
  • pkg/auth/providers/github/oidc.go
  • pkg/auth/providers/github/oidc_test.go
  • pkg/auth/types/ambient.go
  • pkg/auth/types/ambient_test.go
  • website/docs/cli/commands/auth/logout.mdx
  • website/docs/cli/configuration/auth/providers.mdx
🚧 Files skipped from review as they are similar to previous changes (17)
  • pkg/auth/types/ambient_test.go
  • pkg/auth/providers/gcp_wif/doc.go
  • pkg/auth/providers/gcp_adc/doc.go
  • pkg/auth/providers/gcp_adc/provider_test.go
  • pkg/auth/providers/gcp_adc/provider.go
  • pkg/auth/providers/atmospro/provider_test.go
  • pkg/auth/providers/azure/oidc_test.go
  • pkg/auth/providers/azure/oidc.go
  • pkg/auth/manager_whoami.go
  • pkg/auth/providers/github/oidc.go
  • pkg/auth/providers/gcp_wif/provider_test.go
  • pkg/auth/types/ambient.go
  • cmd/auth/logout.go
  • pkg/auth/providers/github/oidc_test.go
  • cmd/auth/logout_test.go
  • pkg/auth/manager_chain.go
  • pkg/auth/manager_logout.go

Addresses two CodeRabbit review comments, both of which were right.

The "Ambient Providers" note in the logout docs still listed only the two GCP
providers. It was written when those were the only ones, and was never updated
when azure/cli, azure/oidc, and github/oidc were added to the same behavior — so
it under-described what logout actually does. It now names all five, grouped by
where each one re-resolves from, and states that logout does not fail when there
is no entry to remove, which is the normal state for these providers.

The workload-identity-federation note said the OIDC token is re-read "from the
environment", which contradicts the documented url / file / environment
token_source modes right above it. It now refers to the configured token_source.

Applied the same correction to the azure/oidc note, which had the identical
"from ambient state" vagueness CodeRabbit objected to and would have read as
wrong for anyone using spec.token_file_path. The github/oidc and azure/cli notes
were already specific and are unchanged.

Docs only, no behavior change. Verified with a full Docusaurus build: succeeds,
and neither file appears in any warning.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018E2ZZsjCoEsJVF8mXgJwoN
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 29, 2026
Closes the Codecov patch-coverage gap. Both branches are worth testing on their
own merits rather than for the number:

- purgeCachedCredentials, when the realm-scoped delete finds nothing. That is
  the ordinary case once this branch is in place, since ambient chains never
  write to the keyring, and it is the same class of miss that produced the
  partial-logout regression fixed earlier. The test asserts the purge stays
  silent and still attempts both the realm-scoped and legacy keys.

- The session-token arm of authenticateWithProvider's switch. That branch
  predates this work, but this branch restructured the surrounding if/else into
  a switch and added the ambient case above it, so the test pins that a
  non-ambient provider minting session tokens still bypasses the keyring and was
  not silently folded into the caching default.

Both use the realm-aware store double, which returns ErrCredentialsNotFound for
a missing key; testStore.Delete always returns nil and cannot reach the first
branch at all.

Patch coverage on statements this branch adds: 100% (233/233), measured against
the branch base.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018E2ZZsjCoEsJVF8mXgJwoN
@thejrose1984

Copy link
Copy Markdown
Contributor Author

Code RabBit (@CodeRabbit) review

@coderabbitai

coderabbitai Bot commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@aknysh Andriy Knysh (aknysh) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks thejrose1984

@aknysh
Andriy Knysh (aknysh) merged commit 6f92049 into cloudposse:main Jul 30, 2026
82 checks passed
@atmos-pro

atmos-pro Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Tip

Atmos Pro  

No affected stacks workflow was detected for this pull request.
If this is expected, no action is needed.
Learn More. Ask AI.

@thejrose1984
thejrose1984 deleted the claude/github-issue-2695-4d2p62 branch July 30, 2026 08:44
@github-actions

Copy link
Copy Markdown

These changes were released in v1.225.0-rc.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch A minor, backward compatible change size/l Large size PR

Projects

None yet

4 participants