Repository navigation
fix: restore auth for evaluated list commands - #2801
Conversation
|
Tip Atmos Pro
No affected stacks workflow was detected for this pull request. |
Dependency Review✅ No vulnerabilities or license issues found.Scanned FilesNone |
|
Important Cloud Posse Engineering Team Review RequiredThis pull request modifies files that require Cloud Posse's review. Please be patient, and a core maintainer will review your changes. To expedite this process, reach out to us on Slack in the |
📝 WalkthroughWalkthroughAuthentication initialization now accounts for template and YAML-function evaluation across describe/list commands. Component Terraform output calls preserve parent auth context for authless targets. Warn/lenient Terraform processing no longer degrades backend or credential failures. ChangesEvaluation-driven authentication
Component Terraform output authentication
Terraform error recoverability
Repository metadata updates
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant ListCommand
participant AuthPolicy
participant AuthManager
participant StackEvaluation
ListCommand->>AuthPolicy: pass template and YAML-function flags
AuthPolicy->>AuthManager: create manager when evaluation or explicit identity requires credentials
AuthManager-->>StackEvaluation: provide authentication context
StackEvaluation-->>ListCommand: return evaluated stack data
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
internal/exec/template_funcs_component_test.go (1)
209-210: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winBuild the fixture path portably.
Use
filepath.Join()instead of a literal filesystem path so this test follows the repository’s cross-platform path requirement.As per coding guidelines, use
filepath.Join()for filesystem paths.🤖 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 `@internal/exec/template_funcs_component_test.go` around lines 209 - 210, Update the fixtureDir assignment in the test to construct the path with filepath.Join using its existing path components, preserving the current target directory while making the filesystem path platform-independent.Source: Coding guidelines
🤖 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 `@cmd/list/dependencies.go`:
- Line 155: The identity handling must distinguish an empty identity from an
explicitly disabled identity. In cmd/list/dependencies.go at line 155, set
AuthDisabled only when the identity equals cfg.IdentityFlagDisabledValue so an
empty identity allows the newly created auth manager to run; in
cmd/list/settings.go at line 141, forward the explicit --identity=false state to
ExecuteDescribeStacksWithOptions instead of always passing false.
In `@cmd/list/utils.go`:
- Around line 197-199: Replace the mutable createAuthManagerWithStackScan
package-level seam with a directly testable pure auth-decision predicate or an
injected generated mockable factory; update cmd/list/utils.go lines 197-199
accordingly and remove the sentinel/stub from cmd/list/utils_auth_test.go lines
15-35, rewriting those tests against the extracted policy or generated mock.
---
Nitpick comments:
In `@internal/exec/template_funcs_component_test.go`:
- Around line 209-210: Update the fixtureDir assignment in the test to construct
the path with filepath.Join using its existing path components, preserving the
current target directory while making the filesystem path platform-independent.
🪄 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: 91c75a13-ca28-4363-8f47-ede6d5b057a6
📒 Files selected for processing (19)
cmd/describe_stacks.gocmd/describe_stacks_test.gocmd/list/components.gocmd/list/dependencies.gocmd/list/instances.gocmd/list/metadata.gocmd/list/settings.gocmd/list/sources.gocmd/list/stacks.gocmd/list/utils.gocmd/list/utils_auth_test.gocmd/list/values.gointernal/exec/describe_stacks_component_processor_test.gointernal/exec/template_funcs_component.gointernal/exec/template_funcs_component_test.gointernal/exec/yaml_func_terraform_state.gointernal/exec/yaml_func_terraform_state_yq_defaults_test.gointernal/exec/yaml_func_utils.gointernal/exec/yaml_func_utils_lenient_test.go
The describe-stacks auth-manager gate now also considers ProcessTemplates (fixed in f1839ee), so the pre-existing skip-auth tests that only disabled --process-functions no longer matched the intended behavior. Updates them to disable both templates and functions, and adds a regression test proving auth is still resolved when templates remain enabled. Also adds the docs/fixes record for the nested-auth-inheritance fix. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Dependabot alert #260 (high severity): postcss <= 8.5.17 is vulnerable to path traversal via sourceMappingURL auto-loading, allowing arbitrary .map file disclosure. Bumps the existing pnpm.overrides pin from ^8.5.10 to ^8.5.18 (patched), resolving to 8.5.23. Regenerates pnpm-lock.yaml and NOTICE accordingly; website build verified clean. Not addressed here: Dependabot alert #259 (github.com/google/cel-go, medium severity, GHSA-gcjh-h69q-9w9g) already has a dedicated open remediation PR (#2800) bumping to the patched v0.29.0 — duplicating that bump on this unrelated branch would risk a go.sum conflict with that PR, so it's left to land there. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Rebasing onto the atmos-pro[bot] autocommit left NOTICE referencing grpc-go v1.82.1, which doesn't match this branch's actual go.sum (v1.81.1). Regenerating via scripts/generate-notice.sh restores the accurate, go.sum-derived URL. Co-Authored-By: Claude Sonnet 5 <[email protected]>
There was a problem hiding this comment.
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 `@cmd/describe_skip_auth_test.go`:
- Around line 111-127: Update cmd/describe_skip_auth_test.go:111-127 to use a
test parser that copies both processing flags into DescribeStacksArgs and assert
ProcessTemplates is false; update cmd/describe_skip_auth_test.go:130-164 to set
the templates flag true, copy it into args, and assert the auth-resolution error
occurs before execution; update cmd/describe_skip_auth_test.go:167-207 to reuse
the same parser so the environment-variable guard exercises the actual disabled
values.
In `@docs/fixes/2026-07-24-nested-auth-inheritance.md`:
- Around line 91-92: Update the validation summary in the documentation to state
that the full package run and all three targeted runs passed, replacing the
incorrect reference to four targeted runs while preserving the existing command
descriptions.
🪄 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: b0f97255-ee0b-40a2-9bc0-bb3e4c3a28c0
📒 Files selected for processing (3)
NOTICEcmd/describe_skip_auth_test.godocs/fixes/2026-07-24-nested-auth-inheritance.md
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2801 +/- ##
==========================================
+ Coverage 81.80% 81.83% +0.03%
==========================================
Files 1793 1793
Lines 173037 173104 +67
==========================================
+ Hits 141545 141655 +110
+ Misses 23686 23651 -35
+ Partials 7806 7798 -8
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
- cmd/list/dependencies.go: only treat --identity=false as AuthDisabled; an empty/default identity must still let a newly created auth manager run (matches the pattern already used in cmd/list/instances.go). - cmd/list/settings.go: derive authDisabled from authManager == nil instead of hardcoding false, so an explicit --identity=false is actually honored by ExecuteDescribeStacksWithOptions instead of silently attempting per-component auth resolution. - cmd/describe_skip_auth_test.go: strengthen the three new describe-stacks auth-guard tests to assert ProcessTemplates directly and document why the injected setCliArgsForDescribeStackCli stub is never invoked (getRunnableDescribeStacksCmd always calls the package-level function against the real cmd.Flags()), so the assertions are proven to exercise real behavior rather than pass coincidentally. - docs/fixes/2026-07-24-nested-auth-inheritance.md: fix the Validation section's run count (3 targeted runs, not 4). Co-Authored-By: Claude Sonnet 5 <[email protected]>
…ck interfaces CodeRabbit flagged cmd/list/utils.go's createAuthManagerWithStackScan and internal/exec/template_funcs_component.go's executeComponentFuncTerraformOutputs as bare package-level func vars swapped by hand-written stubs in tests, instead of the project's mandated interface + mockgen pattern. Rather than deferring to a follow-up issue, convert both now, and fold in a third pre-existing instance of the same anti-pattern (internal/exec/terraform_query.go's authManagerFactory) so all three auth-manager-factory seams share one consistent, generated-mock style, matching the existing TerraformOutputGetter convention. Co-Authored-By: Claude Sonnet 5 <[email protected]>
There was a problem hiding this comment.
🧹 Nitpick comments (1)
internal/exec/template_funcs_component.go (1)
49-51: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winAvoid a package-global mutable executor seam.
Tests replace and restore
componentFuncOutputsExecutor; parallel tests or concurrentcomponentFunccalls can observe the wrong executor or race with that assignment. Prefer passing the executor through an internal helper, or synchronize swaps and verify affected tests cannot run concurrently.Also applies to: 131-131
🤖 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 `@internal/exec/template_funcs_component.go` around lines 49 - 51, Remove the package-global mutable componentFuncOutputsExecutor seam and pass the executor through an internal helper used by componentFunc. Update tests to inject their executor explicitly, preserving the defaultComponentFuncOutputsExecutor behavior in production and avoiding shared state during concurrent calls.
🤖 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 `@internal/exec/template_funcs_component.go`:
- Around line 49-51: Remove the package-global mutable
componentFuncOutputsExecutor seam and pass the executor through an internal
helper used by componentFunc. Update tests to inject their executor explicitly,
preserving the defaultComponentFuncOutputsExecutor behavior in production and
avoiding shared state during concurrent calls.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: f012e9c1-f3ca-405a-8004-eaa6cd620603
📒 Files selected for processing (12)
cmd/list/mock_utils.gocmd/list/utils.gocmd/list/utils_auth_test.godocs/fixes/2026-07-24-nested-auth-inheritance.mdinternal/exec/mock_template_funcs_component.gointernal/exec/mock_terraform_query.gointernal/exec/template_funcs_component.gointernal/exec/template_funcs_component_test.gointernal/exec/terraform_all_test.gointernal/exec/terraform_query.gointernal/exec/terraform_query_test.gointernal/exec/terraform_utils_test.go
🚧 Files skipped from review as they are similar to previous changes (3)
- docs/fixes/2026-07-24-nested-auth-inheritance.md
- internal/exec/template_funcs_component_test.go
- cmd/list/utils.go
|
Tip Atmos Pro
No affected stacks workflow was detected for this pull request. |
|
These changes were released in v1.224.1. |
Addresses the remaining CodeRabbit nitpick on cloudposse#2820: stacks and components each had full cross-account fixture coverage (authenticated success plus a customized-output negative path) while `list instances` only had the predicate-level test, despite having the largest value-surfacing surface (--query, --filter, --upload). The new tests drive the real executeListInstancesCmd by swapping the listAuthManagerFactory seam cloudposse#2801 introduced, so they exercise the production skip wiring rather than re-deriving it in the test. The negative path is table-driven over --query, --filter and --columns. Both instances and stacks negative paths now assert errors.Is(err, ErrDescribeComponent) rather than merely requiring an error. Confirmed that is the real cause, so a malformed query or column template can no longer satisfy the test while proving nothing about resolution. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01UtnSvasDtm8t3pWAdvX9ex
Addresses the remaining CodeRabbit nitpick on cloudposse#2820: stacks and components each had full cross-account fixture coverage (authenticated success plus a customized-output negative path) while `list instances` only had the predicate-level test, despite having the largest value-surfacing surface (--query, --filter, --upload). The new tests drive the real executeListInstancesCmd by swapping the listAuthManagerFactory seam cloudposse#2801 introduced, so they exercise the production skip wiring rather than re-deriving it in the test. The negative path is table-driven over --query, --filter and --columns. Both instances and stacks negative paths now assert errors.Is(err, ErrDescribeComponent) rather than merely requiring an error. Confirmed that is the real cause, so a malformed query or column template can no longer satisfy the test while proving nothing about resolution. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01UtnSvasDtm8t3pWAdvX9ex
Addresses the remaining CodeRabbit nitpick on cloudposse#2820: stacks and components each had full cross-account fixture coverage (authenticated success plus a customized-output negative path) while `list instances` only had the predicate-level test, despite having the largest value-surfacing surface (--query, --filter, --upload). The new tests drive the real executeListInstancesCmd by swapping the listAuthManagerFactory seam cloudposse#2801 introduced, so they exercise the production skip wiring rather than re-deriving it in the test. The negative path is table-driven over --query, --filter and --columns. Both instances and stacks negative paths now assert errors.Is(err, ErrDescribeComponent) rather than merely requiring an error. Confirmed that is the real cause, so a malformed query or column template can no longer satisfy the test while proving nothing about resolution. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01UtnSvasDtm8t3pWAdvX9ex
what
--identity=false.atmos.Component()forwards an inherited context to an auth-less nested target.why
references
--stack#2508Summary by CodeRabbit
describe stacksandlistso credentials are prepared only when template processing / YAML-function evaluation is enabled, or when identity is explicitly selected (while respecting the disabled identity sentinel).AuthContextinheritance for nested template/YAML evaluations.