Skip to content

Implement project roles, approved expiring exceptions, and central audit - #3

Merged
mbianchidev merged 3 commits into
mainfrom
fleet-project-roles-exceptions
Nov 15, 2026
Merged

mbianchidev merged 3 commits into
mainfrom
fleet-project-roles-exceptions

Conversation

@mbianchidev

@mbianchidev mbianchidev commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Implements increment 2 of sendbox-dev/sendbox#87 (criterion 7): the scaffold's 501 routes become the shared governance service. The host client is in sendbox-dev/sendbox#95.

Contract pin: tracks sendbox main at the merge of sendbox-dev/sendbox#95 (CONTRACT_VERSION 2).

What

  • Authentication: sendbox-fleet admin token issue mints sbf_ tokens and stores only their SHA-256. Tokens last at most 90 days, can be revoked, and stop working when their principal is disabled. Identity headers are ignored.
  • Roles: operators create projects with a first owner. Owners (and operators) assign and remove roles, and a project can never lose its last owner. Roles gate admission (member+), exception decisions (owner or admin), and visibility of roles, exceptions, and audit.
  • Profiles: publishing takes the exact YAML plus the bundle sendbox governance sign writes, verified against FLEET_PROFILE_TRUST. Revisions and minimum revisions only go up.
  • Admission: the binding principal must be the caller and the binding must name this authority (FLEET_AUTHORITY_ID). The profile revision must be current, and every bound exception must be valid and permitted.
  • Grants and authorize: issue, renew, revoke, and end session all reuse sendbox_governance::evaluate_request. Lifetimes are capped by the profile, by exception expiry, and by 7 days. A revoked or expired exception denies with stale_policy.
  • Exceptions: a member can request one of the denials the current revision lists as liftable. A different owner or admin approves or rejects it. Approvals are bound to that revision, so a stale one is refused. Expiry is at most 7 days, and the exception can be revoked.
  • Audit: every decision and every refusal is hash-chained in the same transaction as the change it records. Each entry carries the actor, principal, project, session, grant, exception, revision, decision, a redacted target, and a short detail. No tokens, bodies, or reasons are stored. Queries are scoped by role, and GET /v1/audit/verify checks the chain.
  • Schema 0002: adds tokens, the operator flag, a rebuilt exceptions table (kinds command / domain / network), session_exceptions, and audit exception_id / detail. Both backends serialize writers.
  • Docs: README, architecture, contract, roadmap (done and remaining), threat model, development (admin bootstrap). CI's PostgreSQL job now also runs the API tests.

Validation

  • cargo fmt --check, cargo clippy --locked --all-targets -D warnings, cargo test --locked (SQLite).
  • Migration and API tests against PostgreSQL 18.7 (FLEET_TEST_DATABASE_URL, --test-threads=1).
  • docker build --no-cache of the image.
  • Live smoke test: admin bootstrap, a profile signed with sendbox governance sign and published, roles assigned, self-approval refused, approval by an admin, then the real sendbox host client running whoami, admission, grant, authorize, renew, and end against this server. The audit chain verified as valid.

Remaining (docs/roadmap.md)

Identity provider (OIDC or mTLS), live Apple and Kata runs, anchoring the audit chain head and reporting outcomes, operations hardening (rate limits, metrics, DB roles), and sqlx 0.9.

Replace the 501 scaffold with the increment-2 service:

- Bearer tokens issued by `sendbox-fleet admin`, stored as SHA-256,
  expiring, revocable, and void for disabled principals.
- Project-scoped roles with operator bootstrap, owner-managed changes,
  and a last-owner guard.
- Signed profile publication verified with FLEET_PROFILE_TRUST,
  monotonic revisions, and rising minimum revisions.
- Session admission bound to the caller, this authority, the member
  role, the current revision, and valid exceptions.
- Grants, renewal, revocation, session end, and per-request
  authorization using the shared evaluate_request rules.
- Exceptions that lift only operator-listed denials, approved by a
  different owner or admin, bound to one revision, at most 7 days.
- Hash-chained audit for every decision and refusal, role-scoped
  queries, and chain verification.

Schema version 2 adds tokens, the operator flag, session exceptions,
and exception-aware audit columns. The contract pin tracks the sendbox
pull request branch until it merges.
@mbianchidev
mbianchidev marked this pull request as ready for review November 15, 2026 16:15
@mbianchidev
mbianchidev merged commit 7ccbf20 into main Nov 15, 2026
4 checks passed
@mbianchidev
mbianchidev deleted the fleet-project-roles-exceptions branch November 15, 2026 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant