8000 feat(bep): give bep serve the client's secret-store rules (T83) · gominimal/minimal@848b389 · GitHub
[go: up one dir, main page]

Skip to content

feat(bep): give bep serve the client's secret-store rules (T83)

Minimal Arch / arch-review failed Oct 26, 2026 in 0s

CONDITIONS

Governs: Gatehouse §6.10 (specs/authn-authz/gatehouse-spec.md). Line 834 and line 839 say that the root's name constraints are the module hosts ∪ the authorities the operator's [secret-store-rules] register, less the deny set. Line 839 also says that a changed registration re-self-signs the root. Line 842 says that a store handle is judged against the current registration, so a narrowed rule refuses. Line 849 says that the rules are "user or org configuration". architecture.md line 1210 says that a deny anywhere is final. The checkout 109541a4 has no arch-map.md, so I started from the §6.10 store-member lines that the ledger rulings cite.

The delivery choice that the task leaves to this review. The design does not say how the helper gets the rules. It does say that they are the host's (line 834) and the operator's (line 839), and an un-enrolled helper runs as that operator on the same machine. So a read of the client configuration by bep conforms. A control-socket op from min conforms too, but it does not keep the rules current when a person edits config.toml. The design also says nothing about crate dependencies. The bep → boxes dependency reuses check_store_rules, and boxes::core::bep names that function as the one BEP-034 check over bep::ca::DENY_SET. A copy in bep would give two definitions. I accept the dependency and the Cargo.toml/Cargo.lock layer exception. That makes nickel and google-cloud-storage part of the proxy binary, and the design does not rule on that.

Ruling. Union, admission and deny-set filtering conform. The fail-closed paths conform: no home directory, a file that does not read, a refused rule, and a deny rule all give a refusal. The rules that bep holds are not the registration the design names, for two reasons. (1) bep reads only the user file. min (crates/minimal/src/config.rs read_client_and_org_config) merges 3962 /etc/minimal/config.toml and keeps the stricter action. So an org-only rule never admits. Worse, a user rule admits a handle for an item that the org denies. This fails open against line 1210. C1 fixes this, and it moves the merge into boxes so that one definition serves min and bep. (2) bep serve lives for one minvmd boot (crates/minvmd/src/cmd/run.rs). Rules read at start mean that a narrowed or removed rule keeps admitting until the next boot. Line 842, and the BEP-064 sub-requirement in spec 24, say otherwise. The Rules trait already takes a per-request source, so C2 is a small change. C3 files the remaining interim: the root and the admitted set refresh only at boot. That interim fails closed, but it needs an issue (rule 6). The PR body's gaps (3) and (4) are correct behaviour, not gaps.

Precedent. The ledger has no ruling on this question. The ledger text is truncated, and no entry rules on how bep gets the store rules. I cite none, and this ruling departs from none.

Not checked. Whether the new test builds and passes. That needs a compile. The test does not go through serve(), so it does not prove that serve() passes the rules it reads to wire(). I checked that wiring by reading the code. I did not check that min's exact-key rule match is the same as the design's id_glob (line 849). That gap predates this PR and is not part of this ruling.

Conditions

  • C1: Give bep serve the same merged rules that min resolves, from one definition. Move the rule half of read_client_and_org_config (ORGANIZATION_CONFIG_PATH, merge_store_rules, keep_read_actions, deny_refused_items) from crates/minimal/src/config.rs into boxes::client::config, as a function that returns the merged rules and the refusals. min keeps its once-per-process stderr print. In crates/bep/src/main.rs, client_store_rules()/store_rules_in() call that function with the user file and /etc/minimal/config.toml. An org file that exists but does not read or parse gives no rules, as min's org_required path does. store_rule() keeps dropping a merged deny. Extend serve_admits_a_store_member_under_the_clients_rule: an org-only rule admits, and an org deny under a user allow for the same item refuses store_handle_invalid.
  • C2: In crates/bep/src/main.rs wire(), give BoxRedeemer::with_rules a Rules source that reads the current merged rules (C1) at each request, through the Fn(&str, &str) -> Option<StoreRule> impl in crates/bep/src/handle.rs. Do not pass the start-time Vec. A cache is allowed only if it re-reads when the user file or the org file changes (mtime or length). A read that fails gives no rule, so the request refuses. Add the spec's test edited_store_rule_applies_to_next_request: narrow the rule's upstream and change its inject between two redemptions of one handle. The second redemption refuses store_handle_invalid. The start-time rules continue to feed registered_union() and admission().
  • C3: The root's names and the admitted CONNECT set take the rules only when bep serve starts, that is once per minvmd boot. A rule that registers a new authority does not re-self-sign the root until the next boot. Open an issue in gominimal/minimal for this interim. Put its URL in the PR body under a Residuals heading. In crates/bep/src/main.rs, name the issue and the flip condition in the doc of admission() and at the registered_union(rules) call in start(). Write each other gap that is left after C1 and C2 in that list with its own issue, or remove it from the PR body. One example is that min --config-dir reads a file that bep does not read.

Ruled at 848b389 against gominimal/arch@109541a48c31 by claude-opus-5-5; arch_rulings 417, job c57b30d5-8b60-46f0-871e-4db559343dd2.

0