Repository navigation
atlas(classification): enforce disclosure-context filters at output boundaries (#12404) - #12626
Merged
Merged
Conversation
…oundaries (#12404) Implements the #9096 design section 4 disclosure contexts in Atlas search: the destination surface's context ceiling (fleet-internal=local-only, hosted-per-user=personal, public-surface=shareable, local-owner=secret-bearing) intersects the caller's grant ceiling at the final output boundary in atlas-core's run_search_impl, so neither can widen the other and excluded_personal_life content is ineligible in every context. One filter point covers every rendered shape: flat results, grouped sessions (chunks and hit_count), raw branch rows, neighbor expansion (filtered per neighbor classification), --with-message and hydration payloads (withheld outright on public-surface), and get-chunk (context-gated; a withheld chunk reads as not found). Missing/unknown sensitivity labels fail closed to secret-bearing; an absent context fails closed to public-surface (library default), with front-ends stating their surface's context: CLI search defaults fleet-internal, CLI get-chunk defaults local-owner, the service resolves a stated context fail-closed and defaults fleet-internal for its authenticated callers, and the service dedupe/result CacheKey now includes the resolved context so cached payloads cannot cross contexts. SearchRequest gains an additive optional context field. Leak evidence: at base, a stub-backend demonstration served secret-bearing and excluded content at a maximal caller ceiling, leaked a secret-bearing neighbor through --expand, and served an excluded chunk by id. The new crates/atlas-core/tests/disclosure.rs (13 tests) plus disclosure.rs unit/proptests and a server cache-separation test pin the intersection per boundary class; all atlas-core, atlas-proto, and atlas-search suites green (357 tests). Deferred boundaries, filed and enqueued from this slice: Worker (TS) stated context + cache keying -> #12622 (task 21057); legacy Python atlas_search.py parity -> #12623 (task 21058); span-level filtering of full-content payloads -> #12624 (task 21059). The query-trace context field belongs to #9099 per design section 10 and is not built here.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Caution Review failedThe pull request is closed.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This was referenced Nov 22, 2026
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.
Implements the next slice of #12404: disclosure-context enforcement at Atlas's output boundaries, per the #9096 design (§4). Not merged — left for review; the filter point is in
crates/atlas-core/src/search.rs(run_search_impl, the "Disclosure-context enforcement" block) andcrates/atlas-core/src/disclosure.rs.Mechanism
A new
DisclosureContext(atlas-coredisclosure.rs) carries the design §4 table —fleet-internal→local-only,hosted-per-user→personal,public-surface→shareable,local-owner→secret-bearing. Inrun_search_impl, after fusion and before any rendering, every ranked candidate's detail row is classified (chunk_classification: missing/unknown label →secret-bearing, fail-closed;excluded_personal_lifelabel → excluded) and admitted only ifcontext.permits_with_grant(class, caller_ceiling)— the intersection of grant ∩ context ceiling ∩ not-excluded. Every rendered shape draws only from that admitted set, and the query trace's served set is collected from the rendered envelope, so traced/cached/paged payloads inherit the filter. Context never widens a grant and a grant never widens a context (proptest-pinned).Boundary inventory
hit_count(counts are metadata)--raw-rows=branches)--expand, get-chunk neighbors)--with-messagepayloadspublic-surface(full-message text can't be filtered at chunk granularity — design §4: "if an output cannot be safely filtered, withhold it")--with-messagerun_get_chunk_with_context; a withheld chunk returns the same "not found" fatal as a missing one, so the lookup can't confirm classified content exists.run_get_chunkkeeps its Python-parity contract underlocal-owner— the only behavior change is excluded content, now never servedCacheKeynow includes the context — a payload filtered for one destination can never be served or coalesced into another (test:dedupe_never_crosses_disclosure_contexts)CEILING = "personal"(= the hosted-per-user ceiling) and keys its cache by ceiling, but states no context and doesn't key by it. Belongs to #9092's hosted-surface work; the wire field it needs (SearchRequest.context) lands hereatlas_search.pyFront-end context defaults (stated, per surface)
SearchOptions::defaultcontext:public-surface(fail-closed; a caller that states nothing gets the strictest outbound treatment).search --context: defaultfleet-internal(the CLI serves fleet surfaces); CLIget-chunk --context: defaultlocal-owner(the owner's explicit-id tool). Unknown values are a usage error (exit 2), never a silent default.public-surface); an unstated one defaults tofleet-internal(its callers are authenticated fleet surfaces; sinks beyond the service state their own context).SearchRequest.contextis additive/optional on the wire (#[serde(default, skip_serializing_if)]).Leak-test evidence
Fail-before (base
516c13c29, scratch worktree, stub backend, maximal caller ceiling) — all three leaks reproduced:Pass-after (this branch, sandbox) —
crates/atlas-core/tests/disclosure.rs, 13 tests, one per boundary class: public-surface filtering of a fully-cleared caller (whole-envelope scan for leaked strings), fleet-internal withholding secret-bearing, hosted narrowing a wider grant, local-owner unable to widen a narrower grant, exclusion in every context, fail-closed labels, unstated-context default, grouped counts, raw branch rows, expand neighbors, get-chunk gating, public full-content withholding. Plusdisclosure.rsunit tests + proptests (intersection = min, never exceeds either side) and the server cache-separation test.Suites (sandbox,
cargo test -p atlas-core -p atlas-proto -p atlas-search): 357 passed, 0 failed. Harness updates where a harness models the local operator surface: it now stateslocal-ownerexplicitly (flags/parity/live-smoke/cli_parityhybrid_secret_ceiling, the server dedupe canary test). No new dependencies.What remains on #12404
Refs #12404 (slice; issue stays open for the deferred boundaries).
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.