You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@polaris.apache.org by "snazy (via GitHub)" <gi...@apache.org> on 2026/07/20 16:07:13 UTC
[PR] Validate locations when registering tables and views [polaris]
snazy opened a new pull request, #5114:
URL: https://github.com/apache/polaris/pull/5114
(no comment)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Validate locations when registering tables and views [polaris]
Posted by "snazy (via GitHub)" <gi...@apache.org>.
snazy merged PR #5114:
URL: https://github.com/apache/polaris/pull/5114
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Validate locations when registering tables and views [polaris]
Posted by "adutra (via GitHub)" <gi...@apache.org>.
adutra commented on code in PR #5114:
URL: https://github.com/apache/polaris/pull/5114#discussion_r3615911854
##########
runtime/service/src/test/java/org/apache/polaris/service/catalog/iceberg/AbstractLocalIcebergCatalogTest.java:
##########
@@ -2547,6 +2574,197 @@ public void testRegisterTableRejectsExistingView() {
.hasMessageContaining("View with same name already exists");
}
+ @ParameterizedTest
+ @ValueSource(booleans = {false, true})
+ public void testRegisterTableRejectsMetadataFileOutsideAllowedLocations(boolean overwrite) {
+ LocalIcebergCatalog catalog = catalog();
+ Namespace namespace = Namespace.of("register_disallowed_metadata");
+ TableIdentifier table = TableIdentifier.of(namespace, "table");
+ if (requiresNamespaceCreate()) {
+ catalog.createNamespace(namespace);
+ }
+
+ String forbiddenMetadataLocation = "s3://forbidden-bucket/table/metadata/v1.metadata.json";
+
+ Assertions.assertThatThrownBy(
+ () -> catalog.registerTable(table, forbiddenMetadataLocation, overwrite))
+ .isInstanceOf(ForbiddenException.class)
+ .hasMessageContaining("Invalid location");
+ }
+
+ @ParameterizedTest
+ @ValueSource(booleans = {false, true})
+ public void testRegisterTableRejectsTableLocationOutsideAllowedLocations(boolean overwrite) {
+ LocalIcebergCatalog catalog = catalog();
+ Namespace namespace = Namespace.of("register_disallowed_table_location");
+ TableIdentifier table = TableIdentifier.of(namespace, "table");
+ if (requiresNamespaceCreate()) {
+ catalog.createNamespace(namespace);
+ }
+
+ // Metadata file is at an allowed location, but the table location embedded inside it is not.
+ String metadataLocation =
+ STORAGE_LOCATION + "/register_disallowed_table_location/table/metadata/v1.metadata.json";
+
+ fileIO.addFile(
+ metadataLocation,
+ TableMetadataParser.toJson(createSampleTableMetadata("s3://forbidden-bucket/table/"))
+ .getBytes(UTF_8));
+
+ Assertions.assertThatThrownBy(() -> catalog.registerTable(table, metadataLocation, overwrite))
+ .isInstanceOf(ForbiddenException.class)
+ .hasMessageContaining("Invalid location");
+ }
+
+ @ParameterizedTest
+ @ValueSource(booleans = {false, true})
+ public void testRegisterTableRejectsMetadataFileOutsideTableLocation(boolean overwrite) {
+ updateCatalogProperties(
+ Map.of(FeatureConfiguration.ALLOW_EXTERNAL_TABLE_LOCATION.catalogConfig(), "false"));
Review Comment:
```suggestion
Map.of(FeatureConfiguration.ALLOW_EXTERNAL_METADATA_FILE_LOCATION.catalogConfig(), "false"));
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@polaris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org