Repository navigation
Support GitHub OIDC Assume Roles with Web Identity - #1738
Conversation
Dependency Review✅ No vulnerabilities or license issues found.Scanned Files
|
📝 WalkthroughWalkthroughAdds OIDC (web identity) support to AWS assume-role authentication, branching Authenticate to handle OIDC or AWS credentials, introduces helpers for web-identity flow, centralizes duration key and default region handling, updates tests, and bumps SDK dependency versions. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Authenticate
participant StdPath as "Standard AWS Path"
participant OIDCPath as "OIDC/Web Identity Path"
participant STS
Client->>Authenticate: Authenticate(credentials)
alt credentials are OIDC
Authenticate->>OIDCPath: buildAssumeRoleWithWebIdentityInput
OIDCPath->>STS: AssumeRoleWithWebIdentity (anonymous config)
STS-->>OIDCPath: STS WebIdentity response (temp creds)
OIDCPath->>Authenticate: toAWSCredentialsFromWebIdentity
else credentials are AWS
Authenticate->>StdPath: build assume-role input (base creds)
StdPath->>STS: AssumeRole (with base creds)
STS-->>StdPath: STS response (temp creds)
StdPath->>Authenticate: toAWSCredentials
else unsupported type
Authenticate-->>Client: error ("base AWS credentials or OIDC credentials are required")
end
Authenticate-->>Client: AWSCredentials (region ensured, default us-east-1)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Suggested labels
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
pkg/auth/providers/github/oidc_test.go (2)
39-136: Consider using testify/mock embedding for cleaner mocks.The mockAuthManager works but is verbose with many stub methods. Consider embedding
mock.Mockand implementing only the methods actually called in tests.Example refactor:
type mockAuthManager struct { + mock.Mock - chain []string - identities map[string]schema.Identity } func (m *mockAuthManager) GetChain() []string { - return m.chain + args := m.Called() + return args.Get(0).([]string) } func (m *mockAuthManager) GetIdentities() map[string]schema.Identity { - return m.identities + args := m.Called() + return args.Get(0).(map[string]schema.Identity) } -// Remove stub methods that return "not implemented" errors -// They can be added via mock.On() when neededBased on learnings.
619-632: Tighten logout error assertions.The current error checking is too permissive and might mask actual bugs. Consider mocking the file system or creating temporary files to test the actual cleanup behavior, or at least verify the specific error type.
Example refactor to test actual cleanup:
func TestOIDCProvider_Logout(t *testing.T) { + // Create a temporary credentials file to test cleanup + tmpDir := t.TempDir() + t.Setenv("HOME", tmpDir) + + // Create AWS credentials directory structure + awsDir := filepath.Join(tmpDir, ".aws") + require.NoError(t, os.MkdirAll(awsDir, 0755)) + credFile := filepath.Join(awsDir, "credentials") + require.NoError(t, os.WriteFile(credFile, []byte("[default]\naws_access_key_id=test\n"), 0644)) + p, err := NewOIDCProvider("github-oidc", validOidcSpec()) require.NoError(t, err) ctx := context.Background() err = p.Logout(ctx) - if err != nil { - assert.True(t, errors.Is(err, errUtils.ErrProviderLogout) || errors.Is(err, errUtils.ErrLogoutFailed)) - } + assert.NoError(t, err) + + // Verify credentials file was removed + _, err = os.Stat(credFile) + assert.True(t, os.IsNotExist(err)) }
📜 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.
📒 Files selected for processing (2)
NOTICE(1 hunks)pkg/auth/providers/github/oidc_test.go(12 hunks)
✅ Files skipped from review due to trivial changes (1)
- NOTICE
🧰 Additional context used
📓 Path-based instructions (3)
pkg/**/*.go
📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
Place business logic in pkg rather than in cmd
Files:
pkg/auth/providers/github/oidc_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
Files:
pkg/auth/providers/github/oidc_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
Files:
pkg/auth/providers/github/oidc_test.go
🧠 Learnings (6)
📓 Common learnings
Learnt from: aknysh
Repo: cloudposse/atmos PR: 944
File: go.mod:206-206
Timestamp: 2025-01-17T00:18:57.769Z
Learning: For indirect dependencies with license compliance issues in the cloudposse/atmos repository, the team prefers to handle them in follow-up PRs rather than blocking the current changes, as these issues often require deeper investigation of the dependency tree.
Learnt from: Listener430
Repo: cloudposse/atmos PR: 934
File: tests/fixtures/scenarios/docs-generate/README.md.gotmpl:99-118
Timestamp: 2025-01-25T03:51:57.689Z
Learning: For the cloudposse/atmos repository, changes to template contents should be handled in dedicated PRs and are typically considered out of scope for PRs focused on other objectives.
Learnt from: Listener430
Repo: cloudposse/atmos PR: 1149
File: internal/exec/go_getter_utils.go:263-264
Timestamp: 2025-03-25T12:24:36.177Z
Learning: Tests for the default Bitbucket username fallback to "x-token-auth" will be added during a future refactoring phase rather than in this PR.
📚 Learning: 2025-09-25T01:02:48.697Z
Learnt from: Benbentwo
Repo: cloudposse/atmos PR: 1475
File: pkg/auth/manager.go:304-312
Timestamp: 2025-09-25T01:02:48.697Z
Learning: The auth manager in pkg/auth/manager.go should remain cloud-agnostic and not contain AWS-specific logic or references to specific cloud providers. Keep the manager generic and extensible.
Applied to files:
pkg/auth/providers/github/oidc_test.go
📚 Learning: 2025-09-23T02:30:42.362Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-09-23T02:30:42.362Z
Learning: Consider using testify/mock for creating mock implementations
Applied to files:
pkg/auth/providers/github/oidc_test.go
📚 Learning: 2025-09-23T02:30:42.362Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-09-23T02:30:42.362Z
Learning: Applies to **/*_test.go : Use table-driven tests for multiple scenarios
Applied to files:
pkg/auth/providers/github/oidc_test.go
📚 Learning: 2025-09-23T02:30:42.362Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-09-23T02:30:42.362Z
Learning: Applies to **/*_test.go : Test both happy paths and error conditions
Applied to files:
pkg/auth/providers/github/oidc_test.go
📚 Learning: 2025-08-15T14:43:41.030Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1352
File: pkg/store/artifactory_store_test.go:108-113
Timestamp: 2025-08-15T14:43:41.030Z
Learning: In test files for the atmos project, it's acceptable to ignore errors from os.Setenv/Unsetenv operations during test environment setup and teardown, as these are controlled test scenarios.
Applied to files:
pkg/auth/providers/github/oidc_test.go
🧬 Code graph analysis (1)
pkg/auth/providers/github/oidc_test.go (5)
pkg/auth/types/interfaces.go (2)
Identity(71-115)Provider(21-58)pkg/auth/providers/github/oidc.go (1)
NewOIDCProvider(46-70)pkg/auth/types/aws_credentials.go (1)
AWSCredentials(16-24)errors/errors.go (2)
ErrProviderLogout(432-432)ErrLogoutFailed(427-427)pkg/schema/schema_auth.go (1)
SessionConfig(38-40)
⏰ 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: Acceptance Tests (macos)
- GitHub Check: Acceptance Tests (windows)
- GitHub Check: Acceptance Tests (linux)
- GitHub Check: Summary
🔇 Additional comments (5)
pkg/auth/providers/github/oidc_test.go (5)
26-37: Mock implementation looks solid.The mockSTSClient follows testify/mock patterns correctly and provides the necessary interface for testing AWS STS interactions.
226-303: Excellent test coverage for PreAuthenticate.This test follows the coding guidelines perfectly with table-driven structure and comprehensive coverage of both success and error scenarios.
470-528: Validation test handles edge cases well.The test correctly distinguishes between validation errors that occur during provider creation versus those caught by the Validate method.
530-540: Environment variable test looks good.Correctly verifies that both AWS_REGION and AWS_DEFAULT_REGION are set to the configured region.
644-816: Comprehensive testing of session management and STS interactions.Both
TestOIDCProvider_RequestedSessionSecondsandTestOIDCProvider_AssumeRoleWithWebIdentityprovide excellent coverage:
- Session duration boundary testing (default, min, max)
- STS mock interactions with proper input validation using
mock.MatchedBy- Error handling scenarios
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1738 +/- ##
==========================================
+ Coverage 70.67% 70.75% +0.08%
==========================================
Files 432 432
Lines 39866 39916 +50
==========================================
+ Hits 28175 28243 +68
+ Misses 9289 9271 -18
Partials 2402 2402
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
These changes were released in v1.197.0-test.33. |
9e5b8f0 to
08cacb1
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
📜 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.
📒 Files selected for processing (2)
pkg/auth/identities/aws/assume_role.go(2 hunks)pkg/auth/identities/aws/assume_role_test.go(2 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.gopkg/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
Files:
pkg/auth/identities/aws/assume_role.gopkg/auth/identities/aws/assume_role_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/identities/aws/assume_role.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
Files:
pkg/auth/identities/aws/assume_role_test.go
🧠 Learnings (3)
📓 Common learnings
Learnt from: aknysh
Repo: cloudposse/atmos PR: 944
File: go.mod:206-206
Timestamp: 2025-01-17T00:18:57.769Z
Learning: For indirect dependencies with license compliance issues in the cloudposse/atmos repository, the team prefers to handle them in follow-up PRs rather than blocking the current changes, as these issues often require deeper investigation of the dependency tree.
Learnt from: Listener430
Repo: cloudposse/atmos PR: 934
File: tests/fixtures/scenarios/docs-generate/README.md.gotmpl:99-118
Timestamp: 2025-01-25T03:51:57.689Z
Learning: For the cloudposse/atmos repository, changes to template contents should be handled in dedicated PRs and are typically considered out of scope for PRs focused on other objectives.
📚 Learning: 2025-09-23T02:30:42.362Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-09-23T02:30:42.362Z
Learning: Applies to **/*_test.go : Test both happy paths and error conditions
Applied to files:
pkg/auth/identities/aws/assume_role_test.go
📚 Learning: 2025-09-09T02:14:36.708Z
Learnt from: Benbentwo
Repo: cloudposse/atmos PR: 1452
File: internal/auth/types/whoami.go:14-15
Timestamp: 2025-09-09T02:14:36.708Z
Learning: The WhoamiInfo struct in internal/auth/types/whoami.go requires the Credentials field to be JSON-serializable for keystore unmarshaling operations, despite security concerns about credential exposure.
Applied to files:
pkg/auth/identities/aws/assume_role_test.go
🧬 Code graph analysis (2)
pkg/auth/identities/aws/assume_role.go (6)
pkg/auth/types/github_oidc_credentials.go (1)
OIDCCredentials(15-19)pkg/auth/types/aws_credentials.go (1)
AWSCredentials(16-24)pkg/logger/log.go (2)
Errorf(59-61)Warn(44-46)errors/errors.go (2)
ErrInvalidIdentityConfig(376-376)ErrAuthenticationFailed(379-379)pkg/auth/cloud/aws/resolver.go (1)
GetResolverConfigOption(25-49)pkg/auth/cloud/aws/env.go (1)
LoadIsolatedAWSConfig(100-124)
pkg/auth/identities/aws/assume_role_test.go (4)
pkg/auth/types/interfaces.go (4)
Identity(71-115)Provider(21-58)ValidationInfo(268-283)ICredentials(254-265)pkg/schema/schema_auth.go (3)
Identity(48-57)IdentityVia(60-63)Provider(21-35)pkg/auth/types/github_oidc_credentials.go (1)
OIDCCredentials(15-19)pkg/auth/types/aws_credentials.go (1)
AWSCredentials(16-24)
⏰ 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). (12)
- GitHub Check: release / goreleaser
- GitHub Check: release / goreleaser
- GitHub Check: Build (windows)
- GitHub Check: Build (linux)
- GitHub Check: Build (linux)
- GitHub Check: Build (windows)
- GitHub Check: Review Dependency Licenses
- GitHub Check: autofix
- GitHub Check: autofix
- GitHub Check: Analyze (go)
- GitHub Check: Review Dependency Licenses
- GitHub Check: Summary
There was a problem hiding this comment.
Actionable comments posted: 1
📜 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.
📒 Files selected for processing (1)
NOTICE(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: aknysh
Repo: cloudposse/atmos PR: 944
File: go.mod:206-206
Timestamp: 2025-01-17T00:18:57.769Z
Learning: For indirect dependencies with license compliance issues in the cloudposse/atmos repository, the team prefers to handle them in follow-up PRs rather than blocking the current changes, as these issues often require deeper investigation of the dependency tree.
Learnt from: Listener430
Repo: cloudposse/atmos PR: 934
File: tests/fixtures/scenarios/docs-generate/README.md.gotmpl:99-118
Timestamp: 2025-01-25T03:51:57.689Z
Learning: For the cloudposse/atmos repository, changes to template contents should be handled in dedicated PRs and are typically considered out of scope for PRs focused on other objectives.
📚 Learning: 2025-09-23T02:30:42.362Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-09-23T02:30:42.362Z
Learning: Applies to go.{mod,sum} : Keep dependencies up to date
Applied to files:
NOTICE
🪛 GitHub Actions: Dependency Review
NOTICE
[error] 1-1: NOTICE file is out of date. Run './scripts/generate-notice.sh' locally and commit the changes.
⏰ 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). (6)
- GitHub Check: [localstack] demo-localstack
- GitHub Check: Acceptance Tests (macos)
- GitHub Check: Acceptance Tests (windows)
- GitHub Check: Acceptance Tests (linux)
- GitHub Check: release / goreleaser
- GitHub Check: Summary
|
These changes were released in v1.198.0-test.12. |
350de01
|
CodeRabbit (@coderabbitai) full review please. |
🧩 Analysis chain🏁 Script executed: Length of output: 22134 🏁 Script executed: Length of output: 35768 🏁 Script executed: Length of output: 207 🏁 Script executed: Length of output: 49 🏁 Script executed: Length of output: 255 🏁 Script executed: Length of output: 209 🏁 Script executed: Length of output: 40 Andriy Knysh (@aknysh) I've completed a comprehensive review of PR #1738. Great news - your comment about using anonymous credentials for web identity has been properly addressed! ✅ Fix VerificationThe anonymous credentials fix is correctly implemented in config.WithCredentialsProvider(aws.AnonymousCredentials{})This is accompanied by excellent inline documentation (lines 159-170) that explains:
🎯 Test CoverageThree dedicated test cases validate the fix:
📋 Overall Implementation ReviewStrengths:
Architecture:
Minor Observations:
🎉 ConclusionThe implementation is production-ready. The anonymous credentials fix addresses the exact issue you identified, preventing the SDK from attempting credential resolution in scenarios where:
The code quality is excellent with thorough documentation and comprehensive test coverage. 🧠 Learnings used✅ Actions performedFull review triggered. |
🧩 Analysis chain🏁 Script executed: Length of output: 22134 🏁 Script executed: Length of output: 15 🏁 Script executed: Length of output: 273575 Andriy Knysh (@aknysh) Thanks. I verified the last commit addresses the comment: in the OIDC path we now explicitly set aws.AnonymousCredentials via config.WithCredentialsProvider(aws.AnonymousCredentials{}) before creating the STS client. This prevents the default credential chain from resolving and allows AssumeRoleWithWebIdentity to proceed without base keys. The change is present in pkg/auth/identities/aws/assume_role.go within assumeRoleWithWebIdentity. Focused full review notes
Conclusion
Would you like me to draft a small unit test covering the OIDC default-region and duration parsing cases? 🏁 Script executed: Length of output: 13614 Andriy Knysh (@aknysh) Confirmed. What I checked
Result
Minor suggestions (non-blocking)
Want me to open a follow-up issue to track the small refactor? 🧠 Learnings used✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
pkg/auth/identities/aws/assume_role.go (1)
251-272: Consider extracting duration parsing logic.The duration parsing code (lines 263-269) is similar to the logic in
buildAssumeRoleInput(lines 109-114). Consider extracting this into a helper method likeparseDuration(principal map[string]any) *int32to reduce duplication and improve maintainability.Example:
func (i *assumeRoleIdentity) parseDuration() *int32 { if durationStr, ok := i.config.Principal[principalDurationKey].(string); ok && durationStr != "" { if duration, err := time.ParseDuration(durationStr); err == nil { return aws.Int32(int32(duration.Seconds())) } log.Warn("Invalid duration specified for assume role", principalDurationKey, durationStr) } return nil }
📜 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.
⛔ Files ignored due to path filters (1)
go.sumis excluded by!**/*.sum
📒 Files selected for processing (4)
NOTICE(4 hunks)go.mod(3 hunks)pkg/auth/identities/aws/assume_role.go(6 hunks)pkg/auth/identities/aws/assume_role_test.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_test.gopkg/auth/identities/aws/assume_role.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
Files:
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
Files:
pkg/auth/identities/aws/assume_role_test.gopkg/auth/identities/aws/assume_role.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
go.{mod,sum}
📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
go.{mod,sum}: Manage dependencies with Go modules
Keep dependencies up to date
Files:
go.mod
🧠 Learnings (17)
📚 Learning: 2025-09-09T02:14:36.708Z
Learnt from: Benbentwo
Repo: cloudposse/atmos PR: 1452
File: internal/auth/types/whoami.go:14-15
Timestamp: 2025-09-09T02:14:36.708Z
Learning: The WhoamiInfo struct in internal/auth/types/whoami.go requires the Credentials field to be JSON-serializable for keystore unmarshaling operations, despite security concerns about credential exposure.
Applied to files:
pkg/auth/identities/aws/assume_role_test.gopkg/auth/identities/aws/assume_role.go
📚 Learning: 2025-11-10T20:03:56.875Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1775
File: pkg/auth/providers/aws/sso_provisioning.go:40-79
Timestamp: 2025-11-10T20:03:56.875Z
Learning: In the Atmos AWS SSO provider (pkg/auth/providers/aws/sso_provisioning.go), the OAuth access token from the AWS SSO device flow is intentionally stored in the `AccessKeyID` field of `AWSCredentials` during authentication. This token is then extracted and used for ListAccounts and ListAccountRoles API calls during identity provisioning. This design reuses the existing `AWSCredentials` type for token transport rather than creating a separate credential type.
Applied to files:
pkg/auth/identities/aws/assume_role_test.gopkg/auth/identities/aws/assume_role.go
📚 Learning: 2025-09-25T01:02:48.697Z
Learnt from: Benbentwo
Repo: cloudposse/atmos PR: 1475
File: pkg/auth/manager.go:304-312
Timestamp: 2025-09-25T01:02:48.697Z
Learning: The auth manager in pkg/auth/manager.go should remain cloud-agnostic and not contain AWS-specific logic or references to specific cloud providers. Keep the manager generic and extensible.
Applied to files:
pkg/auth/identities/aws/assume_role.go
📚 Learning: 2025-01-17T00:18:57.769Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 944
File: go.mod:206-206
Timestamp: 2025-01-17T00:18:57.769Z
Learning: For indirect dependencies with license compliance issues in the cloudposse/atmos repository, the team prefers to handle them in follow-up PRs rather than blocking the current changes, as these issues often require deeper investigation of the dependency tree.
Applied to files:
pkg/auth/identities/aws/assume_role.go
📚 Learning: 2025-01-25T03:51:57.689Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 934
File: tests/fixtures/scenarios/docs-generate/README.md.gotmpl:99-118
Timestamp: 2025-01-25T03:51:57.689Z
Learning: For the cloudposse/atmos repository, changes to template contents should be handled in dedicated PRs and are typically considered out of scope for PRs focused on other objectives.
Applied to files:
pkg/auth/identities/aws/assume_role.go
📚 Learning: 2025-09-10T21:17:55.273Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1466
File: toolchain/http_client_test.go:3-10
Timestamp: 2025-09-10T21:17:55.273Z
Learning: In the cloudposse/atmos repository, imports should never be changed as per samtholiya's coding guidelines.
Applied to files:
pkg/auth/identities/aws/assume_role.go
📚 Learning: 2025-11-08T19:56:18.660Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1697
File: internal/exec/oci_utils.go:0-0
Timestamp: 2025-11-08T19:56:18.660Z
Learning: In the Atmos codebase, when a function receives an `*schema.AtmosConfiguration` parameter, it should read configuration values from `atmosConfig.Settings` fields rather than using direct `os.Getenv()` or `viper.GetString()` calls. The Atmos pattern is: viper.BindEnv in cmd/root.go binds environment variables → Viper unmarshals into atmosConfig.Settings via mapstructure → business logic reads from the Settings struct. This provides centralized config management, respects precedence, and enables testability. Example: `atmosConfig.Settings.AtmosGithubToken` instead of `os.Getenv("ATMOS_GITHUB_TOKEN")` in functions like `getGHCRAuth` in internal/exec/oci_utils.go.
Applied to files:
pkg/auth/identities/aws/assume_role.go
📚 Learning: 2024-12-02T21:26:32.337Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 808
File: pkg/config/config.go:478-483
Timestamp: 2024-12-02T21:26:32.337Z
Learning: In the 'atmos' project, when reviewing Go code like `pkg/config/config.go`, avoid suggesting file size checks after downloading remote configs if such checks aren't implemented elsewhere in the codebase.
Applied to files:
pkg/auth/identities/aws/assume_role.go
📚 Learning: 2025-07-05T20:59:02.914Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1363
File: internal/exec/template_utils.go:18-18
Timestamp: 2025-07-05T20:59:02.914Z
Learning: In the Atmos project, gomplate v4 is imported with a blank import (`_ "github.com/hairyhenderson/gomplate/v4"`) alongside v3 imports to resolve AWS SDK version conflicts. V3 uses older AWS SDK versions that conflict with newer AWS modules used by Atmos. A full migration to v4 requires extensive refactoring due to API changes and should be handled in a separate PR.
Applied to files:
pkg/auth/identities/aws/assume_role.gogo.mod
📚 Learning: 2024-11-18T13:59:10.824Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 768
File: internal/exec/vendor_model_component.go:3-20
Timestamp: 2024-11-18T13:59:10.824Z
Learning: When replacing significant dependencies like `go-getter` that require extensive changes, prefer to address them in separate PRs.
Applied to files:
pkg/auth/identities/aws/assume_role.go
📚 Learning: 2025-09-07T17:38:17.619Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1466
File: website/src/components/Screengrabs/demo-stacks/deploy-dev.html:28-37
Timestamp: 2025-09-07T17:38:17.619Z
Learning: Screengrab files in the CloudPosse/atmos repository are programmatically generated and should be ignored during code reviews. Do not provide suggestions or comments on files in screengrab directories or screengrab-related HTML files.
Applied to files:
pkg/auth/identities/aws/assume_role.go
📚 Learning: 2025-03-18T12:26:25.329Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 1149
File: tests/snapshots/TestCLICommands_atmos_vendor_pull_ssh.stderr.golden:7-7
Timestamp: 2025-03-18T12:26:25.329Z
Learning: In the Atmos project, typos or inconsistencies in test snapshot files (such as "terrafrom" instead of "terraform") may be intentional as they capture the exact output of commands and should not be flagged as issues requiring correction.
Applied to files:
pkg/auth/identities/aws/assume_role.go
📚 Learning: 2025-09-23T02:30:42.362Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-09-23T02:30:42.362Z
Learning: Applies to go.{mod,sum} : Manage dependencies with Go modules
Applied to files:
go.mod
📚 Learning: 2025-09-23T02:30:42.362Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-09-23T02:30:42.362Z
Learning: Applies to go.{mod,sum} : Keep dependencies up to date
Applied to files:
go.mod
📚 Learning: 2025-01-17T00:21:32.987Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 944
File: go.mod:3-3
Timestamp: 2025-01-17T00:21:32.987Z
Learning: Go version 1.23.0 was deliberately introduced by the maintainer (aknysh) in January 2025. While this might be a pre-release or development version of Go, it has been approved for use in this project.
Applied to files:
go.mod
📚 Learning: 2025-01-17T00:21:32.987Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 944
File: go.mod:3-3
Timestamp: 2025-01-17T00:21:32.987Z
Learning: The project uses Go version 1.23.0 which has been confirmed by the maintainer to be working in production for months. Do not flag this as an invalid Go version.
Applied to files:
go.mod
📚 Learning: 2025-11-01T20:24:29.557Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1714
File: NOTICE:0-0
Timestamp: 2025-11-01T20:24:29.557Z
Learning: In the cloudposse/atmos repository, the NOTICE file is programmatically generated and should not be manually edited. Issues with dependency license URLs in NOTICE will be resolved when upstream package metadata is corrected.
Applied to files:
NOTICE
⏰ 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). (6)
- GitHub Check: [localstack] demo-localstack
- GitHub Check: Acceptance Tests (linux)
- GitHub Check: Acceptance Tests (macos)
- GitHub Check: Acceptance Tests (windows)
- GitHub Check: release / goreleaser
- GitHub Check: Summary
🔇 Additional comments (12)
go.mod (1)
11-11: Dependency updates align with OIDC support.The version bumps for Azure SDK, AWS SDK v2 components (config, credentials, s3/manager, sts), and Microsoft Auth Library are appropriate patch/minor updates that support the new OIDC functionality. The STS update to v1.40.0 likely includes improvements relevant to AssumeRoleWithWebIdentity.
Also applies to: 23-25, 30-30, 125-125
NOTICE (1)
110-110: License URL updates match dependency versions.The NOTICE file updates correctly reflect the dependency version bumps from go.mod. Per project standards, this file is programmatically generated, and the changes align with the expected output from the generation script.
Based on learnings
Also applies to: 114-114, 122-122, 178-178, 941-941, 965-965
pkg/auth/identities/aws/assume_role.go (5)
24-31: Constants improve maintainability.The new constants for default region and duration key centralize configuration and make the code more maintainable. The us-east-1 default is standard AWS practice.
151-161: OIDC credential routing is clean and clear.The branching logic properly detects OIDC vs AWS credentials and routes to the appropriate authentication flow. The error message accurately reflects that either credential type is acceptable.
179-249: Web identity implementation follows established patterns.The
assumeRoleWithWebIdentitymethod properly implements OIDC authentication with anonymous credentials (line 222) to prevent SDK credential resolution attempts. The comprehensive documentation explains SDK v2 behavior and potential issues. This aligns with patterns used in sso.go and permission_set.go for bearer token authentication.
274-298: Credential conversion is consistent and thorough.The
toAWSCredentialsFromWebIdentitymethod properly handles nil checks, expiration formatting, and region defaulting. The logic mirrors the standardtoAWSCredentialsmethod, maintaining consistency across authentication flows.
109-109: Centralized duration key improves consistency.Using the
principalDurationKeyconstant for both map access and logging ensures consistency and makes future changes easier to maintain.Also applies to: 113-113
pkg/auth/identities/aws/assume_role_test.go (5)
285-285: Test error message matches implementation.The updated error expectation correctly reflects that both AWS and OIDC credentials are now acceptable input types.
695-867: OIDC test coverage is thorough.The tests for OIDC authentication, input building, and credential conversion cover the happy path, error cases, and edge cases including nil checks, invalid durations, and region defaults. Well structured with clear test names.
869-891: Region default test confirms expected behavior.This test verifies that empty region values default to us-east-1, ensuring credentials always have a valid region. Good coverage of an important edge case.
972-1027: Anonymous credentials test validates critical fix.This test confirms the anonymous credentials fix addresses the credential resolution issue documented in past comments. The test properly verifies that ambient AWS credentials in the environment are not used during web identity authentication, preventing IMDS hangs and signing errors. Excellent documentation of the problem and verification approach.
893-1115: Comprehensive credential handling test coverage.The remaining tests thoroughly cover credential handling scenarios including dual-mode operation (AWS + OIDC), invalid credential types, ambient credential isolation, and flow comparison. The mock credentials implementation properly satisfies the
ICredentialsinterface for testing error paths. This provides strong confidence in the OIDC implementation.
|
These changes were released in v1.198.0-test.13. |
|
These changes were released in v1.198.0. |
what
why
Summary by CodeRabbit
New Features
Bug Fixes
Tests
Documentation
Dependencies