[#12574] improvement(lance): document REST auth and add ITs - #12954
[#12574] improvement(lance): document REST auth and add ITs#12954yuqi1129 wants to merge 11 commits into
Conversation
… with HTTP integration coverage
Code Coverage Report
Files
|
…ce in its own JVM
|
@jerryshao |
| 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 |
There was a problem hiding this comment.
Why do we need this for auxiliary mode?
There was a problem hiding this comment.
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.
#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 |
There was a problem hiding this comment.
Authorization only allows the auxillary mode.
There was a problem hiding this comment.
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 | |||
There was a problem hiding this comment.
Should we remove the title Authorization differences between deployment modes
There was a problem hiding this comment.
Adjust and add a message that deploy mode is not suggested and the correctness of it cannot be guaranteed.
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.