-
Notifications
You must be signed in to change notification settings - Fork 4.3k
fix(ecs_patterns): openListener should be false when custom sg is provided #35297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
bbfbc61
wip
pahud 4d0196c
feat(aws-ecs-patterns): add smart default for openListener with custo…
pahud 540648d
cleanup
pahud 689cf98
fix
pahud d76711f
address reviewing comments
pahud 0148160
Merge branch 'main' into fix-35292-ecs-security-groups
pahud File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| # Implementation Status Report | ||
|
|
||
| ## Changes Made | ||
| - **Files Modified**: | ||
| - `packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-load-balanced-service-base.ts` | ||
| - `packages/aws-cdk-lib/aws-ecs-patterns/test/fargate/load-balanced-fargate-service.test.ts` | ||
| - `packages/aws-cdk-lib/cx-api/lib/features.ts` | ||
| - **New Files Created**: None | ||
| - **Lines of Code**: ~30 lines added/modified | ||
|
|
||
| ## Implementation Details | ||
| - **Core Changes**: Added smart default logic for `openListener` that detects custom security groups on load balancers | ||
| - **API Modifications**: No breaking API changes - only changes default behavior when feature flag is enabled | ||
| - **Error Handling**: No new error handling required - leverages existing CDK patterns | ||
| - **Validation Added**: Smart detection of custom security groups using `loadBalancer.connections.securityGroups.length > 1` | ||
|
|
||
| ## JSII Compatibility | ||
| - **Error Classes Used**: No new error classes needed | ||
| - **Type Safety**: All existing TypeScript types maintained | ||
| - **Cross-Language Support**: No JSII compatibility issues - uses existing CDK patterns | ||
|
|
||
| ## Build Status | ||
| - **Module Build**: Success | ||
| - **JSII Compilation**: Success (no errors in TypeScript compilation) | ||
| - **Linting**: Passed | ||
| - **Unit Tests**: All Passed (226/226 tests passed) | ||
|
|
||
| ## Breaking Changes Prevention | ||
| - **Feature Flag**: Added `@aws-cdk/aws-ecs-patterns:smartDefaultOpenListener` feature flag | ||
| - **Backward Compatibility**: When feature flag is disabled (default), behavior remains exactly the same | ||
| - **Migration Path**: Users can enable the feature flag to get secure defaults, or explicitly set `openListener: true` to override | ||
|
|
||
| ## Feature Flag Implementation | ||
| - **Flag Name**: `ECS_PATTERNS_SMART_DEFAULT_OPEN_LISTENER` | ||
| - **Default Behavior**: Feature disabled (maintains backward compatibility) | ||
| - **When Enabled**: Smart detection of custom security groups to default `openListener` to `false` | ||
| - **Override Capability**: Users can still explicitly set `openListener: true` to override smart default | ||
|
|
||
| ## Testing Coverage | ||
| - **New Tests Added**: 5 comprehensive tests covering: | ||
| 1. Smart default with custom security groups (feature flag enabled) | ||
| 2. Smart default with no custom security groups (feature flag enabled) | ||
| 3. Explicit override with `openListener: true` (feature flag enabled) | ||
| 4. Redirect listener behavior with smart defaults (feature flag enabled) | ||
| 5. Backward compatibility test (feature flag disabled) | ||
| - **Test Results**: All existing and new tests pass | ||
| - **Edge Cases Covered**: Custom security groups, explicit overrides, redirect listeners, backward compatibility | ||
|
|
||
| ## Security Impact | ||
| - **Security Improvement**: When feature flag is enabled, prevents accidental creation of 0.0.0.0/0 ingress rules when users provide custom security groups | ||
| - **No Security Regression**: When feature flag is disabled, behavior is identical to current implementation | ||
| - **User Control**: Users maintain full control via explicit `openListener` parameter | ||
|
|
||
| ## Testing Readiness | ||
| - **Unit Tests**: Complete and passing | ||
| - **Integration Tests**: Existing integration tests continue to pass | ||
| - **Manual Validation**: Ready for manual testing with feature flag enabled/disabled | ||
| - **Regression Tests**: All existing functionality verified through test suite |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.