Narrow share-link access: stop granting generic chat read#878
Conversation
bdart
force-pushed
the
feature/ermain-486-narrow-share-link-access-to-the-dedicated-shared-route-stop
branch
from
July 24, 2026 15:46
e71a2d0 to
72c89bd
Compare
bdart
force-pushed
the
feature/ermain-485-shared-chat-read-dedicated-server-filtered-messages-3379
branch
from
July 24, 2026 17:39
1432dfd to
54eeda1
Compare
bdart
force-pushed
the
feature/ermain-486-narrow-share-link-access-to-the-dedicated-shared-route-stop
branch
from
July 24, 2026 17:39
72c89bd to
cdb44a9
Compare
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.
Follow-up to #866 (ERMAIN-485). The dedicated share-link messages route landed in 485 — now authorized in the policy via
shared_read— but a share link still also granted any logged-in viewer genericChat::Readon the chat_id, so a viewer could hand-craftGET /chats/{id}/messagesand receive every edit/regen branch. This removes that grant, closing the leak 485's route alone did not.Change
allowclause inbackend.regothat rode oncan_read_shared_chat. Share-link viewers now hold onlyshared_read(modeled in Serve shared chats via a dedicated active-thread-only messages route #866), which the dedicatedGET /share-links/{id}/messagesroute authorizes against.can_read_shared_chathelper and the file-upload-via-shared-chat rule — attachments in the shared view still work (the file rule propagates from the same helpershared_readderives from).shared_readpolicy deny → 404).GET /chats/{id}/messages→ 404.Effect
The generic messages route, token-usage estimate, and chat metadata now deny a share-only viewer (they all check
Chat::Read); the dedicated route is unaffected (shared_read). Attachments keep working via the kept file-upload rule.Stacks on #866; part of the 485 → 486 → 489 set meant to land together.
Closes ERMAIN-486.
Validated locally:
opa test66/66, backend suite green (3 pre-existing local MCP-env failures also fail on main),test_chat_share_link_enable_disable_flowgreen against Postgres.