Skip to content

auth Allow override of AWS Resolver URL - #1624

Merged
Ben (Benbentwo) merged 8 commits into
mainfrom
custom-sts-endpoint
Oct 14, 2025
Merged

Ben (Benbentwo) merged 8 commits into
mainfrom
custom-sts-endpoint

Conversation

@Benbentwo

@Benbentwo Ben (Benbentwo) commented Oct 13, 2025 •

Copy link
Copy Markdown
Contributor

what

  • Allows users to override AWS resolver URL for identities and providers of AWS cloud.

why

  • Allows us to override the resolver URL. This is useful in cases where you need to stub out the AWS endpoint.
  • This will be useful for testing and for usage with localstack.

Summary by CodeRabbit

  • New Features

    • Added support for a configurable custom AWS endpoint resolver used by AWS authentication flows; can be configured at identity or provider level (identity takes precedence).
  • Documentation

    • Added guidance and YAML examples for configuring custom AWS endpoints, including a LocalStack usage example.
  • Tests

    • Added unit tests covering resolver precedence, empty/nil configs, extraction logic, and edge cases.
  • Examples

    • Demo updated with a default LocalStack superuser identity for local testing.

@Benbentwo Ben (Benbentwo) added the enhancement New feature or request label Oct 13, 2025
@Benbentwo
Ben (Benbentwo) requested review from a team as code owners October 13, 2025 22:12
@Benbentwo Ben (Benbentwo) added patch A minor, backward compatible change auth labels Oct 13, 2025
@github-actions github-actions Bot added the size/m Medium size PR label Oct 13, 2025
Comment thread pkg/auth/cloud/aws/resolver.go Fixed
Comment thread pkg/auth/cloud/aws/resolver.go Fixed
Comment thread pkg/auth/cloud/aws/resolver.go Fixed
@coderabbitai

coderabbitai Bot commented Oct 13, 2025 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Adds a configurable AWS endpoint resolver and wires it into AWS auth flows so identity or provider configs can supply a custom resolver URL. Documentation, tests, and a LocalStack example identity were added.

Changes

Cohort / File(s) Summary
Resolver core
pkg/auth/cloud/aws/resolver.go, pkg/auth/cloud/aws/resolver_test.go, pkg/auth/cloud/aws/README.md
New AWS resolver types and logic to extract resolver config from identity or provider (identity takes precedence). Produces a config.LoadOptionsFunc for AWS SDK v2. Includes unit tests and documentation with LocalStack example.
AWS identity flows
pkg/auth/identities/aws/assume_role.go, pkg/auth/identities/aws/permission_set.go, pkg/auth/identities/aws/user.go, pkg/auth/identities/aws/assume_role_test.go
AWS config loading refactored to build a configOpts slice (region + optional resolver from identity) and call config.LoadDefaultConfig(ctx, configOpts...). Tests added/updated to cover resolver behavior and region resolution.
AWS provider flows
pkg/auth/providers/aws/saml.go, pkg/auth/providers/aws/sso.go, pkg/auth/providers/aws/saml_test.go, pkg/auth/providers/aws/sso_test.go
Provider code builds configOpts (region + optional resolver from provider spec) and uses loader/config.LoadDefaultConfig with those options. Tests added to verify provider behavior with and without resolver config.
Example config
examples/demo-localstack/atmos.yaml
Adds a default aws/user identity (localstack-superuser) with credentials, region, and a resolver URL pointing at LocalStack (http://localhost:4566).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Caller
  participant Flow as Auth Flow (User/AssumeRole/SSO/SAML)
  participant ResolverSel as Resolver Selector
  participant Loader as AWS SDK Config Loader
  participant AWS as AWS Service
  Note right of ResolverSel: Selects resolver from Identity or Provider (identity wins)
  Caller->>Flow: start auth
  Flow->>ResolverSel: GetResolverConfigOption(identity, provider)
  ResolverSel-->>Flow: resolver option or nil
  Flow->>Loader: LoadDefaultConfig(region, resolver?)
  alt Resolver configured
    Loader->>AWS: use custom endpoint resolver (fixed URL)
  else no resolver
    Loader->>AWS: use default endpoints
  end
  Loader-->>Flow: cfg
  Flow->>AWS: API calls using cfg
  AWS-->>Flow: response
  Flow-->>Caller: result
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested labels

minor

Suggested reviewers

  • osterman
  • RoseSecurity
  • kevcube

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly describes the core enhancement—allowing an AWS resolver URL override in the authentication layer—without extraneous details and aligns directly with the PR’s main objective of enabling custom endpoints for testing and LocalStack usage.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch custom-sts-endpoint

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 and usage tips.

@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

🧹 Nitpick comments (2)
pkg/auth/cloud/aws/resolver.go (2)

3-9: Consider updating to mapstructure v2.

The import uses github.com/mitchellh/mapstructure, but based on learnings, the v2 version is now maintained at github.com/go-viper/mapstructure/v2. While not a blocker, consider updating to the maintained fork for future compatibility.

</review_comment_end -->


51-67: Silent error handling may hide configuration issues.

The mapstructure.Decode error at line 62-63 is silently ignored by returning nil. While this provides graceful degradation, it may hide configuration typos or structure mismatches. Consider logging the decode error at debug level to aid troubleshooting.

Apply this diff:

 	var awsConfig AWSConfig
 	if err := mapstructure.Decode(awsRaw, &awsConfig); err != nil {
+		log.Debug("Failed to decode AWS config", "error", err)
 		return nil
 	}

</review_comment_end -->

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 8464ef4 and 31e8f74.

📒 Files selected for processing (9)
  • examples/demo-localstack/atmos.yaml (1 hunks)
  • pkg/auth/cloud/aws/README.md (1 hunks)
  • pkg/auth/cloud/aws/resolver.go (1 hunks)
  • pkg/auth/cloud/aws/resolver_test.go (1 hunks)
  • pkg/auth/identities/aws/assume_role.go (1 hunks)
  • pkg/auth/identities/aws/permission_set.go (1 hunks)
  • pkg/auth/identities/aws/user.go (1 hunks)
  • pkg/auth/providers/aws/saml.go (2 hunks)
  • pkg/auth/providers/aws/sso.go (2 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
pkg/**/*.go

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

Place business logic in pkg rather than in cmd

Files:

  • pkg/auth/identities/aws/assume_role.go
  • pkg/auth/identities/aws/user.go
  • pkg/auth/providers/aws/saml.go
  • pkg/auth/cloud/aws/resolver.go
  • pkg/auth/cloud/aws/resolver_test.go
  • pkg/auth/providers/aws/sso.go
  • pkg/auth/identities/aws/permission_set.go
**/*.go

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

**/*.go: All code must pass golangci-lint checks
Follow Go error handling idioms and use meaningful error messages
Wrap errors with context using fmt.Errorf("context: %w", err)
Consider custom error types for domain-specific errors
Follow standard Go coding style; run gofmt and goimports
Use snake_case for environment variables
Document complex logic with inline comments

**/*.go: All comments must end with periods across all Go code (godot linter enforced).
Organize imports into three groups (stdlib, 3rd-party, Atmos) separated by blank lines and sorted alphabetically within groups; preserve existing aliases.
Add defer perf.Track(<atmosConfig|nil>, ".")() at the start of all public and critical private functions, followed by a blank line.
All errors must be wrapped using static errors from errors/errors.go; prefer errors.Join for multiple errors, fmt.Errorf with %w for context, and check with errors.Is; never use dynamic errors directly.
Use utils.PrintfMarkdown() to render embedded markdown examples for CLI help output.
Co-locate unit tests with implementation files; integration tests reside under tests/.
Distinguish UI output from logging: UI prompts/status/errors to stderr; data/results to stdout; logging for system/debug info only with structured fields.
Most text UI must go to stderr; only data/results to stdout. Prefer utils.PrintfMessageToTUI for UI messages.
Bind all environment variables with viper.BindEnv(); every env var must have an ATMOS_ alternative binding.
Favor cross-platform code: prefer SDKs over external binaries, use filepath/os/runtime, and handle OS-specific differences or use build tags.
For non-standard execution paths, capture telemetry using telemetry.CaptureCmd or telemetry.CaptureCmdString without collecting user data.
Search for existing methods and utilities (internal/exec, pkg/) before implementing new functionality; prefer reuse/refactoring over duplication.

Files:

  • pkg/auth/identities/aws/assume_role.go
  • pkg/auth/identities/aws/user.go
  • pkg/auth/providers/aws/saml.go
  • pkg/auth/cloud/aws/resolver.go
  • pkg/auth/cloud/aws/resolver_test.go
  • pkg/auth/providers/aws/sso.go
  • pkg/auth/identities/aws/permission_set.go
**/!(*_test).go

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

Document all exported functions, types, and methods with Go doc comments

Files:

  • pkg/auth/identities/aws/assume_role.go
  • pkg/auth/identities/aws/user.go
  • pkg/auth/providers/aws/saml.go
  • pkg/auth/cloud/aws/resolver.go
  • pkg/auth/providers/aws/sso.go
  • pkg/auth/identities/aws/permission_set.go
**/*_test.go

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

**/*_test.go: Every new feature must include comprehensive unit tests
Test both happy paths and error conditions
Use table-driven tests for multiple scenarios

**/*_test.go: Write unit tests as table-driven tests focused on behavior; prefer high coverage for pkg/ and internal/exec/; comments must end with periods.
Use t.Skipf with a reason instead of t.Skip; never skip without a reason.
Test files must mirror implementation file names (e.g., aws_ssm_store_test.go pairs with aws_ssm_store.go).

Files:

  • pkg/auth/cloud/aws/resolver_test.go
pkg/**/*_test.go

📄 CodeRabbit inference engine (CLAUDE.md)

Place unit tests for packages under pkg/ as *_test.go files.

Files:

  • pkg/auth/cloud/aws/resolver_test.go
🧬 Code graph analysis (6)
pkg/auth/identities/aws/assume_role.go (1)
pkg/auth/cloud/aws/resolver.go (1)
  • GetResolverConfigOption (25-47)
pkg/auth/identities/aws/user.go (1)
pkg/auth/cloud/aws/resolver.go (1)
  • GetResolverConfigOption (25-47)
pkg/auth/providers/aws/saml.go (1)
pkg/auth/cloud/aws/resolver.go (1)
  • GetResolverConfigOption (25-47)
pkg/auth/cloud/aws/resolver_test.go (1)
pkg/auth/cloud/aws/resolver.go (1)
  • GetResolverConfigOption (25-47)
pkg/auth/providers/aws/sso.go (2)
pkg/auth/cloud/aws/resolver.go (1)
  • GetResolverConfigOption (25-47)
errors/errors.go (1)
  • ErrAuthenticationFailed (332-332)
pkg/auth/identities/aws/permission_set.go (1)
pkg/auth/cloud/aws/resolver.go (1)
  • GetResolverConfigOption (25-47)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
  • GitHub Check: Build (macos-latest, macos)
  • GitHub Check: Build (windows-latest, windows)
  • GitHub Check: Analyze (go)
  • GitHub Check: Lint (golangci)
  • GitHub Check: Lint (golangci)
  • GitHub Check: Analyze (go)
  • GitHub Check: Lint (golangci)
  • GitHub Check: Analyze (go)
  • GitHub Check: Analyze (go)
  • GitHub Check: Lint (golangci)
  • GitHub Check: Summary
🔇 Additional comments (9)
examples/demo-localstack/atmos.yaml (1)

27-39: LGTM! LocalStack configuration is correct.

The authentication configuration properly demonstrates the new resolver feature with appropriate test credentials and the standard LocalStack endpoint. This serves as a good reference example for users.

</review_comment_end -->

pkg/auth/identities/aws/assume_role.go (1)

44-54: Clean integration of resolver option.

The dynamic config options pattern correctly integrates the custom endpoint resolver while maintaining backward compatibility. The conditional appending ensures the resolver is only used when configured.

</review_comment_end -->

pkg/auth/identities/aws/permission_set.go (1)

227-242: Consistent resolver integration.

The implementation follows the same pattern as other identity types, ensuring uniform resolver support across all AWS authentication flows.

</review_comment_end -->

pkg/auth/providers/aws/saml.go (2)

20-20: Good import alias choice.

The awsCloud alias prevents collision with the AWS SDK import and clearly indicates the package scope.

</review_comment_end -->


241-252: Provider-level resolver correctly integrated.

The SAML provider correctly passes nil for identity and p.config for provider to GetResolverConfigOption, implementing the documented precedence behavior (identity > provider).

</review_comment_end -->

pkg/auth/cloud/aws/README.md (1)

1-78: Excellent documentation.

The README clearly explains the resolver feature, configuration options, precedence rules, and provides practical examples. The implementation details section helps developers understand the underlying mechanism.

</review_comment_end -->

pkg/auth/cloud/aws/resolver_test.go (1)

10-103: Comprehensive test coverage.

The tests validate all key behaviors: nil handling, identity precedence over provider, fallback to provider, empty URL handling, and extraction logic. The test structure is clear and follows Go testing conventions.

</review_comment_end -->

pkg/auth/identities/aws/user.go (1)

163-179: User identity resolver integration complete.

The resolver option is correctly integrated into the session token generation flow, maintaining consistency with other identity types.

</review_comment_end -->

pkg/auth/providers/aws/sso.go (1)

91-94: Use errors.Join for wrapping and cover resolver path in tests.

  • Replace the current wrap with errors.Join, e.g.:
-   return nil, fmt.Errorf("%w: failed to load AWS config: %v", errUtils.ErrAuthenticationFailed, err)
+   return nil, errors.Join(errUtils.ErrAuthenticationFailed, fmt.Errorf("failed to load AWS config: %w", err))
  • Add or extend tests in pkg/auth/providers/aws/sso_test.go to exercise the resolver configuration logic (lines 86–88).

Comment thread pkg/auth/cloud/aws/resolver.go Resolved
Comment thread pkg/auth/providers/aws/sso.go Resolved
@codecov

codecov Bot commented Oct 13, 2025 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.27848% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.55%. Comparing base (8464ef4) to head (43f31d4).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pkg/auth/providers/aws/sso.go 58.33% 3 Missing and 2 partials ⚠️
pkg/auth/identities/aws/permission_set.go 50.00% 2 Missing and 1 partial ⚠️
pkg/auth/identities/aws/user.go 66.66% 2 Missing and 1 partial ⚠️
pkg/auth/providers/aws/saml.go 70.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1624      +/-   ##
==========================================
+ Coverage   64.49%   64.55%   +0.05%     
==========================================
  Files         333      334       +1     
  Lines       37469    37536      +67     
==========================================
+ Hits        24167    24231      +64     
+ Misses      11350    11346       -4     
- Partials     1952     1959       +7     
Flag Coverage Δ
unittests 64.55% <82.27%> (+0.05%) ⬆️

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

Files with missing lines Coverage Δ
pkg/auth/cloud/aws/resolver.go 100.00% <100.00%> (ø)
pkg/auth/identities/aws/assume_role.go 85.63% <100.00%> (+0.84%) ⬆️
pkg/auth/identities/aws/permission_set.go 53.21% <50.00%> (-0.40%) ⬇️
pkg/auth/identities/aws/user.go 64.28% <66.66%> (-0.40%) ⬇️
pkg/auth/providers/aws/saml.go 75.74% <70.00%> (-0.47%) ⬇️
pkg/auth/providers/aws/sso.go 65.30% <58.33%> (-2.56%) ⬇️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions Bot added size/l Large size PR and removed size/m Medium size PR labels Oct 13, 2025

@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

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 31e8f74 and 5bc5ddf.

📒 Files selected for processing (6)
  • pkg/auth/cloud/aws/README.md (1 hunks)
  • pkg/auth/cloud/aws/resolver.go (1 hunks)
  • pkg/auth/cloud/aws/resolver_test.go (1 hunks)
  • pkg/auth/providers/aws/saml_test.go (1 hunks)
  • pkg/auth/providers/aws/sso.go (2 hunks)
  • pkg/auth/providers/aws/sso_test.go (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • pkg/auth/cloud/aws/README.md
  • pkg/auth/providers/aws/saml_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • pkg/auth/cloud/aws/resolver_test.go
  • pkg/auth/cloud/aws/resolver.go
🧰 Additional context used
📓 Path-based instructions (5)
pkg/**/*.go

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

Place business logic in pkg rather than in cmd

Files:

  • pkg/auth/providers/aws/sso.go
  • pkg/auth/providers/aws/sso_test.go
**/*.go

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

**/*.go: All code must pass golangci-lint checks
Follow Go error handling idioms and use meaningful error messages
Wrap errors with context using fmt.Errorf("context: %w", err)
Consider custom error types for domain-specific errors
Follow standard Go coding style; run gofmt and goimports
Use snake_case for environment variables
Document complex logic with inline comments

**/*.go: All comments must end with periods across all Go code (godot linter enforced).
Organize imports into three groups (stdlib, 3rd-party, Atmos) separated by blank lines and sorted alphabetically within groups; preserve existing aliases.
Add defer perf.Track(<atmosConfig|nil>, ".")() at the start of all public and critical private functions, followed by a blank line.
All errors must be wrapped using static errors from errors/errors.go; prefer errors.Join for multiple errors, fmt.Errorf with %w for context, and check with errors.Is; never use dynamic errors directly.
Use utils.PrintfMarkdown() to render embedded markdown examples for CLI help output.
Co-locate unit tests with implementation files; integration tests reside under tests/.
Distinguish UI output from logging: UI prompts/status/errors to stderr; data/results to stdout; logging for system/debug info only with structured fields.
Most text UI must go to stderr; only data/results to stdout. Prefer utils.PrintfMessageToTUI for UI messages.
Bind all environment variables with viper.BindEnv(); every env var must have an ATMOS_ alternative binding.
Favor cross-platform code: prefer SDKs over external binaries, use filepath/os/runtime, and handle OS-specific differences or use build tags.
For non-standard execution paths, capture telemetry using telemetry.CaptureCmd or telemetry.CaptureCmdString without collecting user data.
Search for existing methods and utilities (internal/exec, pkg/) before implementing new functionality; prefer reuse/refactoring over duplication.

Files:

  • pkg/auth/providers/aws/sso.go
  • pkg/auth/providers/aws/sso_test.go
**/!(*_test).go

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

Document all exported functions, types, and methods with Go doc comments

Files:

  • pkg/auth/providers/aws/sso.go
**/*_test.go

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

**/*_test.go: Every new feature must include comprehensive unit tests
Test both happy paths and error conditions
Use table-driven tests for multiple scenarios

**/*_test.go: Write unit tests as table-driven tests focused on behavior; prefer high coverage for pkg/ and internal/exec/; comments must end with periods.
Use t.Skipf with a reason instead of t.Skip; never skip without a reason.
Test files must mirror implementation file names (e.g., aws_ssm_store_test.go pairs with aws_ssm_store.go).

Files:

  • pkg/auth/providers/aws/sso_test.go
pkg/**/*_test.go

📄 CodeRabbit inference engine (CLAUDE.md)

Place unit tests for packages under pkg/ as *_test.go files.

Files:

  • pkg/auth/providers/aws/sso_test.go
🧬 Code graph analysis (2)
pkg/auth/providers/aws/sso.go (2)
pkg/auth/cloud/aws/resolver.go (1)
  • GetResolverConfigOption (25-49)
errors/errors.go (1)
  • ErrAuthenticationFailed (332-332)
pkg/auth/providers/aws/sso_test.go (1)
pkg/auth/providers/aws/sso.go (1)
  • NewSSOProvider (36-58)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Build (windows-latest, windows)
  • GitHub Check: Lint (golangci)
  • GitHub Check: Analyze (go)
  • GitHub Check: Summary
🔇 Additional comments (2)
pkg/auth/providers/aws/sso_test.go (1)

208-253: Test coverage looks solid.

Both tests appropriately verify that the provider constructor handles custom resolver configuration in the Spec field. Accessing private fields directly (lines 227-228) is idiomatic for Go tests in the same package.

pkg/auth/providers/aws/sso.go (1)

80-94: Implementation looks good.

The config options pattern cleanly integrates the optional custom resolver. Passing nil for identity is correct—SSO authentication occurs before an identity exists, so the resolver correctly falls back to provider config.

Comment thread pkg/auth/providers/aws/sso_test.go Resolved
Comment thread pkg/auth/providers/aws/sso_test.go Resolved

@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: 3

🧹 Nitpick comments (1)
pkg/auth/providers/aws/sso_test.go (1)

231-236: Assert resolver URL value.

Great start. Let’s also assert the nested resolver URL so this test trips if the URL gets dropped.

Apply this diff:

 	assert.NotNil(t, p.config.Spec)
 	awsSpec, ok := p.config.Spec["aws"]
 	assert.True(t, ok)
 	assert.NotNil(t, awsSpec)
+
+	awsConfig, ok := awsSpec.(map[string]interface{})
+	require.True(t, ok)
+	resolverConfig, ok := awsConfig["resolver"].(map[string]interface{})
+	require.True(t, ok)
+	assert.Equal(t, "http://localhost:4566", resolverConfig["url"])
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 5bc5ddf and 979547c.

📒 Files selected for processing (2)
  • pkg/auth/identities/aws/assume_role_test.go (1 hunks)
  • pkg/auth/providers/aws/sso_test.go (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
pkg/**/*.go

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

Place business logic in pkg rather than in cmd

Files:

  • pkg/auth/identities/aws/assume_role_test.go
  • pkg/auth/providers/aws/sso_test.go
**/*_test.go

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

**/*_test.go: Every new feature must include comprehensive unit tests
Test both happy paths and error conditions
Use table-driven tests for multiple scenarios

**/*_test.go: Write unit tests as table-driven tests focused on behavior; prefer high coverage for pkg/ and internal/exec/; comments must end with periods.
Use t.Skipf with a reason instead of t.Skip; never skip without a reason.
Test files must mirror implementation file names (e.g., aws_ssm_store_test.go pairs with aws_ssm_store.go).

Files:

  • pkg/auth/identities/aws/assume_role_test.go
  • pkg/auth/providers/aws/sso_test.go
**/*.go

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

**/*.go: All code must pass golangci-lint checks
Follow Go error handling idioms and use meaningful error messages
Wrap errors with context using fmt.Errorf("context: %w", err)
Consider custom error types for domain-specific errors
Follow standard Go coding style; run gofmt and goimports
Use snake_case for environment variables
Document complex logic with inline comments

**/*.go: All comments must end with periods across all Go code (godot linter enforced).
Organize imports into three groups (stdlib, 3rd-party, Atmos) separated by blank lines and sorted alphabetically within groups; preserve existing aliases.
Add defer perf.Track(<atmosConfig|nil>, ".")() at the start of all public and critical private functions, followed by a blank line.
All errors must be wrapped using static errors from errors/errors.go; prefer errors.Join for multiple errors, fmt.Errorf with %w for context, and check with errors.Is; never use dynamic errors directly.
Use utils.PrintfMarkdown() to render embedded markdown examples for CLI help output.
Co-locate unit tests with implementation files; integration tests reside under tests/.
Distinguish UI output from logging: UI prompts/status/errors to stderr; data/results to stdout; logging for system/debug info only with structured fields.
Most text UI must go to stderr; only data/results to stdout. Prefer utils.PrintfMessageToTUI for UI messages.
Bind all environment variables with viper.BindEnv(); every env var must have an ATMOS_ alternative binding.
Favor cross-platform code: prefer SDKs over external binaries, use filepath/os/runtime, and handle OS-specific differences or use build tags.
For non-standard execution paths, capture telemetry using telemetry.CaptureCmd or telemetry.CaptureCmdString without collecting user data.
Search for existing methods and utilities (internal/exec, pkg/) before implementing new functionality; prefer reuse/refactoring over duplication.

Files:

  • pkg/auth/identities/aws/assume_role_test.go
  • pkg/auth/providers/aws/sso_test.go
pkg/**/*_test.go

📄 CodeRabbit inference engine (CLAUDE.md)

Place unit tests for packages under pkg/ as *_test.go files.

Files:

  • pkg/auth/identities/aws/assume_role_test.go
  • pkg/auth/providers/aws/sso_test.go
🧠 Learnings (1)
📚 Learning: 2025-10-11T23:25:09.201Z
Learnt from: CR
PR: cloudposse/atmos#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-11T23:25:09.201Z
Learning: Applies to **/*.go : All comments must end with periods across all Go code (godot linter enforced).

Applied to files:

  • pkg/auth/providers/aws/sso_test.go
🧬 Code graph analysis (2)
pkg/auth/identities/aws/assume_role_test.go (3)
pkg/schema/schema_auth.go (1)
  • IdentityVia (42-45)
pkg/auth/identities/aws/assume_role.go (1)
  • NewAssumeRoleIdentity (108-123)
pkg/auth/types/aws_credentials.go (1)
  • AWSCredentials (11-18)
pkg/auth/providers/aws/sso_test.go (1)
pkg/auth/providers/aws/sso.go (1)
  • NewSSOProvider (36-58)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: Build (windows-latest, windows)
  • GitHub Check: Run pre-commit hooks
  • GitHub Check: Analyze (go)
  • GitHub Check: Lint (golangci)
  • GitHub Check: Summary

Comment thread pkg/auth/providers/aws/sso_test.go Resolved
Comment thread pkg/auth/providers/aws/sso_test.go Resolved

@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: 0

♻️ Duplicate comments (4)
pkg/auth/identities/aws/assume_role_test.go (4)

347-347: Missing trailing period (already flagged).

This comment needs a period at the end to satisfy the godot linter.


382-382: Missing trailing period (already flagged).

Add a period to satisfy the godot linter.


401-401: Missing trailing period (already flagged).

End the comment with a period.


439-439: Missing trailing period (already flagged).

Add a period to the comment.

🧹 Nitpick comments (2)
pkg/auth/providers/aws/sso_test.go (2)

230-236: Consider verifying the actual resolver URL value.

The test asserts that config.Spec["aws"] exists but doesn't verify the nested resolver.url value. Since the test is specifically about custom resolver configuration, validate the complete structure:

 	// Verify the provider has the config with resolver.
 	assert.NotNil(t, p.config)
 	assert.NotNil(t, p.config.Spec)
 	awsSpec, ok := p.config.Spec["aws"]
 	assert.True(t, ok)
 	assert.NotNil(t, awsSpec)
+	
+	// Verify resolver URL is preserved.
+	awsMap, ok := awsSpec.(map[string]interface{})
+	require.True(t, ok)
+	resolverSpec, ok := awsMap["resolver"]
+	require.True(t, ok)
+	resolverMap, ok := resolverSpec.(map[string]interface{})
+	require.True(t, ok)
+	assert.Equal(t, "http://localhost:4566", resolverMap["url"])

238-253: Test overlap with existing coverage.

This test overlaps with existing validation tests (e.g., TestSSOProvider_Validate_Simple at lines 69-81). Since absence of resolver config is the default case already covered, consider either merging this into a table-driven test with the custom resolver case or removing it to reduce duplication.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 979547c and 43f31d4.

📒 Files selected for processing (2)
  • pkg/auth/identities/aws/assume_role_test.go (1 hunks)
  • pkg/auth/providers/aws/sso_test.go (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
pkg/**/*.go

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

Place business logic in pkg rather than in cmd

Files:

  • pkg/auth/providers/aws/sso_test.go
  • pkg/auth/identities/aws/assume_role_test.go
**/*_test.go

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

**/*_test.go: Every new feature must include comprehensive unit tests
Test both happy paths and error conditions
Use table-driven tests for multiple scenarios

**/*_test.go: Write unit tests as table-driven tests focused on behavior; prefer high coverage for pkg/ and internal/exec/; comments must end with periods.
Use t.Skipf with a reason instead of t.Skip; never skip without a reason.
Test files must mirror implementation file names (e.g., aws_ssm_store_test.go pairs with aws_ssm_store.go).

Files:

  • pkg/auth/providers/aws/sso_test.go
  • pkg/auth/identities/aws/assume_role_test.go
**/*.go

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

**/*.go: All code must pass golangci-lint checks
Follow Go error handling idioms and use meaningful error messages
Wrap errors with context using fmt.Errorf("context: %w", err)
Consider custom error types for domain-specific errors
Follow standard Go coding style; run gofmt and goimports
Use snake_case for environment variables
Document complex logic with inline comments

**/*.go: All comments must end with periods across all Go code (godot linter enforced).
Organize imports into three groups (stdlib, 3rd-party, Atmos) separated by blank lines and sorted alphabetically within groups; preserve existing aliases.
Add defer perf.Track(<atmosConfig|nil>, ".")() at the start of all public and critical private functions, followed by a blank line.
All errors must be wrapped using static errors from errors/errors.go; prefer errors.Join for multiple errors, fmt.Errorf with %w for context, and check with errors.Is; never use dynamic errors directly.
Use utils.PrintfMarkdown() to render embedded markdown examples for CLI help output.
Co-locate unit tests with implementation files; integration tests reside under tests/.
Distinguish UI output from logging: UI prompts/status/errors to stderr; data/results to stdout; logging for system/debug info only with structured fields.
Most text UI must go to stderr; only data/results to stdout. Prefer utils.PrintfMessageToTUI for UI messages.
Bind all environment variables with viper.BindEnv(); every env var must have an ATMOS_ alternative binding.
Favor cross-platform code: prefer SDKs over external binaries, use filepath/os/runtime, and handle OS-specific differences or use build tags.
For non-standard execution paths, capture telemetry using telemetry.CaptureCmd or telemetry.CaptureCmdString without collecting user data.
Search for existing methods and utilities (internal/exec, pkg/) before implementing new functionality; prefer reuse/refactoring over duplication.

Files:

  • pkg/auth/providers/aws/sso_test.go
  • pkg/auth/identities/aws/assume_role_test.go
pkg/**/*_test.go

📄 CodeRabbit inference engine (CLAUDE.md)

Place unit tests for packages under pkg/ as *_test.go files.

Files:

  • pkg/auth/providers/aws/sso_test.go
  • pkg/auth/identities/aws/assume_role_test.go
🧠 Learnings (2)
📚 Learning: 2025-10-11T23:25:09.224Z
Learnt from: CR
PR: cloudposse/atmos#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-11T23:25:09.224Z
Learning: Applies to **/*.go : All comments must end with periods across all Go code (godot linter enforced).

Applied to files:

  • pkg/auth/providers/aws/sso_test.go
  • pkg/auth/identities/aws/assume_role_test.go
📚 Learning: 2025-10-11T23:25:09.224Z
Learnt from: CR
PR: cloudposse/atmos#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-11T23:25:09.224Z
Learning: Do not bypass pre-commit hooks; fix lint issues and ensure make lint passes before committing.

Applied to files:

  • pkg/auth/providers/aws/sso_test.go
🧬 Code graph analysis (2)
pkg/auth/providers/aws/sso_test.go (1)
pkg/auth/providers/aws/sso.go (1)
  • NewSSOProvider (36-58)
pkg/auth/identities/aws/assume_role_test.go (3)
pkg/schema/schema_auth.go (1)
  • IdentityVia (42-45)
pkg/auth/identities/aws/assume_role.go (1)
  • NewAssumeRoleIdentity (108-123)
pkg/auth/types/aws_credentials.go (1)
  • AWSCredentials (11-18)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: Build (windows-latest, windows)
  • GitHub Check: Build (macos-latest, macos)
  • GitHub Check: Analyze (go)
  • GitHub Check: Lint (golangci)
  • GitHub Check: Summary
🔇 Additional comments (5)
pkg/auth/identities/aws/assume_role_test.go (5)

348-379: Well-structured test for custom resolver.

The test correctly verifies that an identity with a custom resolver configuration can be created and that the resolver config is accessible in the credentials map.


383-398: Solid negative test case.

Confirms the identity functions correctly without a custom resolver, which is important for backward compatibility.


402-436: Appropriate unit test coverage.

Verifies that newSTSClient can be created with a custom resolver configuration without errors. The actual resolver endpoint usage would be an integration test concern.


440-467: Good baseline test.

Ensures the default behavior (no custom resolver) continues to work as expected.


469-534: Excellent table-driven test for region resolution.

The test comprehensively covers the region resolution logic with clear, well-structured test cases. Validates that the region is correctly resolved and persisted on the identity object.

@Benbentwo
Ben (Benbentwo) merged commit a980443 into main Oct 14, 2025
@Benbentwo
Ben (Benbentwo) deleted the custom-sts-endpoint branch October 14, 2025 17:11
@github-actions

Copy link
Copy Markdown

These changes were released in v1.195.0-test.0.

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

Labels

enhancement New feature or request patch A minor, backward compatible change size/l Large size PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants