Repository navigation
code.search authorizes a one-entry namespaces list, a tracker is linked only by its admin, and a taken inbox hides its owner - #310
Merged
Conversation
The gate checks the request's namespace; a one-entry namespaces list became the namespace the search ran on without a check. It is now authorized as each entry of a longer list is. A contract test declares, for every input field naming another namespace or org, the check its handler runs. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…-field contract names each check's function A linked tracker is read by whoever reads the repository, so linking one the maintainer cannot read widened its readers; an unreadable tracker now answers as a missing one. The contract test covers inbox and org fields and checks each declared function exists. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…ames its owner only to the owner's readers Linking a standard tracker opens it to every reader of the repository, which is the tracker admin's call, so set_source requires ADMIN on it. inbox.register's conflict names the owning namespace only to a caller who may read it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
… is told so Keeping, reordering or dropping a link already in force widens nothing. A caller who reads but does not administer the tracker gets 403; anyone else the missing-tracker answer. inbox.register reads the owner's scope without marking the conflict unverified. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…ce stores it, and the stored links are read fail-closed Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…s the tracker's admin, and test the fail-closed link read Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…es whole Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
The deployment-wide link snapshot is keyed by namespace name alone, so another org's row under the same name could count as this repository's. set_source reads its own row for its org, which raises when unread; refresh_overrides keeps no strict mode. 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]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
The 403 says a link from the deployment's map counts as new, the field comment is one sentence, the missing-tracker answer is no longer called indistinguishable, and the overview says the repository's admins decide a linked tracker's readers. The inbox owner test asserts each detail. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
A restricted tracker keeps its own gate, so the overview says a linked standard tracker is what every reader of the repository reads. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
The Trackers picker says a new link needs the tracker's admin, and a tracker the caller does not administer is marked "needs its admin" rather than hidden, since an org-wide admin token may still link it. The scope-fields test names erasure's scope_value as out of pattern, and the security page calls it a declaration list the test keeps complete. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Both call row_in_scope with hides_answer=False only to word a refusal another check decided: the ADMIN check refused the tracker link, and the inbox is taken whatever the caller reads. An unverified probe there does not change the answer, so it does not mark the request the server's. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
zlareb1
force-pushed
the
sec/code-search-one-namespace
branch
from
November 7, 2026 06:40
35cf1c8 to
03287e6
Compare
…save stores The picker's mark follows the caller's grants, not the server's check, so it says the caller holds no admin grant and that Loom links the tracker only if the token administers it. When a linked tracker is one the caller holds no admin grant on, the card says that a change stores links that come from the deployment's map, which needs an admin of each. code.symbol and code.grep presence mode refuse a one-entry list naming an unreadable namespace before anything runs. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
Merged
9 tasks done
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
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):
code.searchwith a one-entrynamespaceslist authorizes that namespace before searching it, as it does each entry of a longer list; a caller who cannot read it gets 403.code.repo.set_sourcestores a link only to a tracker the caller administers, unless the repository's own links already hold it; a reader of the tracker gets 403, anyone elseNOT_A_TRACKER_NAMESPACE. Keeping, reordering or dropping a link the repository's stored links already hold is unchanged; a tracker only the deployment's map links counts as new.inbox.registernames the namespace that owns an inbox only to a caller who can read it.Why
The transport gate authorizes the request's
organdnamespace.code.searchtakesnamespacesfor a fan-out, and a list of two or more goes throughsearch_fanout.authorize, which checks each entry. A one-entry list instead went tonormalize, which made the entry the request's namespace after the gate had run, so the search ran on a namespace nobody had authorized, a restricted one included.A second case of the same class:
code.repo.set_sourcechecked that each tracker namespace it links exists, not that the maintainer can read it. A linked tracker is read by whoever may read the repository (binding._gatedgates a standard tracker on the code namespace), and self-servicecode.repo.addmakes its viewer the new repository's admin, so linking a tracker decided who reads it, which is the tracker admin's call: a viewer of a tracker under an approval join policy could link it to a repository anyone may join. Andinbox.registernamed the owning namespace of a taken inbox to an admin of any namespace, where every other inbox path answers as for a missing inbox.Design
search_fanout.normalizeis async and authorizes the entry (authorize, the fan-out's own fail-closed check overrow_in_scope) before it rewrites the input.repo_admin._tracker_or_refusealso requiresrow_in_scope(org, tracker, ADMIN)for a tracker the repository's stored maintainer links do not already hold, restricted or not. A tracker only the operator map links counts as new, since storing it would outlive a later change to the map. The stored links are the repository's own row, read for its org (CodeRepo.get_state, which raises when unread), not the deployment-wide link snapshot, which is keyed by namespace name alone and could hold another org's row under the same name. Two concurrentset_sourcecalls still race read-then-write, as every maintainer setting does. A caller who reads the tracker is told it needs its admin (403); anyone else getsNOT_A_TRACKER_NAMESPACE, the code a missing tracker gets (it is not a secrecy guarantee:tracker.source.add's taken-name answer still tells an existing tracker apart). Keeping, reordering or dropping a stored link needs no admin of it, so the dashboard's whole-list updates keep working for those; on a repository whose links come only from the deployment's map, the first save stores them and so needs each tracker's admin, and the 403 says why. A link is a lasting delegation: it stays in force if the maintainer later loses the tracker, and the repository's admins then decide who reads it, including through a latercode.repo.set_accessjoin-policy change, as the tracker overview now says.inbox.register'sINBOX_OWNED_ELSEWHEREsays "another namespace" unless the caller can read the owner.LOOM_TRACKER_CODE_NAMESPACE_BINDINGS_JSON) and the stored-link snapshot are keyed by code namespace name alone, so a self-service repository whose name matches a map glob, or another org's repository of the same name, picks up links without the tracker admin's consent. That read path is older than this PR; Tracker links are read per org, and the operator's map links only the operator's repositories #331 keys the stored-link snapshot by (org, namespace), which also closesset_source'sprevious_tracker_namespaces, still read here from that snapshot and so able to name another org's links under the same name.tests/unit/test_op_scope_fields.pylists every op input field that names another namespace, org or inbox (namespaces,to_namespace,extra_namespaces,from_org,inbox, ...) with the function that checks it, and checks the function exists. A new such field fails the test until it is declared there, and a declaration whose field is gone fails too. Names that resolve to a namespace indirectly (code.repos'repo) andnamespace_scope(filtered by the fan-out through the gate) are outside the pattern, as the test's docstring says. The gate checks onlyorgandnamespace, so each of these fields needs its own handler-side check.Scope and risk
server/code/app/search_fanout.py, its call inserver/code/app/search/handler.py,server/code/app/repo_admin.py,server/code/api/models_repos.py(the field comment, and the regenerateddocs/reference/operations/code.md),server/tasks/app/inboxes.py, two comments inserver/tracker/app/binding.py, the repository card's tracker picker (frontend/src/views/RepositoryCard.tsx, withbindableRecordsinfrontend/src/lib/trackerSources.ts: it says a new link needs the tracker's admin; a tracker the caller holds no admin grant on is marked, not hidden, since a token that administers it another way may still link it, and the hint says Loom links it only if the token administers it; when a linked tracker is one the caller holds no admin grant on, the card says that if the links come from the deployment's map, any change stores them, which needs an admin of each), their tests, one row of the tracker overview, the new contract test and one row of the security page's CI-gate table. A one-entry search runs onerow_in_scoperead. Everyset_sourcecall now makes one point read of the repository'sqa_bindingstate row; each tracker it newly links runs onerow_in_scoperead for an admin of it and two otherwise, a missing tracker and a kept link none.set_sourceis the only writer of theqa_bindingrow (othercode_index_statewriters use their own fixed keys, knowledge sources writeknowledge_source:<name>keys, and erasure only deletes), so every stored link that counts as kept passed this check or was stored before it, as the operator steps say.Compatibility, rollout and rollback
code.searchwithnamespaces: [x]answers 403AUTH_INSUFFICIENTwhen the caller cannot readx; before, it searchedx.code.repo.set_sourcenewly linking a tracker the caller does not administer answers 403AUTH_INSUFFICIENTto a reader of it and 422NOT_A_TRACKER_NAMESPACEto anyone else.inbox.register's 409 message no longer names an owner the caller cannot read.code.repo.set_sourcestate) made by maintainers who are not the tracker's admin (theqa_bindingkey inloom.code_index_state); links stored before stay in force until changed. During a rolling upgrade the review also coversqa_bindingrows written until the last N-1 replica stops, since N-1'sset_sourcehas no admin check.Tests
pytest tests/unit/test_code_search_fanout.py tests/unit/test_code_presence.py tests/unit/test_request_sli.py tests/unit/test_op_scope_fields.py tests/unit/test_tracker_multi_binding.py tests/unit/test_tracker_source_form.py tests/unit/test_task_inbox.py tests/unit/test_code_repo_access.py:code.symbolandcode.greppresence mode withnamespaces: ["code-secret"]are refused before anything runs; a viewer of one code namespace searchingnamespaces: ["code-secret"]is refused withAuthInsufficientErrornaming it, and searchingnamespaces: ["code-default"], which it reads, runs the single search there (the refusal fails onmain, where the search runs oncode-secret); newly linking a tracker the maintainer reads but does not administer is refused with 403, one it cannot read like a missing one, and reordering or dropping an existing link needs no admin of it; a taken inbox names its owner only to the owner's readers; every current second-scope field is declared with a function that exists; an unread link row refuses the write, and a row under the same namespace name in another org does not count as this repository's.npx vitest run src/views/RepositoryCard.test.tsx(infrontend/): the Trackers picker marks a tracker the caller holds no admin grant on, says a new link needs its admin, still sends the link, and names the linked trackers a change would store without the caller's admin grant.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. I traced the gate's target and the handler's rewrite, and checked the new test fails without the fix.
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.docs/reference/configuration.mdand thedocs/reference/tables (python scripts/codegen/docs_reference.py), the reach manifest,schemas/schema.sql(make schema-dump) and the Codex plugin copies (python3 scripts/codegen/agent_plugin_sync.py).main; no merged migration is edited.hooks/,lib/,bin/,skills/,.mcp.json, the Codexplugin-defaults.json) bumps both plugin manifests' version, and no other open PR uses that version.npm --prefix frontend run build) and its tests pass, iffrontend/changed.docs/describe the system as it now is, and this description names any operator steps and wire changes.tests/unit/test_public_copy.py).git commit -s), as CONTRIBUTING.md asks.🤖 Generated with Claude Code