Repository navigation
authz/v1: measure the retrieval lane as a property, prove it by mutation, record the tenants-only ACL defect (#627) - #42
Conversation
Review requestedThis branch changes how the #627 lane measures, which is the part most likely to be quietly wrong: a retrieval
Two constraints worth stating plainly. First, the author of #41 (this branch's base) and of this branch is the The failing |
8329bd5 to
018e1a6
Compare
Rebase notice — this branch was force-pushed onceThe two commits were rebased onto #41's new head
Conservation checks taken after the rebase, on
CI on Two body corrections that came out of re-measuring rather than remembering, both applied to the PR description:
No merge, no deployment, no licence change, and no redevops-rag change has been made or is implied. Review remains |
… and the leak reads red The lane could not tell the two directions of truth apart. Four tests asserted the insecure baseline's leak as a fact, so they went red for the fix as loudly as for a regression and told the truth in neither direction; the seven strict xfails reported "expected failure" identically for a refusal and for a broken measurement. The boundary is now written as a property — a read either takes a decision or refuses to read without one, withdrawal goes through an interface, an allow-list may only narrow — so 6e50d6d shows three failures and 0245d8f shows none. The criteria that need an owner are asked again below the xfail set, against an index whose documents each have one, and a seam that does not exist stays BLOCKED instead of passing. The seven strict-xfail bodies are unchanged, compared per body by AST segment and SHA-256 against 15f02e3. A denial from redevops_rag's own RetrievalDenied/AuthorizationUnavailable now counts as #627's fail-closed clause arriving, but only where that store is measured to require a decision; an error, a renamed seam or this repo's own AdapterBlocked still classify as broken, and a control test pins that the classifier cannot flatter a broken measurement. Grants name a subject as well as a tenant, because tenancy alone authorizes nobody here and a tenants-only fixture would let every "no leak" assertion pass on an empty index. Three insecure copies of the candidate check the checks. One denies correctly, filters correctly, returns identical rows and merely moves the predicate after the query; it is caught by exactly one test, the statement-level placement check, and passes the other twenty-one. Results alone cannot distinguish "candidates were filtered" from "the answer was filtered", and #627 asks for the first. Also corrected: authorization_inputs() did not contain the word "authority", so the entry-point test passed against the protected candidate while being blind to its fix. PostgreSQL/pgvector stays explicitly unverified, and the whole-suite row that cannot be re-taken on this machine is now marked historical rather than current.
…anging the library ingest(owners=...) maps owners(path) onto DocumentPolicy.declare(document_id, tenants=...) and leaves subjects and roles empty; DocumentAcl.allows checks tenancy first and then still requires a subject or role match, so a tenants-only ACL denies every principal including the declared owner. A document indexed through the library's own documented ownership path reads back zero rows, measured on 0245d8f through ingest() rather than reasoned out from the dataclass. This is fail-closed: nothing leaks, and no #627 criterion moves. It is an availability defect — the documented happy path yields permanently unreadable content and the refusal looks like an authorization bug — and it belongs to redevops-rag, so it is recorded in the qualification doc and left unfixed here. It is also why the retrieval lane's owned_store fixture names a subject beside the tenant and asserts each owner can read its own content before asserting that nobody else can. Without that guard every "no leak" assertion in the lane would be satisfied by a store that returns nothing at all.
018e1a6 to
0be2950
Compare
GitHub matches the pull_request `branches` filter against the pull request's BASE branch, not its head branch. PR #42 is stacked on test/authz-v1-exact-capability-issuance, so with "main" as the only listed base it lost its pytest run when it was retargeted off main: head 0be2950 carries docs-check and secret-scan check runs and nothing else, where the pre-retarget head 018e1a6 ran pytest and passed (1,817 passed / 91 skipped). List that branch by name. No wildcard, and the push trigger stays main-only, so the gated base set is exactly the two branches with a pull request in flight. Runner, Python version, GITHUB_TOKEN permissions and the `python -m pytest -q` command are untouched -- this changes when the suite runs, never what it runs.
Why this change exists
The #627 retrieval lane in
tests/authz_contract/test_retrieval_baseline.pycould not report the truth in eitherdirection. Its assertions stated the leak as a fact and passed, so a fix and a regression produced the identical
result — a failure. This reconciliation makes the lane measure a property instead: it reads green when an
authorized read is scoped and reads red when content crosses the boundary, and it is checked against deliberately
insecure variants so that a green run is evidence rather than reassurance.
Two commits, one concern each:
ebd91fd0be2950ingest(owners=…)availability defect, recorded as documentation onlyBoth were rebased onto
035cb18, #41's head at the time (they weredce7557/8329bd5, then62cfc14/018e1a6; thisbranch has been force-pushed twice). The rebase moved no implementation code: with these two commits applied to the
new base,
adapters/redevops_rag/adapter.pyandtests/authz_contract/test_retrieval_baseline.pyare byte-identical tothe pre-rebase versions, and the diff against the new base is the same +715 / −66 across 3 files. The seven
strict-XFAIL criterion bodies were re-verified byte-identical to
15f02e3after the rebase.Measured results
6e50d6dis the insecure baseline (pre-#627);0245d8fis the protected candidate under review inredevops-rag#627.
6e50d6d0245d8fCI on this PR — the gate went missing at 14:27 UTC and was restored at 15:32 UTC
0be2950pytest42845291820, job129931017199, 15:31:55 → 15:32:07 UTCdocs-check15e7a5eon #41 repaired the five inherited linksgitleaksThe head commit itself is unchanged throughout:
0be2950, 2 commits, 3 files, +715 / −66. What changed is the basebranch this PR points at. The record, kept because the gap was real:
018e1a6, basemain: run42778990478pytest pass, 1,817 / 91test/authz-v1-exact-capability-issuance..github/workflows/tests.ymlfilteredpull_requestonbranches: ["main"], and that filter reads the base branch — so this PR fell out of it.check-runson0be2950returned exactly[docs, gitleaks]: no pytest run at all1c8e936added that branch to the filter and passed its own gate (run42844906121, 1,817 / 83)reopenedevent produced run42845291820for0be2950; its job checked out "Merge 0be2950… into 1c8e936…" —pull_requestruns test the merge commit — and pytest passed, 1,817 / 91Restoring it needed a change on #41's branch, not here: GitHub runs the base branch's copy of a workflow file for
pull_requestevents, so this PR cannot give itself a gate. The chosen fix names this one base branch instead of atest/**wildcard, so no other branch acquires the trigger by accident. The alternatives recorded earlier — awildcard, or retargeting this PR's base back to
mainat the cost of the 3-file diff view — were not taken, and thehead was never amended to force a run.
While the gate was down, the absence of a red CI run was treated as the absence of a check, not a pass, and the suite
was run here instead, at this exact head, in a full-history checkout (so tags are visible), Python 3.12 with
pytest 9.2.0 / duckdb 2.0.0:
env -u AGENTIC_OS_ROOT -u AGENTIC_OS_ENTERPRISE_ROOT -u REDEVOPS_RAG_ROOT python -m pytest -q035cb180be2950REDEVOPS_RAG_ROOT=<candidate tree> python -m pytest -qpython scripts/docs_check.pyCI's historical counts read lower than these because CI's checkout exposes no history or tags. That was
reproduced rather than assumed: cloning this head with
--depth 1 --no-tagsgives 1,817 passed / 91 skipped,the CI numbers exactly, while the same commit in a full-history clone gives 1,825 passed / 83 skipped. The
eight-test delta is fully accounted for by cells that skip when git history and tags are absent —
test_qa_clarifications.py:116(×2),:123,:133("the frozen interface commit is not visible in thischeckout"),
test_qa_released_goldens.py:40,:47("v0.3.14is not visible in this checkout"),test_qa_released_goldens.py:57("no tag carriesgolden/qa.jsonyet") andtest_release_discipline.py:69("notags visible in this checkout"). 4 + 3 + 1 = 8; nothing else moves.
The comparison that matters is like-for-like, and it is now a same-machine pair rather than two CI runs: base
035cb18gives 1,825 passed / 75 skipped and this head gives 1,825 passed / 83 skipped, both with nocheckouts configured. The pass count is identical and the only movement is this branch's retrieval lane, which
grew from 21 to 29 cells (verified by collecting the base and head versions of the lane file). No pass was lost,
and no test passes locally while skipping for any reason other than the missing checkouts.
The three baseline-red properties are
test_retrieval_either_takes_authority_or_refuses_to_read_without_it,test_withdrawal_is_expressible_through_a_library_interfaceandtest_a_caller_supplied_allow_list_is_not_the_access_control— no read entry point takes a decision, withdrawalhas no library interface, and a caller-supplied
document_idslist is treated as authorization.Mutation evidence
A green suite is not evidence until something insecure makes it red, so the lane is run against four
deliberately-insecure copies of
0245d8f. All four are detected, and which test catches which variant is thesubstance of the claim. Re-measured on this head (
0be2950), one process per variant, pytest 9.2.0 / duckdb 2.0.0:0245d8f(control)LIMIT: predicate removed from the candidate-producingSELECT, re-applied in Python afterLIMITtest_an_authorized_read_returns_what_its_owner_may_see_and_nothing_else,test_authorization_narrows_each_retrieval_leg_before_any_ranking,test_the_decision_is_applied_where_candidates_are_produced,test_the_answer_context_carries_only_what_the_decision_allows,test_revocation_through_the_library_interface_reaches_an_existing_readertest_a_caller_supplied_allow_list_is_not_the_access_control, plustest_each_xfail_fails_for_the_leak_it_claims[...revocation_is_expressible...]— the anti-vacuity check noticing an xfail body that has stopped leakingNone if named is None else set(named), so a read with no caller-supplieddocument_idsfilters nothingSELECT, window widened (top_k × 200), and the allow-list recomputed fromauthority.current().allowed_documentsso the returned set is still correcttest_the_decision_is_applied_where_candidates_are_produced— onlyD is the row that matters. With the window widened, every returned row is authorized, every results-level
assertion is satisfied, and the leak is real: unauthorized rows are read from storage, ranked and reachable.
Twenty-one tests call that implementation correct; exactly one does not, because it looks at where the decision
is applied rather than at the answer. Results alone cannot distinguish "the candidates were filtered" from "the
answer was filtered", and #627 requires the former. That is why
test_the_decision_is_applied_where_candidates_are_producedis atomic and should stay that way — folding it intoa results-level check, or letting it tolerate results-level proof, deletes the only detector of this class.
C is here for the opposite reason: it shows that widening the window buys an attacker nothing detectable on its
own — A and C fail the identical five tests. The
× 200only becomes dangerous once the post-filter is stillcorrect, which is what D is. A reviewer who thinks D's shape is contrived should say so plainly: D was written by
the author of the tests it defeats, and it carries most of the weight of this section.
Anti-vacuity is enforced rather than assumed.
test_the_denial_classifier_does_not_flatter_a_broken_measurementpins that a renamed method, a missing module, or this repo's own
AdapterBlockedclassify as broken, never asenforcement — so "denied" can never be produced by an outage. Each "no leak" assertion is paired with a guard that
the owner can read its own content first, so a lane can never pass by reading an empty index.
Integrity guarantee
The seven original
xfail(strict=True)bodies are preserved byte-identically to15f02e3(per-body ASTsegment plus SHA-256). They are neither softened nor deleted. Six now report denied rather than a leak, because
the candidate refuses the decision-less read those bodies perform — that is #627's fail-closed clause arriving, not
proof that an authorized read is scoped; the criteria needing an owner are therefore re-asked below the xfail set
against an index whose documents each have one. At
6e50d6dthose cells stay BLOCKED, because an ACL invented bythe probe would certify a boundary the implementation does not have.
Recorded, deliberately not fixed
ingest(owners=…)declares an ACL that authorizes nobody.ingest()mapsowners(path)ontoDocumentPolicy.declare(document_id, tenants=…)(ingest.py:72) anddeclareleavessubjects/rolesempty(
authority.py:214), whileDocumentAcl.allowsrequires a subject or role match on top of tenancy(
authority.py:96-99) — so a tenants-only ACL denies every principal, including the declared owner. Measured on0245d8fthroughingest()itself: a document indexed viaowners=lambda path: ["acme"]reads back 0 rows asits declared owner; re-declaring the same ACL with a subject reads back 1 row.
It is fail-closed, so nothing leaks and no #627 criterion is affected. It is an availability defect belonging
to redevops-rag and it is documented here only — no library code was modified in this change, in either commit.
Not verified
what the library opens when no DSN is configured. The lane never opens Postgres; it inspects the statements
DuckDB is handed. The pushdown and revocation legs need a live Postgres, and nothing here — including the
mutation results — should be read as covering them.
agentic-os or agentic-os-enterprise checkouts, so those cells report BLOCKED. The
1890 passed / 3 skipped / 7 xfailedrow indocs/AUTHZ_QUALIFICATION.mdis now explicitly marked historical and not remeasured; noreplacement count has been invented for it.
docs-checkfailures are fixed on authz/v1: production-profile qualification, exact-capability issuance, provenance bound to measured code (#626) #41, not here. They were authored byad1d951on authz/v1: production-profile qualification, exact-capability issuance, provenance bound to measured code (#626) #41's branch(
../../tmp/kernel-e2/...citations indocs/AUTHZ_QUALIFICATION.md);mainpasses the check and this branchadded no new problems (measured:
scripts/docs_check.pygives 0 / 5 / 5 problems onmain/15f02e3/ thepre-rebase head). authz/v1: production-profile qualification, exact-capability issuance, provenance bound to measured code (#626) #41's
15e7a5erepairs all five as inlinepath:linecitations — five lines, no reflow, noprose change — and
docs_checknow reports 0 problems on both heads. A permalink was deliberately not used:no kernel source is tracked here, the kernel commit in the document's own provenance table returns
422 No commit found from
redevops-io/agentic-os, andagentic-os-enterpriseis private, so anunresolvable URL would have traded a visibly broken link for a plausible wrong one. That unfetchable kernel commit
is now answered on authz/v1: production-profile qualification, exact-capability issuance, provenance bound to measured code (#626) #41 by
035cb18: the measured kernel / enterprise commits (c453cd16,d88b9adf) areunpublished — branches deleted,
GET /repos/<repo>/git/commits/<sha>returns 404 — but the defects they weremeasured against reproduce from the published bases
130fcf9d(agentic-os) and048b42ed(enterprise), whichis what
docs/AUTHZ_QUALIFICATION.mdnow cites. The fix efficacy stays measured-but-not-independently-reproducible;reconstruction patches are in the review packet.
yaml, althoughpyyaml>=6is a declared runtime dependency andtests/test_adoption.pyimports it. Measurement here used adedicated venv (
.venv-authz) that supplies it, together with the sibling checkouts; that venv is local and isnot part of this change. This did not reach CI — CI installs PyYAML 6.0.3 as a hard dependency, and its
pytestjob is green with the pass count above. Nothing in this section's figures depends on the local gap.Relationship to PR #41
Retargeted on 2026-11-10: this PR's base is now
test/authz-v1-exact-capability-issuance(#41's branch), soGitHub's diff for this PR is exactly this PR's contribution — 3 files, +715 / −66. Until then the base was
mainwhile the commit graph was stacked on #41, and GitHub rendered 6 commits / 30 files / +7,499 (all of #41 plus these
two);
08-pr42-vs-main-stat.txtin the review packet records that earlier state.07in the packet is the 3-filediff either way. The retarget changed the PR's base, not its content — nothing was pushed differently, and #41
remains an independent review unit that must merge first.
There is no textual conflict:
git merge-treeagainstmainmerges clean, and because these commits descenddirectly from #41's head the two branches cannot diverge textually. Ordering still matters: merging this one first
lands #41's commits too and auto-closes #41. If #41 takes further review changes to
docs/AUTHZ_QUALIFICATION.md,adapters/redevops_rag/adapter.pyor this test file, this branch will need anotherrebase over them.
Review focus requested
Independent review is requested, with specific attention to:
adapters/redevops_rag/adapter.py.Is the capability vocabulary faithful to what the library actually offers, and does the spy observe without
altering behaviour?
positive/negative pairing in the
owned_storefixture and the denial classifier.REDEVOPS_RAG_ROOThandling inadapters/_implementations.py, and whetherBLOCKED-vs-red boundaries are drawn where they should be (an absent checkout must never read as a pass, and a
real run must never hide as a skip).
test should be split further, and whether mutant D is a fair mutant or an author-contrived one.
Reproducing
Without
REDEVOPS_RAG_ROOTthe retrieval lane reports 29 BLOCKED skips and runs nothing.