Skip to content

fix(rest): keep table tokens off the catalog session - #3976

Open
jaideeppyne wants to merge 1 commit into
apache:mainfrom
jaideeppyne:fix/commit-table-session-headers
Open

jaideeppyne wants to merge 1 commit into
apache:mainfrom
jaideeppyne:fix/commit-table-session-headers

Conversation

@jaideeppyne

Copy link
Copy Markdown

Rationale for this change

RestCatalog.commit_table assigned into self._session.headers, which is the session's own mapping. A table-scoped token then stuck on the catalog session for later requests.

Session.auth would also overwrite a per-request Authorization header with the catalog token, so the table token is applied through a request-local auth callable and the session headers are left unchanged.

A second, related leak: fsspec caches S3FileSystem instances by constructor kwargs. Custom S3 signers are registered after construction under a fixed event id, so a second catalog with the same client kwargs replaced the first catalog's signer. skip_instance_cache is set when a signer is in use.

Closes #3970

Are these changes tested?

Unit tests in tests/catalog/test_rest.py and tests/io/test_fsspec.py.

Are there any user-facing changes?

Bug fix. Catalog sessions no longer retain a table-scoped token after commit_table. FileIO instances with custom S3 signers are no longer shared across catalogs via fsspec's instance cache.

commit_table wrote a table-scoped Authorization header into the live
session mapping, so later requests from the same RestCatalog carried it.
Send that token on the commit request only.

Also skip fsspec's S3FileSystem instance cache when a custom signer is
registered, so two catalogs cannot overwrite each other's before-sign
handler.

Closes apache#3970
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.

Per-catalog auth state is shared: commit_table mutates the session, and cached S3FileSystem instances share a signer

1 participant