Repository navigation
A token reads a base's graph overview and neighbourhood - #1264
Conversation
WaylandYang
left a comment
There was a problem hiding this comment.
Thank you, the code is right. Overview and neighbourhood are GETs, use require_reader_kb, and every query beneath them is bound to the base in the path. A neighbourhood started from an entity id in another base comes back empty rather than showing its neighbours, and as_of replays stay inside the base too. Both tests run in CI and fail without the change.
Before merge, the docs need to line up with #1263, which goes in first:
- #1263, this PR and #1265 each add a "decision 7" to 0014. One idea shouldn't become decisions 7, 8 and 9. After rebasing on #1263, please add these two routes, with their reasons, to its decision 7 ("A token reads the graph"), and extend its revision line instead of adding another. #1265 can then do the same.
auth.rs:179lists the routes that takeSessionOrToken. #1263 updates it and this PR doesn't. Please add the graph view there too: that comment is where a reader learns which routes a token can reach.- The rebase will also clear the conflicts in
api/mod.rsandaccess-and-audit.md.
|
Thanks, agreed on all three. Once #1263 is in I'll rebase this onto it, fold the overview and neighbourhood routes with their reasons into its decision 7 and extend its revision line, and add the graph view to the |
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Bogdan Szabo <[email protected]>
18fa84d to
40f901d
Compare
|
Thank you, WaylandYang, both for the review and for checking that the neighbourhood and
Ready for another look whenever you have a moment. |
WaylandYang
left a comment
There was a problem hiding this comment.
Thank you for the careful rebase. Decision 7 now counts all six reads with a reason for each, the revision line is extended rather than duplicated, and the SessionOrToken comment lists the graph view. Both routes stay bound to the base in the path, so a neighbourhood started from another base's entity comes back empty, and folding the routes into the shared fixture kept the tests nicely small. Merging.
Sync upstream dev into re-dev (2026-10-19, evening): deeplethe#1318, deeplethe#1320, deeplethe#1264, deeplethe#1319 and 7 more
Part of #1262.
What happened
A backend that mirrors into a base could not look at the graph it built: the overview and neighbourhood reads take a session JWT, and a personal token gets 401.
What changed
GET /kbs/{id}/graph/overviewandGET /kbs/{id}/graph/neighborhoodtakeSessionOrTokenand callrequire_reader_kb, the check document content and the reads from #1263 use (0052): the owner needs Viewer, any token scope may read, and a token whosekb_idsexclude the base gets 404. The reading logic is unchanged.0014's decision 7 ("A token reads the graph", from #1263) now counts these two routes, with a reason for each, and its revision line is extended rather than a new one added. The
SessionOrTokencomment inauth.rsanddocs/design/access-and-audit.mdname the two reads.Tests
The shared
api::token_read_testsfixture now also covers the two routes, against a real database: a read token of a base viewer gets 200 on every graph read, and a token limited to another base gets 404 on every one. Both fail with 401 when either route is put back to session-only.Run against Postgres with
UTOPIA_TEST_REQUIRE_DB=1:cargo fmt --all -- --checkandcargo clippy -p utopia-server --all-targets -- -D warningsclean;cargo test -p utopia-server683 passed, 2 ignored.