Skip to content

Iceberg REST catalogs: authenticate as a Google identity (BigLake federation and runtime catalogs), on GCP or off it #2194

Closed

Description

@aaj3f

Google's Iceberg REST catalog (https://biglake.googleapis.com/iceberg/v1/restcatalog) is a really nice way to point Fluree at BigQuery-managed Iceberg tables. A BigLake federation warehouse (bq://projects/<P>/locations/<L>) shows BigQuery datasets as namespaces, a BigLake runtime catalog (bl://projects/<P>/catalogs/<C>) vends per-table credentials, and the existing REST browse / preview / r2rml/generate path drafts a mapping from either with no Fluree-specific work. What's missing is a durable way to authenticate as a Google identity, and it seems none of today's catalog auth modes (fluree-db-iceberg/src/auth/mod.rs) gets there:

  • bearer with a Google access token works for a demo, but the token expires after about an hour and can't renew, so a tracking worker starts answering 401s.
  • oauth2_client_credentials doesn't apply: Google service accounts don't do the client-credentials grant.
  • google_metadata works nicely, but only on GCE/GKE, where the metadata server is reachable.

So a deployment off GCP (AWS Lambda, ECS, EC2, a laptop) has no refreshing way in. On top of that, BigLake bills every request to a quota project named in x-goog-user-project, and refuses a request that names none, for every identity: a 403 at /v1/config ("missing x-goog-user-project header" for a service account or federated token, "requires a quota project" for user credentials). No auth mode today can send that header.

What I think we want is one Google identity behind catalog auth, stored as {"type": "google", "credentials": …, "quota_project": "…", "scopes": "…"}, with four sources for the credential:

  1. external_account: Workload Identity Federation from AWS. I'd make this the recommended one. It's keyless, and nothing secret is stored: the config is what gcloud iam workload-identity-pools create-cred-config … --aws prints. The subject token is a SigV4-signed GetCallerIdentity built from the AWS credential chain (so Lambda, ECS, EC2 and EKS all work), exchanged at sts.googleapis.com, then optionally through service-account impersonation at iamcredentials.googleapis.com. On a host that serves several tenants, the AWS identity that signs should be the tenant's rather than the host's, so an embedder needs a hook to supply per-tenant AWS subject credentials (e.g. an AssumeRole session named for the tenant, which the tenant's WIF provider can then condition on).
  2. service_account: a key JSON, held in an environment variable or a secret reference, never stored literally. Simpler, but only where the org still allows keys (see below).
  3. metadata: today's google_metadata, served by the same identity code. Stored google_metadata records should keep reading and round-tripping unchanged.
  4. application_default: the host's application-default credentials, e.g. after gcloud auth application-default login, for development on your own machine.

Tokens would be cached process-wide (keyed on the identity, never on a secret's value), refreshed single-flight a margin before expiry, keeping a still-valid token if a refresh fails. quota_project goes out as x-goog-user-project on every catalog request, and when BigLake refuses a request for want of one, we answer with a typed error that says to set it.

Some identities aren't carried by the source at all but borrowed from the host: the metadata server, the host's ADC file, and WIF signed with the host's own AWS identity. It seems right for those to be governed by one operator policy (a deployment-time env switch, settable per instance through the API), defaulting to everything allowed so a single-tenant install behaves as before. A token minted from a host identity should only ever be attached to Google's own APIs.

Hand-rolled, not google-cloud-auth. I looked at adopting google-cloud-auth. The credential JSON can name arbitrary token URLs, local files, URLs and executables, so accepting it from a source's config means validating it, and a library is built to follow whatever it's given. It also reads AWS credentials only from env vars or EC2 IMDS (never the ECS container-credentials endpoint), and it pulls google-cloud-gax. A validated subset over the existing CachedToken and hardened HTTP client seems cheaper and stricter: aws-sigv4, aws-config and jsonwebtoken are already in the lockfile, so no new dependencies. The subset would be: credential_source.environment_id = aws1 only (file / url / executable sources refused), Google's STS and IAM credentials endpoints only, no workforce pools.

Every surface, one codec. The same identity should be reachable from HTTP, the CLI and Python, and this is where I think the surfaces need a redesign rather than more flat fields. Today each one translates its own flat auth_* fields into AuthConfig / IoConfig with hand-written code (about eighteen functions), and they've drifted:

  • auth_google_metadata works on /iceberg/map but is silently dropped by browse / preview / verify / generate / validate;
  • a partial OAuth2 set is silently ignored for Iceberg and SQL but refused for Delta;
  • the precedence between auth modes differs per kind;
  • SQL secrets are literal-only over HTTP and the CLI.

What I'd propose:

  • HTTP accepts structured catalog / io objects (SQL: auth; Delta: unity / io) in exactly the stored JSON shape, on every route. The legacy flat fields keep working through one converter per kind.
  • Refusals are a typed 400 that names the field: an unknown field, the two forms mixed, and auth given two ways or only partly.
  • CLI gets shared flag groups (--auth-google-*).
  • Python gets a Google(...) auth class.
  • Rust builders gain with_auth / with_storage_auth, and refuse at validate() a setting the catalog mode can't honor rather than warning and ignoring it.

Since the SQL graph source already reuses AuthConfig (fluree-db-sql/src/config.rs), a Google identity would authenticate SQL endpoints for free, which is groundwork for #2182.

New wire codes this would want: err:auth/GoogleTokenExchange (Google's error code only, never a response body), err:auth/GoogleCredentialsInvalid (names the field, never its value), err:auth/HostIdentityRefused (names the env var that governs it), err:catalog/QuotaProjectRequired, and err:api/InvalidGraphSourceConfig for the surface refusals.

Pairs with #2195 (per-source storage identity): the catalog's Google identity is also what reads a federation warehouse's gs:// files. Related: #2182, #1914.

Activity

  1. added
    enhancement
    P1
    area:iceberg
    on Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1area:icebergenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions