Skip to content
This repository was archived by the owner on Oct 23, 2025. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants