Conversation
…base listings Arc's three database listing endpoints carried no authentication at all. They now require read permission and, where the server restricts reads per database, a grant covering the database being listed — so `db list`, `db show` and `measurement list` can receive a 401 or a 403 where they previously could not. Those statuses are not one condition, and 403 is not even one condition by itself. Arc answers it for a token that carries no read permission, for a token whose grants do not cover the database asked for, and for its own permission data being unreadable, and distinguishes them only by message. The three need different responses from the operator, so arcli now reads the message and says which one happened: - Scoped: Arc refuses `GET /api/v1/databases` for a token restricted to particular databases rather than returning a filtered list, the same bar `SHOW DATABASES` applies. `db list` now says the token is scoped and names the way forward (`arcli db show <database>`, `arcli measurement list --database <database>`) instead of printing a bare `HTTP 403`. This is an expected state for a tenant-scoped token, so arcli does not retry it. - No read permission: says so and asks for a token that has it. Telling this operator to name a database would send them somewhere that cannot help. - Permission data unavailable: reported as a server-side fault, not as a statement about the token. A 404 stays a 404, so "you may not read it" and "it is not there" remain distinguishable, and a 401 says whether the connection has no token at all or carries one Arc rejected. Matching is by stable message fragment rather than whole string, and both the read middleware's wording and the handler gate's are recognised, so a change to the permission word cannot silently reclassify one refusal as another. An unrecognised 403 falls back to naming the token's permissions, which is safe to say about any refusal. `client.AccessDeniedError` carries the status, the database, whether the refusal was the per-database one and whether the connection sent a token; `client.Scoped(err)` reports the scoped case for callers embedding the package. Companion to the Arc server change on fix/rbac-measurement-where-and-databases-auth.
5 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Arc's three database listing endpoints (
GET /api/v1/databases,/:name,/:name/measurements) previously carried no authentication at all. They now require read permission and, where the server restricts reads per database, a grant covering the database being listed.db list,db showandmeasurement listcan therefore receive a 401 or a 403 where they previously could not.Those are not one condition, and 403 is not even one condition by itself — Arc answers it for three different things and distinguishes them only by message:
no permission for read on database 'x'/access denied: no read permission for database 'x'token does not have 'read' permission/Permission denied: read requiredpermission data unavailableThe 403 on
db listis a normal state, not a failure. Arc refuses to list every database for a tenant-scoped token rather than returning a filtered list, the same barSHOW DATABASESapplies.db listnow says so and names the way forward (arcli db show <database>,arcli measurement list --database <database>) instead of printing a bareHTTP 403, and arcli never retries it.Nothing changes for an admin token, for a read token on a server that does not restrict reads per database, or for a server with authentication disabled.
Notes on the implementation
client.AccessDeniedErrorcarries the status, the database, whether the refusal was the per-database one, and whether the connection sent a token.client.Scoped(err)reports the scoped case for callers embedding the package.Companion to the Arc server change on
fix/rbac-measurement-where-and-databases-auth; see that branch's release notes under "RBAC read and write restrictions were unreachable, and the database listings had no authorization".Test plan
gofmt -l .clean,go vet ./...clean,go build ./...go test -race -count=1 ./...— all 7 packages passinternal/client/access_test.gopin every body Arc can send: both scoped wordings (named and empty/wildcard database), both coarse wordings,permission data unavailable, an unrecognised 403, 401 with and without a token, 404, and 500database.go, run, restore): 6 failures, all on the classificationdb list,measurement list,db showon a missing database anddb showwithout read permission each print their own actionable messagedb list/db show/measurement listhelp text,docs/releases/v26.09.5.md