The 'check if table exists' catalog endpoint returns status code <200>. The API docs indicate that it should return status code <204>. I initially posted this as a bug in the PyIceberg repository.
To Reproduce
Here's the script I posted in the PyIceberg issue
#%%
import httpx
import polars as pl
from pyiceberg.catalog import load_catalog
# Assumes this catalog exists and credentials stored in
# .pyiceberg.yaml
# Possibly created using https://github.com/JasperHG90/dagster-pyiceberg-example-polaris/blob/main/scripts/set_up_catalog.py
catalog = load_catalog(
name="dagster_example_catalog",
)
# %% Create a namespace
catalog.create_namespace("example")
# %% Create data and add to table
df = pl.from_dict({
"a": [1, 2, 3],
"b": [4, 5, 6]
}).to_arrow()
catalog.create_table(
identifier="example.table",
schema=df.schema
)
# %% This will return 'False'
catalog.table_exists("example.table")
# %% But querying the 'table exists' Polaris endpoint returns 200
catalog_client = httpx.Client(
base_url="http://polaris:8181/api/catalog/v1",
headers={
"Authorization": "Bearer principal:root;realm:default-realm",
"Content-Type": "application/json",
}
)
# See endpoint here: https://polaris.apache.org/in-dev/unreleased/rest-catalog-open-api/#tag/Catalog-API/operation/tableExists
resp = catalog_client.head(
url="dagster_example_catalog/namespaces/example/tables/table"
)
resp.status_code # 200
This should work with any Polaris instance I suppose. The devcontainer that I use can be found here.
Is this a possible security vulnerability?
Describe the bug
The 'check if table exists' catalog endpoint returns status code <200>. The API docs indicate that it should return status code <204>. I initially posted this as a bug in the PyIceberg repository.
To Reproduce
Here's the script I posted in the PyIceberg issue
This should work with any Polaris instance I suppose. The devcontainer that I use can be found here.
Actual Behavior
It returns a <200> status code.
Expected Behavior
It should return a <204> status code.
Additional context
N/A
System information
Ubuntu 22.04 LTS Polars SHA: 017ebbc