Repository navigation
Projection-failure ops leave out restricted namespaces the caller cannot read - #204
Merged
Merged
Conversation
zlareb1
force-pushed
the
fix/projection-failures-org-scope
branch
3 times, most recently
from
November 3, 2026 13:01
01a3cfe to
750a74b
Compare
…not read ops.projection_failures.list, .retry and .resolve skip the transport's namespace gate, so an org or platform admin read, retried and resolved the failures of a restricted namespace it holds no grant and claim for. The handlers now narrow every statement by resolve_org_scope, as audit.list and the org-wide rollups do. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…tion test says what it covers Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…the handlers short-circuit alike Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…e statement Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
… to its builder; platform-admin case Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
zlareb1
force-pushed
the
fix/projection-failures-org-scope
branch
from
November 3, 2026 13:15
750a74b to
d05f50f
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.
Changelog category (leave one):
Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):
ops.projection_failures.list,.retryand.resolveno longer let an org admin or platform admin read, retry or resolve the projection failures of a restricted namespace the admin holds no grant and claim for; an org admin also no longer reaches those of a collection it cannot read.Why
The three ops set
skip_namespace_authz, so an admin can address a whole org. That meansauthz_targethands the gatenamespace=None(server/transport/gates.py:108), and the restricted-namespace check never runs. The handlers filtered by org and the optional namespace only, so:listreturned a restricted namespace's failure rows, including theirmemory_keys,error_messageandpayload(entity pairs and links);retryreplayed them;resolveresolved them by id.The security page says no
org_adminorplatform_adminrole bypasses a restricted namespace (docs/architecture/security.md, restricted namespaces).The fix applies
resolve_org_scope, the privacy filter the org-wide rollup ops andaudit.listalready use. For an admin it leaves out every restricted namespace the caller cannot read (restricted_namespaces_hidden_from) and every collection it cannot read. For a caller with nothing in scope it returns empty before any statement runs. The filter goes into the oneSELECTthatlistandretryshare, and into theALTER TABLE ... UPDATEthatresolveruns.Scope and risk
server/insights/app/ops.py, plus an optional scope fragment onlist_projection_failures,retry_projection_failuresandmark_projection_failures_resolved.mark_resolvedand the write paths that record failures.ops.health(alsoskip_namespace_authz, ORG_ADMIN) reports a named namespace's aggregate counts (pending embedding stubs, op mix, procedure plane) without the org scope. It returns no memory content; closing it means threading the scope into three aggregate queries, so it is a change of its own.resolve_org_scopealso leaves out, for an org admin (not a platform admin), every collection it cannot read, as it does foraudit.listand the org-wide rollups. The unit tests check that filter reaches every statement.resolvecounts ids, not rows: it reports the number of ids it was given, as before. A hidden id therefore reads the same as an unknown one and confirms nothing.Compatibility, rollout and rollback
Tests
tests/unit/test_projection_failures_org_scope.pychecks, for each of the three ops, that the statement carries thenamespace NOT IN {ns_hidden}clause. It also checks that a caller whose namespace classification cannot be read (restricted_namespaces_hidden_fromanswers*) runs no statement.mainand pass here.tests/integration/test_projection_failures_restricted.pyruns an org admin with no grant on a restricted namespace and an ordinary namespace in the same org:listreturns only the ordinary namespace's failure;listnaming the restricted namespace returns nothing;resolvegiven both ids resolves the ordinary one and leaves the restricted one active.It needs auth on, so it joins CI's auth-on isolation pass and skips on the auth-off pass. It passed against a local auth-on server.
make format lint typecheck test-unitpass.AI assistance in the code (leave one; writing this description with AI is fine):
AI-generated (an agent wrote most of the diff): Claude Code. The gate path (
authz_target,check_authorized,resolve_org_scope) was read end to end, and the unit tests were run againstmainto see them fail.I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist
make format-check,make lint,make typecheckandmake test-unitpass; the integration suite passes if server behaviour changed.main; no merged migration is edited (none).frontend/changed (unchanged).docs/describe the system as it now is, and this description names any operator steps and wire changes.git commit -s).🤖 Generated with Claude Code