Skip to content
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

test(api): restrict e2e rds instances public access #1875

Merged
merged 11 commits into from
Sep 25, 2023

Conversation

sundersc
Copy link
Contributor

@sundersc sundersc commented Sep 20, 2023

Description of changes

  1. Restrict inbound security role added by E2E tests to smaller CIDR range (example: x.y.0.0/16). Also, now the ports are open for a very short time to execute the initial DDLs to create tables. The total time the port kept open has decreased from an average of 15 minutes to less than 5 seconds.

  2. Improve SSM read parameter timeout issue. Instead of throwing an exception from wait method, now it returns a string which is used to determine whether to throw an error or not. (This avoids incorrect logging of exception message in the cloudwatch logs).

CDK / CloudFormation Parameters Changed

NA

Issue #, if available

NA

Description of how you validated changes

  • Manual test.
  • E2E test in local.

Checklist

  • PR description included
  • yarn test passes
  • Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)
  • New AWS SDK calls or CloudFormation actions have been added to relevant test and service IAM policies
  • Any CDK or CloudFormation parameter changes are called out explicitly

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@sundersc sundersc requested a review from a team as a code owner September 20, 2023 22:25
@sundersc sundersc changed the title Fix e2e public access test(api): restrict e2e rds instances public access Sep 20, 2023
Copy link
Member

@palpatim palpatim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of repetition in the setup code, any chance to centralize & reuse?

@sundersc
Copy link
Contributor Author

A lot of repetition in the setup code, any chance to centralize & reuse?

Addressed it. Moved the complete database setup and port opening logic to the E2E core.


export const getIpRanges = async (): Promise<string[]> => {
return Promise.all(
[IPIFY_URL, AWSCHECKIP_URL].map(async (url) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On my workstation, I get the same result from both services. We should dedupe the result set so we don't create multiple rules with the same IP ranges.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you connected to VPN? If yes, then the IPs would differ. We can't create a duplicate rule. If there is already an entry, the second API call would fail and we ignore the error.

@sundersc sundersc merged commit edc7eaa into feature/rds-support-preview2 Sep 25, 2023
6 of 7 checks passed
@sundersc sundersc deleted the fix-e2e-public-access branch September 25, 2023 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants