Repository navigation
fix(secret): skip remote-state reads in credential-free secret list - #2657
Andriy Knysh (aknysh) merged 2 commits into
Conversation
…secret list `atmos secret list -s <stack>` (and `secret list -s <stack> -c <component>` without `--verify`) resolve stack/component config with authentication disabled to avoid one auth cycle per component, but still evaluated `!terraform.state`, `!terraform.output`, and `!store`. With auth disabled, those reads fall back to the default AWS credential chain and ultimately the unreachable EC2 IMDS endpoint, so listing aborts with an assume-role/credentials error even when the user is authenticated. Listing only needs the static `secrets.vars` declarations (secrets.ExtractDeclarations), which never require a resolved value. Add credentialFreeSkip() and use it in enumerateSecretScopes and loadServiceForList (non-verify) so the credentialed read functions are skipped; a skipped function leaves its raw string in place, which the extractor ignores. Authenticated paths (loadServiceAndConfig, `secret list --verify`) keep skipping only `!secret`. Write-up: docs/fixes/2026-06-23-secret-list-credential-free-skip.md Related to cloudposse#2639. Follow-up to cloudposse#2646, which made secret-list enumeration credential-free but left the credentialed function evaluation in place.
|
Tip Atmos Pro
No affected stacks workflow was detected for this pull request. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughIntroduces ChangesCredential-Free Secret List Fix
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2657 +/- ##
==========================================
+ Coverage 80.04% 80.08% +0.04%
==========================================
Files 1361 1361
Lines 127583 127594 +11
==========================================
+ Hits 102129 102190 +61
+ Misses 19790 19744 -46
+ Partials 5664 5660 -4
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Andriy Knysh (aknysh)
left a comment
There was a problem hiding this comment.
thanks Brian Ojeda (@sgtoj)
49ce1d3
into
cloudposse:main
|
Tip Atmos Pro
No affected stacks workflow was detected for this pull request. |
|
These changes were released in v1.222.0-rc.8. |
what
atmos secret listskip the YAML functions that perform authenticated backend reads (!terraform.state,!terraform.output,!store,!store.get) while it enumerates secret declarations.credentialFreeSkip()helper and use it in the two credential-free paths:secret list -s <stack>enumeration and the single-scopesecret list -s <stack> -c <component>path without--verify.get/set/exec/shell, andsecret list --verify) are unchanged — they keep skipping only!secret.TestCredentialFreeSkippinning the skip set and adocs/fixeswrite-up.why
!terraform.state/!terraform.output/!storein componentvars/settings. With auth disabled, the S3 backend assumes its configured role with no base credentials, the AWS SDK falls back to the default credential chain, and ultimately dials the EC2 IMDS endpoint — unreachable on a workstation — so the command aborts with a confusing assume-role/credentials error even immediately after a successfulatmos auth login.secrets.varsdeclarations (secrets.ExtractDeclarations), which never require a resolved value. Evaluating these functions was unnecessary and failure-prone. A skipped function leaves its raw string in place, which the declaration extractor ignores, so discovery is unchanged.secret listauthenticated per component, so these reads had credentials (slow, but working). Disabling auth removed the credentials without removing the reads.references
atmos secret list -s <stack>(without-c) hangs: authenticates once per component across all stacks instead of scoping to the requested stack #2639 (originally reported againstatmos secret list).docs/fixes/2026-06-23-secret-list-credential-free-skip.mdgo test ./cmd/secret/...and the repo'scustom-gcllint (both green), and end-to-end against a multi-account repo whose components reference cross-account!terraform.state:secret list -s <stack>aborted before, completes after (no state reads, no credential-resolution fallbacks).