Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ request adding CHANGELOG notes for breaking (!) changes and possibly other secti
### Changes

- `client.region` is no longer considered a "credential" property (related to Iceberg REST Catalog API).
- Relaxed the requirements for S3 storage's ARN to allow Polaris to connect to more non-AWS S3 storage appliances.

### Deprecations

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ public static ImmutableAwsStorageConfigurationInfo.Builder builder() {
return ImmutableAwsStorageConfigurationInfo.builder();
}

// Technically, it should be ^arn:(aws|aws-cn|aws-us-gov):iam::(\d{12}):role/.+$,
@JsonIgnore
public static final String ROLE_ARN_PATTERN = "^arn:(aws|aws-us-gov):iam::(\\d{12}):role/.+$";
// Technically, it should be ^arn:(aws|aws-cn|aws-us-gov):iam::(\d{12}):role/.+$, but we've
// generalized it to support non-aws S3 implementations
@JsonIgnore public static final String ROLE_ARN_PATTERN = "^.+:(.*):iam:.*:(.*):role/.+$";

private static final Pattern ROLE_ARN_PATTERN_COMPILED = Pattern.compile(ROLE_ARN_PATTERN);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ public void testValidAllowedLocationPrefix() {
}

@ParameterizedTest
@ValueSource(strings = {"", "arn:aws:iam::0123456:role/jdoe", "aws-cn"})
@ValueSource(strings = {"", "arn:aws:iam:0123456:role/jdoe", "aws-cn"})
public void testInvalidArn(String roleArn) {
String basedLocation = "s3://externally-owned-bucket";
AwsStorageConfigInfo awsStorageConfigModel =
Expand All @@ -278,13 +278,42 @@ public void testInvalidArn(String roleArn) {
switch (roleArn) {
case "" -> "ARN must not be empty";
case "aws-cn" -> "AWS China is temporarily not supported";
default -> "Invalid role ARN format: arn:aws:iam::0123456:role/jdoe";
default -> "Invalid role ARN format: arn:aws:iam:0123456:role/jdoe";
};
Assertions.assertThatThrownBy(() -> CatalogEntity.fromCatalog(realmConfig, awsCatalog))
.isInstanceOf(IllegalArgumentException.class)
.hasMessage(expectedMessage);
}

@ParameterizedTest
@ValueSource(
strings = {
"arn:aws:iam::012345678911:role/rollerblade",
"test:test:iam:region:accountid:role/rollerblade",
"a::iam:::role/rollerblade"
})
public void testValidArn(String roleArn) {
String basedLocation = "s3://externally-owned-bucket";
AwsStorageConfigInfo awsStorageConfigModel =
AwsStorageConfigInfo.builder()
.setRoleArn(roleArn)
.setExternalId("externalId")
.setStorageType(StorageConfigInfo.StorageTypeEnum.S3)
.setAllowedLocations(List.of(basedLocation))
.build();

CatalogProperties prop = new CatalogProperties(basedLocation);
Catalog awsCatalog =
PolarisCatalog.builder()
.setType(Catalog.TypeEnum.INTERNAL)
.setName("name")
.setProperties(prop)
.setStorageConfigInfo(awsStorageConfigModel)
.build();
Assertions.assertThatNoException()
.isThrownBy(() -> CatalogEntity.fromCatalog(realmConfig, awsCatalog));
}

@Test
public void testCatalogTypeDefaultsToInternal() {
String baseLocation = "s3://test-bucket/path";
Expand Down