Skip to content

Complete the fleet: identity providers, token exchange, outcomes, anchoring, operations - #4

Merged
mbianchidev merged 3 commits into
mainfrom
fleet-completion
Nov 15, 2026
Merged

mbianchidev merged 3 commits into
mainfrom
fleet-completion

Conversation

@mbianchidev

@mbianchidev mbianchidev commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Completes the remaining fleet roadmap for mbianchidev/sendbox#87 increment 2.

Changes

  • Identity providers. Sign in with any OpenID Connect issuer (FLEET_OIDC_CONFIG): people by verified email, CI such as GitHub Actions by claim with required_claims. JWKS discovery and caching, ring verification (RS256, ES256, EdDSA), and exact iss/aud/exp/nbf/iat checks. Optional auto-provisioning creates principals with no roles. Rejection reasons are logged; the token itself is never logged.
  • Token exchange. POST /v1/tokens turns a sign-in into a short-lived service token, which is what sendbox governance login calls. Also GET/DELETE /v1/tokens. A service token cannot mint another, and each principal holds at most 20 live tokens.
  • Outcomes. POST /v1/grants/{id}:outcome records host-reported stream outcomes as request.outcome. Outcomes are evidence only.
  • Audit anchoring. GET /v1/audit/head returns a signed chain head. Heads are anchored periodically to FLEET_AUDIT_ANCHOR_DIR. admin audit keygen|anchor|verify checks the anchors and detects a rewritten database.
  • Operations.
    • Least-privilege PostgreSQL roles (deploy/postgres/roles.sql): the runtime role has no UPDATE, DELETE, TRUNCATE or ALTER on audit.
    • FLEET_MIGRATE=false plus admin migrate.
    • Per-principal and per-peer rate limits returning 429 with Retry-After.
    • Prometheus metrics on a separate FLEET_METRICS_BIND listener.
    • Log rotation by size as well as daily.
    • CA certificates added to the image.
  • Toolchain. Rust 1.100.0 and sqlx 0.9. The unused rsa advisory exception is gone.
  • Docs.
    • README status section.
    • New docs/deployment.md covering TLS, roles, identity providers, anchoring, metrics and backups.
    • Updated roadmap, architecture, contract, threat model and development docs.

Not in this PR

Live Apple/Kata runs against real providers. That work is host-side, so it is tracked in mbianchidev/sendbox#96.

Contract pin

mbianchidev/sendbox#97 is merged, so the contract is pinned to sendbox main (3cab614). Nothing else has to merge first.

Validation

  • cargo fmt --check, clippy -D warnings, cargo audit --deny warnings.
  • Tests on SQLite and PostgreSQL 18:
    • local JWKS server: key rotation, outage, alg none/HS256, audience, expiry, and auto-provisioning
    • token exchange
    • outcomes
    • anchor tampering
    • rate limits and metrics
    • migration check
    • roles script, by connecting as the app role
  • Live run of the binary against PostgreSQL as sendbox_fleet_app with FLEET_MIGRATE=false: anchoring, admin audit verify, metrics listener, 429, and graceful stop.
  • docker build --no-cache and a container smoke test (uid 10001, CA bundle present).

sqlx 0.9 needs Rust 1.94 or later. Statements built from constant
fragments are asserted safe in one helper; values stay bound. The rsa
advisory no longer applies. libsqlite3-sys moves to 0.37, the newest
sqlx 0.9 allows; the SQLite advisory stays ignored until sqlx allows
0.39.
…horing, operations

- Sign in with any OpenID Connect issuer (people and CI such as GitHub
  Actions). JWTs are verified with ring against the issuer's JWKS, with exact
  issuer and audience, required claims, verified email, and optional
  auto-provisioning without roles. Rejection reasons are logged.
- POST/GET/DELETE /v1/tokens: exchange a sign-in for a short-lived service
  token, list and revoke tokens. Service tokens cannot mint more.
- POST /v1/grants/{id}:outcome records host-reported stream outcomes.
- Signed audit heads (GET /v1/audit/head), periodic anchoring outside the
  database, and admin audit keygen/anchor/verify.
- Per-principal and per-peer rate limits with Retry-After, Prometheus
  metrics on a separate listener, size plus daily log rotation.
- FLEET_MIGRATE=false with admin migrate, least-privilege PostgreSQL roles
  (deploy/postgres/roles.sql), CA certificates in the image.
- Pin the contract to the sendbox PR branch with the new api types.
- Docs: README status, deployment guide, roadmap, architecture, contract,
  threat model, development.
@mbianchidev
mbianchidev marked this pull request as ready for review November 15, 2026 17:14
@mbianchidev
mbianchidev merged commit 4441e5d into main Nov 15, 2026
4 checks passed
@mbianchidev
mbianchidev deleted the fleet-completion branch November 15, 2026 17:26
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