Skip to content

feat(rest): request storage access delegation via header#12

Open
smaheshwar-pltr wants to merge 3 commits into
mainfrom
rest-access-delegation-header
Open

feat(rest): request storage access delegation via header#12
smaheshwar-pltr wants to merge 3 commits into
mainfrom
rest-access-delegation-header

Conversation

@smaheshwar-pltr

@smaheshwar-pltr smaheshwar-pltr commented Jun 27, 2026

Copy link
Copy Markdown
Owner

What

Send X-Iceberg-Access-Delegation: vended-credentials on every REST request by default. An explicit header.X-Iceberg-Access-Delegation (matched case-insensitively) overrides it.

Why

The REST catalog already applies vended storage credentials returned in load responses, but never requests them. Per the spec a compliant server only delegates storage access when the client asks via this header, so the credential-vending path is otherwise never exercised.

This matches PyIceberg, which sets the header on the session for every request and only ever uses vended-credentials (the sole delegation mode this client supports):

Notes

  • Default-on is a deliberate choice for PyIceberg parity; the header is harmless to servers that ignore it. (The Java REST client does not send it; engines such as Trino enable it via a header.* property.)

Tests

ExtractHeaders: header sent by default, header.* prefix stripping, and explicit override (case-sensitive and case-insensitive).

/// request, asking the server to delegate storage access for loaded tables
/// (use "vended-credentials" to request vended storage credentials). Unset by
/// default; an explicit "header." override of the same header takes precedence.
inline static Entry<std::string> kAccessDelegation{"access-delegation", ""};

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused by this. I'd have thought this PR would just involved setting vended-credentials everywhere. Especially because, like PyIceberg and iceberg-rust, that's the only delegation mode iceberg-cpp even supports. What's the reason for this stuff I'm seeing here?

@smaheshwar-pltr
smaheshwar-pltr force-pushed the rest-access-delegation-header branch from 8135a67 to d100f3b Compare June 27, 2026 23:03
Send "X-Iceberg-Access-Delegation: vended-credentials" on every REST request
by default, matching PyIceberg (session.headers.setdefault) and the only
delegation mode iceberg-cpp supports. emplace() preserves an explicit
"header.X-Iceberg-Access-Delegation" override.

Without requesting delegation, a spec-compliant REST server will not vend
storage credentials. Adds ExtractHeaders unit tests for the default header,
header.* prefix stripping, and the explicit override.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@smaheshwar-pltr
smaheshwar-pltr force-pushed the rest-access-delegation-header branch from d100f3b to 0f83157 Compare June 27, 2026 23:20
return StringUtils::ToUpper(header.first) == canonical;
});
if (!set_by_caller) {
headers.emplace(kHeaderAccessDelegation, kAccessDelegationVendedCredentials);

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sending this by default mirrors PyIceberg, which sets the access-delegation header on the session for every request and only ever uses vended-credentials:

The Java REST client does not send this header; engines like Trino set it via a header.* catalog property.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant