Skip to content

[#12574] improvement(lance): document REST auth and add ITs - #12954

Open
yuqi1129 wants to merge 11 commits into
apache:mainfrom
yuqi1129:issue-12574-lance-rest-auth-docs
Open

[#12574] improvement(lance): document REST auth and add ITs#12954
yuqi1129 wants to merge 11 commits into
apache:mainfrom
yuqi1129:issue-12574-lance-rest-auth-docs

Conversation

@yuqi1129

@yuqi1129 yuqi1129 commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Document Lance REST authentication, authorization, active roles, and deployment differences, with examples and regression coverage.

Preserve backend authentication/authorization errors as HTTP 401/403, remove stack traces from those errors and auxiliary authorization denials, and return a generic response for unexpected HTTP 500 failures while retaining server-side logging.

Why are the changes needed?

Users need clear authentication guidance and correct, sanitized error responses. Backend access denials currently become HTTP 500.

Fix: #12574

The independent Arrow CreateTable fix is tracked by #12988 and implemented in #12989. Authentication-related fixes stay here because the authentication work has not been merged into branch-1.3.

Does this PR introduce any user-facing change?

Improved authentication documentation; backend authentication/authorization errors retain HTTP 401/403; authorization denials omit stack traces; unexpected HTTP 500 responses omit internal exception details. No identity propagation or configuration changes.

How was this patch tested?

86 tests passed: 75 service unit tests and 11 integration tests across LanceNamespaceAuthorizationIT and LanceRESTServiceAuthIT. No failures or skips.

Coverage includes error mapping and sanitization, auxiliary authentication and active roles, and standalone backend access denial through a separate production server JVM. Relevant Spotless formatting passed. Tests used the embedded backend; Docker and the full deployment matrix were not run.

Copilot AI lite review requested due to automatic review settings September 7, 2026 08:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@yuqi1129 yuqi1129 changed the title [#12574] docs(lance): document authentication and authorization with HTTP integration coverage [#12574] fix(lance): document REST auth and fix create and error handling Sep 7, 2026
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

Code Coverage Report

Overall Project 69.89% +0.11% 🟢
Files changed 92.81% 🟢

Module Coverage
aliyun 19.74% 🔴
api 51.59% 🟢
authorization-common 85.96% 🟢
authorization-ranger 4.38% 🔴
aws 53.54% 🟢
azure 32.1% 🔴
catalog-common 28.4% 🔴
catalog-fileset 82.17% 🟢
catalog-glue 71.52% 🟢
catalog-hive 83.07% 🟢
catalog-jdbc-common 45.05% 🟢
catalog-jdbc-doris 82.69% 🟢
catalog-jdbc-mysql 81.8% 🟢
catalog-jdbc-postgresql 83.89% 🟢
catalog-jdbc-starrocks 79.16% 🟢
catalog-kafka 75.21% 🟢
catalog-lakehouse-generic 61.16% 🟢
catalog-lakehouse-hudi 79.1% 🟢
catalog-lakehouse-iceberg 85.9% 🟢
catalog-lakehouse-paimon 84.29% 🟢
catalog-model 77.99% 🟢
cli 44.62% 🟢
client-java 77.91% 🟢
common 58.09% 🟢
core 84.45% 🟢
filesystem-hadoop3 76.48% 🟢
flink 0.0% 🔴
flink-common 53.63% 🟢
flink-runtime 0.0% 🔴
gcp 32.2% 🔴
hadoop-auth 68.0% 🟢
hadoop-common 17.84% 🔴
hive-metastore-common 54.41% 🟢
iceberg-aliyun-bundle 0.0% 🔴
iceberg-common 66.16% 🟢
iceberg-rest-server 77.09% 🟢
idp-basic 86.77% 🟢
integration-test-common 0.0% 🔴
jobs 62.92% 🟢
lance-common 34.02% 🔴
lance-rest-server 69.47% +8.82% 🟢
lineage 59.39% 🟢
optimizer 83.24% 🟢
optimizer-api 21.95% 🔴
server 90.07% +0.45% 🟢
server-common 81.89% -0.22% 🟢
spark 56.37% 🟢
tencent 81.78% 🟢
trino-connector 58.57% 🟢
Files
Module File Coverage
lance-rest-server LanceMetadataAuthorizationMethodInterceptor.java 98.9% 🟢
LanceExceptionMapper.java 85.42% 🟢
LanceRESTAuthInterceptionService.java 77.78% 🟢
server CatalogOperations.java 100.0% 🟢
GravitinoInterceptionService.java 93.6% 🟢
AuthorizeExecutorFactory.java 55.56% 🔴
server-common ExpressionCondition.java 100.0% 🟢
AuthorizationRequest.java 0.0% 🔴
AuthorizationExpressionConstants.java 0.0% 🔴

@jerryshao jerryshao added the branch-1.3 Automatically cherry-pick commit to branch-1.3 label Sep 8, 2026
@yuqi1129 yuqi1129 removed the branch-1.3 Automatically cherry-pick commit to branch-1.3 label Sep 8, 2026
@yuqi1129

yuqi1129 commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

@jerryshao
Previous PRs related to Lance REST auth have not been cherry-picked to branch-1.3, and I will do it using a unified PR.

@yuqi1129 yuqi1129 self-assigned this Sep 8, 2026
@yuqi1129 yuqi1129 changed the title [#12574] fix(lance): document REST auth and fix create and error handling [#12574] docs(lance): document REST authentication and authorization Sep 8, 2026
@yuqi1129 yuqi1129 changed the title [#12574] docs(lance): document REST authentication and authorization [#12574] fix(lance): document REST auth and correct auth error responses Sep 8, 2026
@yuqi1129 yuqi1129 changed the title [#12574] fix(lance): document REST auth and correct auth error responses [#12574] improvement(lance): document REST auth and add ITs Sep 8, 2026
Comment thread docs/lance-rest-service.md Outdated
gravitino.authorization.serviceAdmins = adminUser
# Development example: simple accepts the supplied user name without password validation.
gravitino.authenticators = simple
gravitino.lance-rest.gravitino-simple.user-name = lance-rest-server

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do we need this for auxiliary mode?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed this setting from the auxiliary authorization example in 286fd98 and clarified that it is optional. In auxiliary mode, it only supplies the fallback identity for requests accepted as anonymous; authenticated requests retain the caller identity and active roles. The default is already lance-rest-server, so setting it explicitly is only needed to override that fallback. This does not recover rejected authentication attempts.

Documentation-only change; spotlessApply and git diff --check passed.

jerryshao pushed a commit that referenced this pull request Sep 9, 2026
#12989)

### What changes were proposed in this pull request?

Reject Arrow IPC streams containing rows before CreateTable changes
metadata or storage, including exist_ok and overwrite requests. Preserve
schema-only and zero-row batch support.

Add parser unit tests and a CreateTable regression test in
LanceRESTServiceIT, which is also present on branch-1.3.

### Why are the changes needed?

CreateTable silently discards supplied rows and can overwrite an
existing table with unsupported input.

Fix: #12988

Authentication, authorization, and error-response fixes remain in
#12954. This PR contains only the Arrow fix so it can be backported
independently of main's authentication changes.

### Does this PR introduce _any_ user-facing change?

Nonempty CreateTable streams return HTTP 406 before mutation. No
authentication or configuration changes.

### How was this patch tested?

All 71 lance-common unit tests passed (Gradle reused the unchanged
passing results), and the relocated LanceRESTServiceIT regression
passed, covering create, exist_ok, and overwrite without side effects.

Relevant Spotless formatting passed. The complete patch applies cleanly
to branch-1.3 in a Git index check; it has not been run on that branch.
Docker tests were not run.
…n modes

Auxiliary mode authorizes each Lance endpoint once, in Lance REST,
against an expression written for that endpoint. Standalone mode has no
Lance-side authorization at all: every underlying Gravitino call is
checked by the Gravitino server with the rules of that call. The same
request can therefore be authorized differently depending on the mode.

Record the known differences so users find them in the documentation
rather than in an unexpected 403. The clearest one needs no race:
TableExists on an existing table succeeds with CREATE_TABLE in
auxiliary mode, but standalone maps it to loadTable, whose existence
allowance only applies when the table is absent, so the same caller
gets 403.

Closing the gap is tracked in apache#13089.

Claude-Session: https://claude.ai/code/session_011A4FqHJarzs2xvs7WbusMT
credentials restricted to the caller's table privileges. Access to data files depends on the
permissions of those credentials. Per-user, scoped credential vending is not implemented.

### Authorization differences between deployment modes

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Authorization only allows the auxillary mode.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated in 572e3e7. The section now explicitly states that Lance REST metadata authorization is supported only in auxiliary mode and that standalone mode is not recommended because its authorization decisions may differ and produce unexpected results, even for the same user and privileges. It recommends auxiliary mode, clarifies that remote Gravitino checks and caller forwarding do not provide equivalent Lance authorization, and links #13089 for alignment. Documentation-only change; spotlessApply and git diff --check passed.

@@ -393,41 +393,22 @@ permissions of those credentials. Per-user, scoped credential vending is not imp

### Authorization differences between deployment modes

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we remove the title Authorization differences between deployment modes

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Adjust and add a message that deploy mode is not suggested and the correctness of it cannot be guaranteed.

@yuqi1129
yuqi1129 requested a review from roryqi September 11, 2026 10:09
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.

[Subtask] Document Lance REST authentication and authorization

4 participants