Skip to content
Open
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
2 changes: 2 additions & 0 deletions src/Storages/ObjectStorage/DataLakes/Iceberg/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1158,6 +1158,8 @@ MetadataFileWithInfo getLatestOrExplicitMetadataFileAndVersion(
if (data_lake_settings[DataLakeStorageSetting::iceberg_metadata_file_path].changed)
{
auto explicit_metadata_path = data_lake_settings[DataLakeStorageSetting::iceberg_metadata_file_path].value;
if (explicit_metadata_path.find('\0') != String::npos)
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Iceberg metadata file path contains a null byte");
LOG_TEST(log, "Explicit metadata file path is specified {}, will read from this metadata file", explicit_metadata_path);
std::filesystem::path p(explicit_metadata_path);
auto it = p.begin();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def test_metadata_file_path_security(started_cluster_iceberg_with_spark):
)

# Test 2: Null byte injection should be rejected
with pytest.raises(Exception, match = "ICEBERG_SPECIFICATION_VIOLATION"):
with pytest.raises(Exception, match = "BAD_ARGUMENTS"):
create_iceberg_table(
"local",
instance,
Expand All @@ -60,7 +60,7 @@ def test_metadata_file_path_security(started_cluster_iceberg_with_spark):
)

# Test 3: Null byte in middle of path should be rejected
with pytest.raises(Exception, match = "PATH_ACCESS_DENIED"):
with pytest.raises(Exception, match = "BAD_ARGUMENTS"):
create_iceberg_table(
"local",
instance,
Expand Down
Loading