Skip to content

[Bug]: CREATE ICEBERG CATALOG persists plain HTTP URI before HTTPS validation #27199

Closed

Description

@Ariznawlll

Description

When plain HTTP is not explicitly enabled, CREATE ICEBERG CATALOG accepts an http:// REST URI and persists the unusable catalog in mo_catalog.mo_iceberg_catalogs. HTTPS enforcement happens only when the catalog is later used.

This violates the Iceberg catalog configuration contract: insecure catalog URIs should fail before a local catalog record is committed.

Environment

  • Branch: main
  • Commit: 1f9e501594509fb5d2e0284833faf8c3426e2285
  • Deployment: local 1 CN / 1 TN / 1 Log, standard DISK-V2 launch; [cn.frontend.iceberg] enable=true; MO_ICEBERG_ALLOW_PLAIN_HTTP unset

Steps to reproduce

DROP ICEBERG CATALOG IF EXISTS bad_http_1;

CREATE ICEBERG CATALOG bad_http_1 WITH (
  'type'='rest',
  'uri'='http://127.0.0.1:65530/iceberg',
  'warehouse'='s3://x1',
  'auth_mode'='none'
);

SELECT name, uri
FROM mo_catalog.mo_iceberg_catalogs
WHERE name='bad_http_1';

Repeat with bad_http_2 and bad_http_3.

Actual behavior

All three CREATE ICEBERG CATALOG statements succeed and all three HTTP URIs are committed:

bad_http_1  http://127.0.0.1:65530/iceberg
bad_http_2  http://127.0.0.1:65530/iceberg
bad_http_3  http://127.0.0.1:65530/iceberg

When an existing HTTP catalog is used for a scan, MO then returns the expected runtime error:

ERROR 20300 (HY000): ICEBERG_CONFIG_INVALID: Iceberg REST catalog URI must use https unless plain HTTP is explicitly enabled

Thus the HTTPS policy exists, but the DDL path does not apply it before persistence.

Expected behavior

CREATE ICEBERG CATALOG must reject http:// with ICEBERG_CONFIG_INVALID when MO_ICEBERG_ALLOW_PLAIN_HTTP is unset, and must leave no catalog row behind.

Stability and controls

  • Reproducer: 3/3
  • Control: an otherwise equivalent https://catalog.example.com/rest catalog is created successfully; version changes from 1 to 2 after ALTER
  • Runtime HTTPS gate control: an HTTP-backed scan is rejected with ICEBERG_CONFIG_INVALID
  • Failure atomicity/data check: failed validation is expected to create zero rows, but the reproducer creates one persistent row per attempt; explicit cleanup returns the matching catalog count to 0
  • Service health: SELECT 1 and native catalog DDL remain healthy; no panic/restart

Evidence

  • Local output: /private/tmp/iceberg-full-http-gate-3round.out
  • Server version: git_version() = 1f9e50159

Code analysis

Confirmed split in validation paths:

  • pkg/iceberg/catalog/rest.go rejects plain HTTP in restURL unless allowPlainHTTP is enabled.
  • pkg/frontend/iceberg.go persists CREATE ICEBERG CATALOG through InsertCatalogSQL without invoking the REST URI HTTPS validation.

The result is deferred validation: DDL commits a catalog definition that the runtime client will always reject under the same server configuration.

Regression coverage

After the fix, add a stable BVT/embedded SQL case that runs with the HTTP development override disabled and asserts:

  1. HTTP CREATE ICEBERG CATALOG returns ICEBERG_CONFIG_INVALID.
  2. The catalog is absent from mo_catalog.mo_iceberg_catalogs.
  3. HTTPS catalog creation still succeeds.
  4. Inline secrets remain rejected/redacted.

Related

Activity

  1. added this to the MO-202608 milestone on Aug 16, 2026
  2. added
    kind/bug
    on Aug 16, 2026
  3. added theissue type on Aug 16, 2026
  4. added
    ai-easy
    on Aug 17, 2026
  5. Ariznawlll commented on Aug 17, 2026

    @Ariznawlll
    CollaboratorAuthor

    测试版本

    最新 main:484e1969531e7fbf7219b20e34d7ef23e110560b;本地 DISK-V2 单 CN + TN + LogService,Iceberg REST catalog 已启用,plain HTTP override 未设置。

    原问题验证

    原问题是 REST catalog 使用 HTTP URI 时仍被写入 catalog 元数据。最新 main 对 HTTP URI 在持久化前返回 ICEBERG_CONFIG_INVALID: Iceberg REST catalog URI must use https unless plain HTTP is explicitly enabled,查询 mo_catalog.mo_iceberg_catalogs 不存在该名称;HTTPS URI 作为正向控制可以创建并持久化。

    Happy Path 覆盖

    • HTTPS REST URI 创建成功。
    • 创建后的 catalog 元数据可查询,说明成功路径仍可用。

    Unhappy Path 覆盖

    • plain HTTP REST URI 被拒绝。
    • 拒绝发生在元数据写入前,失败后 catalog 表中无残留行。

    白盒验证

    修复提交 1eda266 已包含在测试版本中。

    回归测试

    该场景依赖 MatrixOne Iceberg 配置,未加入默认 MOTR SQL;已在 MOTR PR #113 覆盖矩阵中路由到专用 Iceberg REST E2E。普通 MOTR 运行不应在未配置 REST catalog fixture 时伪造该基线。

    测试证据

    HTTP case 返回上述配置错误且 catalog 行数为 0;HTTPS control 创建成功并可在 mo_catalog.mo_iceberg_catalogs 查询。

    测试结论

    测试通过。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ai-easykind/bug

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions