mirror of
https://github.com/floci-io/floci.git
synced 2026-11-27 07:39:24 -05:00
fix(rds): preserve snapshot partitions in custom regions (#5428)
* fix(rds): preserve snapshot partitions in custom regions * fix(rds): reject relabeled cross-partition snapshot sources
This commit is contained in:
1 parent
fe51d2996d
commit
ad1fbbc9b9
2 files changed
+73
-3
No files matched your search
@@ -1080,9 +1080,10 @@ public class RdsService implements Resettable, ResourceProvider {
|
||||
if (sourceIdentifier != null && sourceIdentifier.startsWith("arn:")) {
|
||||
try {
|
||||
AwsArnUtils.Arn parsed = AwsArnUtils.parse(sourceIdentifier);
|
||||
// A snapshot copies within its partition only, so a source ARN naming another
|
||||
// partition than the target region's is not a snapshot this copy can read.
|
||||
if (!AwsRegions.partitionFor(targetRegion).equals(parsed.partition())
|
||||
// Both regions must belong to the ARN's partition; changing its prefix must
|
||||
// not make a snapshot from another partition eligible for copying.
|
||||
if (!regionResolver.partitionForRegion(targetRegion).equals(parsed.partition())
|
||||
|| !regionResolver.partitionForRegion(parsed.region()).equals(parsed.partition())
|
||||
|| !"rds".equals(parsed.service())
|
||||
|| !parsed.resource().startsWith("snapshot:")) {
|
||||
throw new IllegalArgumentException("not an RDS snapshot ARN");
|
||||
|
||||
Reference in new issue
Block a user