From 2613543253af67755fb8ecd1005fdc91fc3dec65 Mon Sep 17 00:00:00 2001 From: Andrew Xie Date: Mon, 9 Feb 2026 14:43:10 -0500 Subject: [PATCH 1/3] fix: Prevent empty namespace creation --- ice/src/main/java/com/altinity/ice/cli/Main.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ice/src/main/java/com/altinity/ice/cli/Main.java b/ice/src/main/java/com/altinity/ice/cli/Main.java index 014d2ec..ddf8094 100644 --- a/ice/src/main/java/com/altinity/ice/cli/Main.java +++ b/ice/src/main/java/com/altinity/ice/cli/Main.java @@ -628,7 +628,15 @@ void createNamespace( boolean createNamespaceIfNotExists) throws IOException { try (RESTCatalog catalog = loadCatalog()) { - CreateNamespace.run(catalog, Namespace.of(name.split("[.]")), createNamespaceIfNotExists); + String[] split = name.split("[.]"); + for (String level : split) { + if (level.isEmpty()) { + throw new IllegalArgumentException( + "Invalid namespace name: '.' cannot separate empty names"); + } + } + + CreateNamespace.run(catalog, Namespace.of(split), createNamespaceIfNotExists); } } From 861a09c2ee6a818c7d864abf691f51dcab2204ba Mon Sep 17 00:00:00 2001 From: Andrew Xie Date: Fri, 13 Feb 2026 16:53:17 -0500 Subject: [PATCH 2/3] Add scenario test for empty namespace --- .../scenarios/empty-namespace/run.sh.tmpl | 23 +++++++++++++++++++ .../scenarios/empty-namespace/scenario.yaml | 6 +++++ .../main/java/com/altinity/ice/cli/Main.java | 3 +++ 3 files changed, 32 insertions(+) create mode 100644 ice-rest-catalog/src/test/resources/scenarios/empty-namespace/run.sh.tmpl create mode 100644 ice-rest-catalog/src/test/resources/scenarios/empty-namespace/scenario.yaml diff --git a/ice-rest-catalog/src/test/resources/scenarios/empty-namespace/run.sh.tmpl b/ice-rest-catalog/src/test/resources/scenarios/empty-namespace/run.sh.tmpl new file mode 100644 index 0000000..e37d93d --- /dev/null +++ b/ice-rest-catalog/src/test/resources/scenarios/empty-namespace/run.sh.tmpl @@ -0,0 +1,23 @@ +#!/bin/bash +set -e + +echo "Running empty namespace test..." + +for namespace in $INVALID_NAMESPACES; do + if ! {{ICE_CLI}} -c {{CLI_CONFIG}} create-namespace "$namespace"; then + echo "OK create-namespace failed as expected" + else + echo "FAIL create-namespace should have failed with invalid namespace: $namespace" + exit 1 + fi +done + +namespaces=$(curl {{CATALOG_URI}}/v1/namespaces) +expected='{"namespaces":[],"next-page-token":null}' + +if [ "$namespaces" == "$expected" ]; then + echo "OK list of namespaces is empty" +else + echo "FAIL list of namespaces is not empty: $namespaces" + exit 1 +fi diff --git a/ice-rest-catalog/src/test/resources/scenarios/empty-namespace/scenario.yaml b/ice-rest-catalog/src/test/resources/scenarios/empty-namespace/scenario.yaml new file mode 100644 index 0000000..13cdd6c --- /dev/null +++ b/ice-rest-catalog/src/test/resources/scenarios/empty-namespace/scenario.yaml @@ -0,0 +1,6 @@ +name: "Empty Namespace Creation" +description: "Ensures empty namespaces cannot be created" + +env: + # space-separate list of namespaces that should cause an error with create-namespace + INVALID_NAMESPACES: ".. .test .a. a..b" \ No newline at end of file diff --git a/ice/src/main/java/com/altinity/ice/cli/Main.java b/ice/src/main/java/com/altinity/ice/cli/Main.java index ddf8094..a10e1da 100644 --- a/ice/src/main/java/com/altinity/ice/cli/Main.java +++ b/ice/src/main/java/com/altinity/ice/cli/Main.java @@ -635,6 +635,9 @@ void createNamespace( "Invalid namespace name: '.' cannot separate empty names"); } } + if (split.length == 0) { + throw new IllegalArgumentException("Invalid namespace name: name cannot be empty"); + } CreateNamespace.run(catalog, Namespace.of(split), createNamespaceIfNotExists); } From be8331e3bdc642c7ed463092183d5a6d74504f38 Mon Sep 17 00:00:00 2001 From: Andrew Xie Date: Thu, 19 Feb 2026 11:29:16 -0500 Subject: [PATCH 3/3] Fix Docker scenario catalog uri --- .../com/altinity/ice/rest/catalog/DockerScenarioBasedIT.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ice-rest-catalog/src/test/java/com/altinity/ice/rest/catalog/DockerScenarioBasedIT.java b/ice-rest-catalog/src/test/java/com/altinity/ice/rest/catalog/DockerScenarioBasedIT.java index f3fc088..8bfbf92 100644 --- a/ice-rest-catalog/src/test/java/com/altinity/ice/rest/catalog/DockerScenarioBasedIT.java +++ b/ice-rest-catalog/src/test/java/com/altinity/ice/rest/catalog/DockerScenarioBasedIT.java @@ -169,7 +169,8 @@ protected ScenarioTestRunner createScenarioRunner(String scenarioName) throws Ex templateVars.put("CLI_CONFIG", "/tmp/ice-cli.yaml"); templateVars.put("SCENARIO_DIR", "/scenarios/" + scenarioName); templateVars.put("MINIO_ENDPOINT", ""); - templateVars.put("CATALOG_URI", "http://localhost:5000"); + templateVars.put( + "CATALOG_URI", "http://" + catalog.getHost() + ":" + catalog.getMappedPort(5000)); return new ScenarioTestRunner(scenariosDir, templateVars); }