bug: Iceberg REST catalog on GCS ignores vended gcs.oauth2.token, so data-file reads fail with 403

Open
#21,148 0 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@sundy-li is already working on this.

Since Nov 20, 2026.

Assessment

This issue has not been assessed yet.

Description

Search before asking
  • I had searched in the issues and found no similar issues.
Version

v1.2.964-nightly (97eea5624e). The code below is unchanged on main at a85e50302c. Catalog: Lakekeeper 0.12.4, GCS warehouse with credential vending (STS) enabled.

What's Wrong?

With an Iceberg REST catalog that vends GCS credentials, metadata reads work but every data-file read fails:

[3002]PermissionDenied (permanent) at read ... status: 403 ... service: gcs, path: <table-location>/data/<file>.parquet
=> Caller does not have storage.objects.get access to the Google Cloud Storage object.

The catalog's loadTable response carries gcs.oauth2.token (with gcs.oauth2.token-expires-at, gcs.project-id and gcs.oauth2.refresh-credentials-endpoint) in config. The token is valid: a bearer GET of the same object with it returns 206.

The token is dropped in IcebergFileIO::build_operator (src/common/storage/src/operator.rs). For GCS it maps only gcs.credentials → credential and gcs.project-id → project_id. gcs.oauth2.token falls through the _ arm into the opendal config under its Iceberg name, which opendal ignores, so the operator uses the ambient credentials instead. DESC and a statistics-only count(*) succeed because they go through iceberg-rust's own FileIO, which does map the token.

Mapping "gcs.oauth2.token" => Some("token") (opendal 0.55 GcsConfig::token, which takes precedence over credential) should fix the reads. The vended token also expires, and with_refreshing_credentials (src/query/storages/iceberg/src/credential.rs) only refreshes S3 credentials, so GCS would need the same refresh.

Workaround: give the catalog a static service-account key as "gcs.credentials" = '<base64 key JSON>'. "gcs.credentials-json" doesn't help, because the same mapping ignores it.

How to Reproduce?
  1. A Lakekeeper GCS warehouse with credential vending enabled, and a databend-query whose ambient identity cannot read the bucket.
  2. Any Iceberg table in it (ours was written by another engine).
  3. Run:
CREATE CATALOG lk TYPE = ICEBERG CONNECTION = (
  TYPE = 'rest'
  ADDRESS = 'http://<lakekeeper>:8181/catalog'
  WAREHOUSE = '<warehouse>'
);
DESC lk.ns.t;                  -- OK
SELECT sum(c) FROM lk.ns.t;    -- 403 PermissionDenied on the first data file

Adding "header.X-Iceberg-Access-Delegation" = 'vended-credentials' makes no difference, since Lakekeeper vends the token either way. Single-node query and meta.

Are you willing to submit PR?
  • Yes I am willing to submit a PR!
Dominant language
Rust
Stars
9.5k
Forks
903
Avg merge
2d 13h
Merged PRs (30d)
204

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from databendlabs/databend

All issues in databendlabs/databend

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.