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

[DBInstance] Add region validation for the attributes AutomaticBackup… #561

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JavierAbella
Copy link

AWS::RDS::DBInstance takes an AWS region name as input without validation and passes it directly into the AWS Java SDK v2 client. This can be specified in the AutomaticBackupReplicationRegion, SourceDBInstanceIdentifier, SourceDBClusterIdentifier properties.

The consequence of not validating this field is both a possible security issue where you could try to hit user-specified URLs, and also when it fails, it gives back a non-friendly error response to the client, making it hard to troubleshoot.

…ReplicationRegion, SourceDBInstanceIdentifier and SourceDBClusterIdentifier
@JavierAbella JavierAbella marked this pull request as ready for review July 31, 2024 05:26
/**
* There are fields in the request (e.g. SourceDBInstanceIdentifier and SourceDBClusterIdentifier) that accept 2 types
* of identifiers: InstanceId or ARN. In the case of containing an ARN, we need to validate that the region is correct,
* as it will be used to contract the client endpoint, and a malformed region would lead to both security issues
Copy link

Choose a reason for hiding this comment

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

typo: "contract" instead of "contact".

Comment on lines +389 to +391
Validations.validateSourceRegion(request.getDesiredResourceState().getAutomaticBackupReplicationRegion());
assertValidRegionFromArnOrIdentifier(request.getDesiredResourceState().getSourceDBInstanceIdentifier());
assertValidRegionFromArnOrIdentifier(request.getDesiredResourceState().getSourceDBClusterIdentifier());
Copy link
Collaborator

@zrfr zrfr Aug 15, 2024

Choose a reason for hiding this comment

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

The error message "Unknown source region" could be misleading for these properties. We should have a different error message for this specific case.

Copy link
Collaborator

@zrfr zrfr left a comment

Choose a reason for hiding this comment

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

We should have a different error message for this specific case.

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