Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,8 @@ Features planned after core platform and agent support is solid.
- [ ] OPA/Rego policy language support for complex rules
- [x] Operator-signed governance profiles that projects can only narrow ([governed sessions](docs/architecture/governed-sessions.md), single host)
- [x] Host-side brokered model provider credentials with leased, revocable grants (Anthropic, OpenAI)
- [ ] Policy inheritance (org → team → project) with shared multi-user management (`sendbox-fleet`)
- [x] Shared multi-user governance service with project-scoped roles, approved expiring exceptions, and central audit ([`sendbox-fleet`](https://github.com/mbianchidev/sendbox-fleet), [shared governance service](docs/architecture/governed-sessions.md#shared-governance-service))
- [ ] Policy inheritance (org → team → project)
- [ ] Policy testing framework
- [ ] Community policy library

Expand Down
4 changes: 2 additions & 2 deletions Tests/qualification/inventory.v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@
{"id":"module.rust-secrets","category":"source_module","name":"Rust secrets and credential foundation","disposition":"preserve","rationale":"Retain typed credential scope, authenticated envelopes, versioned records, and platform-specific secure storage foundations.","evidence":["crates/sendbox-secrets/src/credential.rs#credential scope","crates/sendbox-secrets/src/envelope.rs#authenticated envelope","crates/sendbox-secrets/src/error.rs#SecretsError","crates/sendbox-secrets/src/lib.rs#public exports","crates/sendbox-secrets/src/linux.rs#Linux secure store","crates/sendbox-secrets/src/macos.rs#macOS secure store","crates/sendbox-secrets/src/record.rs#versioned secret record","crates/sendbox-secrets/src/types.rs#secret types"],"target_crate":"sendbox-secrets","target_phase":9,"conformance":{"status":"implemented","fixture_ids":["policy.decisions","persisted.formats"],"compatibility_note":null}},
{"id":"module.rust-credentials","category":"source_module","name":"Rust production credential broker and guarded GitHub auth","disposition":"preserve","rationale":"Retain explicit loopback credential endpoints, strict bounded HTTP/1.1 parsing, pinned certificate-verifying HTTPS forwarding, repository-scope authorization, exact-shape gh metadata execution, cancellation, redaction, and session-bound configuration.","evidence":["crates/sendbox-credentials/src/broker.rs#CredentialBroker","crates/sendbox-credentials/src/config.rs#BrokerConfiguration","crates/sendbox-credentials/src/error.rs#CredentialBrokerError","crates/sendbox-credentials/src/github.rs#GitHubMetadataClient","crates/sendbox-credentials/src/http1.rs#ParsedRequest","crates/sendbox-credentials/src/lib.rs#public exports","crates/sendbox-credentials/src/session.rs#SessionCredentialConfiguration","crates/sendbox-credentials/src/upstream.rs#PinnedHttpsTransport","crates/sendbox-credentials/src/relay.rs#RelayEndpoint streamed governed credential relay"],"target_crate":"sendbox-credentials","target_phase":9,"conformance":{"status":"implemented","fixture_ids":["policy.decisions","runtime.contracts","known-defects.negative"],"compatibility_note":"The broker requires agents to use explicit per-rule HTTP base URLs; transparent TLS interception and CONNECT credential injection are intentionally unsupported."}},
{"id":"module.rust-session-security","category":"source_module","name":"Rust session security lifecycle","disposition":"preserve","rationale":"Retain adapter-neutral lifecycle orchestration, audit anchoring, supervisor grants, secret envelopes, and explicit migration reports.","evidence":["crates/sendbox-session-security/src/lib.rs#public exports","crates/sendbox-session-security/src/lifecycle.rs#SecuritySession","crates/sendbox-session-security/src/supervisor.rs#PermissionSupervisor","crates/sendbox-session-security/src/migration.rs#MigrationReport"],"target_crate":"sendbox-session-security","target_phase":9,"conformance":{"status":"implemented","fixture_ids":["persisted.formats"],"compatibility_note":null}},
{"id":"module.rust-governance","category":"source_module","name":"Rust governance contract","disposition":"redesign","rationale":"Define the versioned, dependency-light contract shared by local governance and a future fleet authority: identities, signed operator profiles, governance bindings, leased credential grants, revocation, and the grant authority interface.","evidence":["crates/sendbox-governance/src/lib.rs#public exports and CONTRACT_VERSION","crates/sendbox-governance/src/identity.rs#PrincipalId ProjectId and SessionRef","crates/sendbox-governance/src/digest.rs#canonical_digest","crates/sendbox-governance/src/profile.rs#GovernanceProfile and CredentialProvider","crates/sendbox-governance/src/binding.rs#GovernanceBinding","crates/sendbox-governance/src/grant.rs#CredentialGrant RequestContext and Decision","crates/sendbox-governance/src/authority.rs#GrantAuthority and LocalGrantAuthority","docs/architecture/governed-sessions.md#Binding"],"target_crate":"sendbox-governance","target_phase":10,"conformance":{"status":"implemented","fixture_ids":["config.contracts","persisted.formats","policy.decisions"],"compatibility_note":"Governance is opt-in or operator-managed; standalone sessions keep identical boundary plan bytes because the binding is omitted when absent."}},
{"id":"module.rust-governance","category":"source_module","name":"Rust governance contract","disposition":"redesign","rationale":"Define the versioned, dependency-light contract shared by local governance and a future fleet authority: identities, signed operator profiles, governance bindings, leased credential grants, revocation, and the grant authority interface.","evidence":["crates/sendbox-governance/src/lib.rs#public exports and CONTRACT_VERSION","crates/sendbox-governance/src/identity.rs#PrincipalId ProjectId and SessionRef","crates/sendbox-governance/src/digest.rs#canonical_digest","crates/sendbox-governance/src/profile.rs#GovernanceProfile and CredentialProvider","crates/sendbox-governance/src/binding.rs#GovernanceBinding","crates/sendbox-governance/src/grant.rs#CredentialGrant RequestContext and Decision","crates/sendbox-governance/src/authority.rs#GrantAuthority LocalGrantAuthority and evaluate_request","crates/sendbox-governance/src/exception.rs#ExceptionPolicy ExceptionScope and PolicyException","crates/sendbox-governance/src/api.rs#shared governance service wire types","docs/architecture/governed-sessions.md#Binding"],"target_crate":"sendbox-governance","target_phase":10,"conformance":{"status":"implemented","fixture_ids":["config.contracts","persisted.formats","policy.decisions"],"compatibility_note":"Governance is opt-in or operator-managed; standalone sessions keep identical boundary plan bytes because the binding is omitted when absent."}},
{"id":"module.protocol-credential-relay","category":"source_module","name":"Protocol credential relay payloads","disposition":"redesign","rationale":"Carry brokered provider requests and streamed responses over the authenticated guest channel with per-stream credit, bounded chunks, and no credential material.","evidence":["crates/sendbox-protocol/src/relay.rs#CredentialRelayRequestV1 and credit window constants","crates/sendbox-protocol/src/types.rs#EventKind credential relay kinds","docs/architecture/governed-sessions.md#Relay"],"target_crate":"sendbox-protocol","target_phase":10,"conformance":{"status":"implemented","fixture_ids":["protocol.contracts","runtime.contracts"],"compatibility_note":"Authenticated CBOR framing remains v1; relay events use new event kinds that are only accepted after the guest reports a live credential_relay service."}},
{"id":"module.rust-governed-sessions","category":"source_module","name":"Rust governed session admission and credential relay wiring","disposition":"redesign","rationale":"Verify operator-signed profiles from a root-owned managed configuration or explicit opt-in, admit only narrowing compositions, bind the admission into the signed boundary plan, broker provider credentials host-side with leased grants, and record governance audit evidence.","evidence":["crates/sendbox-host/src/governance/mod.rs#GovernedSession and GovernedRun","crates/sendbox-host/src/governance/composition.rs#check and apply_denials","crates/sendbox-host/src/governance/operator.rs#GovernanceSource OperatorConfiguration and RevisionHighWater","crates/sendbox-host/src/governance/relay.rs#HostCredentialRelay","crates/sendbox-cli/src/governance.rs#governance keygen sign verify check","guest/sendbox-guest/src/credential_relay.rs#loopback credential relay listener","docs/architecture/governed-sessions.md#Admission and composition"],"target_crate":"sendbox-host","target_phase":10,"conformance":{"status":"implemented","fixture_ids":["config.contracts","policy.decisions","cli.contracts","runtime.contracts"],"compatibility_note":"Brokered credentials require a persistent Apple or Kata session; Hyperlight and legacy MCP fields are rejected for governed sessions."}},
{"id":"module.rust-governed-sessions","category":"source_module","name":"Rust governed session admission and credential relay wiring","disposition":"redesign","rationale":"Verify operator-signed profiles from a root-owned managed configuration or explicit opt-in, admit only narrowing compositions, bind the admission into the signed boundary plan, broker provider credentials host-side with leased grants, and record governance audit evidence.","evidence":["crates/sendbox-host/src/governance/mod.rs#GovernedSession and GovernedRun","crates/sendbox-host/src/governance/composition.rs#check and apply_denials","crates/sendbox-host/src/governance/operator.rs#GovernanceSource OperatorConfiguration and RevisionHighWater","crates/sendbox-host/src/governance/relay.rs#HostCredentialRelay","crates/sendbox-host/src/governance/fleet.rs#FleetClient and FleetGrantAuthority","crates/sendbox-cli/src/governance.rs#governance keygen sign verify check","guest/sendbox-guest/src/credential_relay.rs#loopback credential relay listener","docs/architecture/governed-sessions.md#Admission and composition"],"target_crate":"sendbox-host","target_phase":10,"conformance":{"status":"implemented","fixture_ids":["config.contracts","policy.decisions","cli.contracts","runtime.contracts"],"compatibility_note":"Brokered credentials require a persistent Apple or Kata session; Hyperlight and legacy MCP fields are rejected for governed sessions."}},
{"id":"module.rust-exec-broker","category":"source_module","name":"Rust production execution broker","disposition":"preserve","rationale":"Retain exact argv admission, compiled policy, authenticated sessions, bounded streaming, cancellation, environment construction, and cleanup outcomes.","evidence":["crates/sendbox-exec/src/lib.rs#public exports","crates/sendbox-exec/src/api.rs#ExecutionRequest and ExecutionResult","crates/sendbox-exec/src/broker.rs#Broker and CancellationFlag","crates/sendbox-exec/src/environment.rs#EnvironmentPolicy","crates/sendbox-exec/src/error.rs#ExecError and KernelPrimitive","crates/sendbox-exec/src/policy.rs#CompiledCommandPolicy","crates/sendbox-exec/src/runtime.rs#AuthenticatedUnixListener","crates/sendbox-exec/src/service.rs#BrokerService and startup_health_connection_does_not_consume_the_execution_session","crates/sendbox-exec/src/session.rs#BrokerSession","crates/sendbox-exec/src/bin/sendbox-exec-launcher.rs#sendbox-exec-launcher"],"target_crate":"sendbox-exec","target_phase":7,"conformance":{"status":"implemented","fixture_ids":["runtime.contracts","policy.decisions","known-defects.negative"],"compatibility_note":"Connection-only startup health probes do not consume an execution session; only an empty pre-request disconnect is retried, with peer and request authentication unchanged."}},
{"id":"module.rust-exec-linux","category":"source_module","name":"Rust Linux execution containment","disposition":"preserve","rationale":"Retain descriptor-relative resolution, atomic cgroup placement, pidfd lifecycle, cgroup-wide cleanup, capability removal, resource limits, and TSYNC seccomp enforcement.","evidence":["crates/sendbox-exec/src/platform/mod.rs#LiveGate","crates/sendbox-exec/src/platform/linux/mod.rs#Linux platform modules","crates/sendbox-exec/src/platform/linux/agent.rs#AgentBootstrap","crates/sendbox-exec/src/platform/linux/capabilities.rs#drop_all","crates/sendbox-exec/src/platform/linux/cgroup.rs#CgroupManager","crates/sendbox-exec/src/platform/linux/launcher.rs#DedicatedLauncherBackend","crates/sendbox-exec/src/platform/linux/pty.rs#PseudoTerminal","crates/sendbox-exec/src/platform/linux/raw.rs#audited Linux syscall adapter","crates/sendbox-exec/src/platform/linux/resolver.rs#ResolvedCommand","crates/sendbox-exec/src/platform/linux/rlimits.rs#apply","crates/sendbox-exec/src/platform/linux/seccomp.rs#TSYNC seccomp profiles"],"target_crate":"sendbox-exec","target_phase":7,"conformance":{"status":"implemented","fixture_ids":["runtime.contracts"],"compatibility_note":null}},
{"id":"module.rust-git","category":"source_module","name":"Rust native Git branch guard","disposition":"preserve","rationale":"Retain typed repository/workspace identity, exact supported Git parsing, bounded probes, clean environment policy, trusted binary discovery and verification, standalone policy delivery, and native execution replacement.","evidence":["crates/sendbox-git/src/argv.rs#Git argv and alias parsing","crates/sendbox-git/src/bin/sendbox-git-guard.rs#native guard protocol","crates/sendbox-git/src/discovery.rs#trusted Git discovery","crates/sendbox-git/src/error.rs#GuardError","crates/sendbox-git/src/identity.rs#repository and workspace identity","crates/sendbox-git/src/lib.rs#public policy API","crates/sendbox-git/src/pattern.rs#branch policy","crates/sendbox-git/src/process.rs#bounded injected process runner","crates/sendbox-git/src/service.rs#selected repository admission","crates/sendbox-git/src/standalone.rs#signed standalone guard policy","crates/sendbox-git/src/trusted.rs#trusted Git binary"],"target_crate":"sendbox-git","target_phase":7,"conformance":{"status":"implemented","fixture_ids":["policy.decisions","known-defects.negative"],"compatibility_note":null}},
Expand Down
1 change: 1 addition & 0 deletions crates/sendbox-agent/tests/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1829,6 +1829,7 @@ fn brokered_plan(resources: &TempResource, capabilities: &RuntimeCapabilities) -
project: ProjectId::new("github:octo/api").unwrap(),
effective_policy_sha256: Sha256Digest::parse_hex(&boundary.policy_sha256).unwrap(),
brokered_services: vec![ServiceId::new("anthropic").unwrap()],
exceptions: Vec::new(),
});
let signing_key = SigningKeyMaterial::generate().unwrap();
let fingerprint = signing_key
Expand Down
1 change: 1 addition & 0 deletions crates/sendbox-boundary/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1124,6 +1124,7 @@ mod tests {
effective_policy_sha256: Sha256Digest::parse_hex(&governed.policy_sha256)
.expect("policy digest"),
brokered_services: Vec::new(),
exceptions: Vec::new(),
});
governed.validate(now).expect("governed plan");
assert_ne!(
Expand Down
97 changes: 97 additions & 0 deletions crates/sendbox-governance/src/api.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
//! HTTP wire types of a shared governance service (`/v1`) that a SendBox host
//! and the service must agree on. Grant, request, and decision bodies reuse
//! the contract types directly.

use serde::{Deserialize, Serialize};

use crate::{
GovernanceBinding, PrincipalId, RevocationReason, SessionRef, digest::Sha256Digest,
exception::PolicyException,
};

/// Media type of error responses (RFC 9457).
pub const PROBLEM_CONTENT_TYPE: &str = "application/problem+json";

#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum CallerKind {
/// A person.
User,
/// A machine identity, such as a managed runner.
Worker,
}

/// `GET /v1/whoami`: the identity the service authenticated.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct CallerIdentity {
pub principal: PrincipalId,
pub kind: CallerKind,
pub operator: bool,
}

/// `POST /v1/sessions:admit` body. The binding principal must be the
/// authenticated caller; it is a claim, never a source of identity.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct SessionAdmissionRequest {
pub session: SessionRef,
pub binding: GovernanceBinding,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct SessionAdmission {
pub session: SessionRef,
pub binding_sha256: Sha256Digest,
pub admitted_at_unix: u64,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum SessionOutcome {
Completed,
Cancelled,
Failed,
}

impl SessionOutcome {
#[must_use]
pub const fn code(self) -> &'static str {
match self {
Self::Completed => "completed",
Self::Cancelled => "cancelled",
Self::Failed => "failed",
}
}

#[must_use]
pub const fn revocation_reason(self) -> RevocationReason {
match self {
Self::Completed => RevocationReason::SessionCompleted,
Self::Cancelled => RevocationReason::SessionCancelled,
Self::Failed => RevocationReason::SessionFailed,
}
}
}

/// `POST /v1/sessions/{session}:end` body. Ending a session revokes its grants.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct SessionEnd {
pub outcome: SessionOutcome,
}

/// `POST /v1/grants/{grant}:revoke` body.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct RevokeGrantRequest {
pub reason: RevocationReason,
}

/// `GET /v1/exceptions` response.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct ExceptionList {
pub exceptions: Vec<PolicyException>,
}
Loading
Loading