Skip to content

[CTX-0719] feat(sec): adopted SEC seams at live boundaries (OQ-054/055/057/068/083/085) - #1310

Merged
Xuepoo merged 2 commits into
mainfrom
ctx-0719/secwiring
Sep 23, 2026
Merged

Xuepoo merged 2 commits into
mainfrom
ctx-0719/secwiring

Conversation

@Xuepoo

@Xuepoo Xuepoo commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Priority: P1 | Area: area:security | Labels: feat,P1,area:security | Milestone: v0.1.0 | RFC: OQ-054/OQ-055/OQ-057/OQ-068/OQ-083/OQ-085 (adopted) | Task: CTX-0719

Scope

Wire the owner-adopted SEC directions (register accepted 2026-09-23) into live paths where acceptance demands it: trust-level admission at the effective-authorization boundary, role-contract checks at the same boundary, credential exclusive-or order at the call boundary, the panel write-lease hook, and .wheel/ project-definition discovery. Candidate kernels came from #1304 (zero live consumers); this task adds the consumers plus 25 wiring tests. #1308 (env grants + error taxonomy + tier audit) is in CI and NOT merged: this task deliberately does not duplicate it (see #1091 verdict).

Per-issue verdicts

Issue OQ Verdict Link
#1090 SEC-21 trust-level model + capability domains OQ-085 adopted HOLD — check_family + authorize_with_trust wired and tested, but the security-corpus revision lives in bitty-docs and is not part of this change Relates #1090
#1091 SEC-22 secret-storage tiers OQ-055 adopted HOLD — tier consent gate + audit live in #1308 (in CI, unmerged); this task adds nothing there to avoid duplication; keyring backend, command execution, rotation still open Relates #1091
#1092 SEC-23 api_key_env vs api_key_cmd semantics OQ-054 adopted HOLD — resolve_choice exclusive-or gate implemented and tested, but no api_key_env/api_key_cmd config field exists yet; waits on the provider-schema follow-up Relates #1092
#1094 SEC-25 role contract for multi-agent work OQ-057 adopted HOLD — check_request + authorize_with_role wired and tested, but the CRE-5 shell write path and the bitty-ai role model stay open Relates #1094
#1095 SEC-26 panel write-lease contract OQ-083 adopted HOLD — may_write/check_write hook implemented and tested, but the bounded lease term, clock, and bus routing stay open; RUN-21 track owned by CTX-0720 Relates #1095
#1096 SEC-27 wheel project-definition directory OQ-068 adopted HOLD — .wheel/ then .agents/ discovery implemented and tested, but project.toml schema, tracked-vs-state split, and trust enforcement stay open Relates #1096

Relates #1090 (HOLD: wired, needs security-corpus revision).
Relates #1091 (HOLD: tier gate lives in #1308, awaiting merge).
Relates #1092 (HOLD: gate ready, needs provider schema).
Relates #1094 (HOLD: wired, needs sandbox/shell-write closure).
Relates #1095 (HOLD: hook ready, needs term/clock/bus).
Relates #1096 (HOLD: discovery ready, needs schema).

Contract outcome

  • bitty-plugin-host trust_levels: CapabilityDomain::for_family reverse map + TrustLevel::check_family call-boundary gate (unmapped families defer to grants; shared Terminal family passes on either direction, documented).
  • bitty-plugin-host effective: authorize_with_trust + authorize_with_role wrappers — adopted gates first, then exactly authorize; denials are PolicyConflict with names-only chains.
  • bitty-plugin-host roles: EnforcementPoint::for_request_kind routing + AgentRole::check_point/check_request gates.
  • bitty-plugin-host credential_ref: resolve_choice exclusive-or enforcement (names-only conflict diagnostics, values never enter the module).
  • bitty-runtime execution::lease: PanelLease::may_write/check_write SEC-26 write hook (occupant-only, lease unchanged on deny).
  • bitty-config wheel (new): OQ-068 discovery order (nearest .wheel/project.toml, else nearest .agents/, 32-level bound) with discover (injectable predicate) + discover_on_fs live seam; paths only, never read or trusted.
  • Fail-closed throughout; diagnostics name levels/families/roles/points/paths only.
  • MSRV 1.85: no let-chains; cargo +1.85 check clean on all three touched crates.

Security/performance impact

No new authority: every seam narrows (trust/role pre-checks deny before the grant intersection; credential conflicts deny; lease writes require occupancy; wheel discovery returns paths only). No hot-path change: the wrappers are opt-in (existing authorize untouched), the lease hook is additive, wheel discovery runs once per lookup with a bounded walk. No perf-sensitive change.

Affected crates

  • bitty-plugin-host: trust/role/credential gates + effective wrappers + docs/exports.
  • bitty-runtime: lease write hook.
  • bitty-config: new wheel discovery module.

Validation

  • cargo fmt --all -- --check clean
  • RUSTFLAGS="-D warnings" cargo clippy --workspace --all-targets --locked clean
  • cargo check --workspace --locked clean (via cargo check -p bitty-plugin-host -p bitty-runtime -p bitty-config, full workspace clippy covers the rest)
  • cargo test -p bitty-plugin-host --locked green (276 lib passed, incl. 13 new wiring tests)
  • cargo test -p bitty-config --locked green (incl. 7 new wheel tests)
  • cargo test -p bitty-runtime --lib --locked green (504 passed, incl. 2 new lease-hook tests)
  • cargo +1.85 check -p bitty-plugin-host -p bitty-config -p bitty-runtime --locked clean

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:security Area: security corpus / audit feat Feature P1 Priority: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant