feat: require authentication and own uploads per Outpost (auth M0)
- auth is mandatory by default, including loopback and local proxies; startup refuses a hub with no credentials; TESSERA_LOCAL_DEVELOPMENT is explicit and loopback-only - legacy uploads are bound to an owning Outpost (PUT /api/v1/orbits/:id/outpost); unowned orbits and sessions fail closed - typed Principal and payload-free audit_events table - endpoint authorization contract with tests comparing it to the router - A00 compatibility spike (tests/auth-compat) and library research - archive the superseded A00-A25 plan Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -408,6 +408,17 @@ pub(super) fn header_value<'a>(headers: &'a HeaderMap, name: &str) -> Result<&'a
|
||||
}
|
||||
|
||||
pub(super) fn outpost(state: &HubState, headers: &HeaderMap) -> Result<Uuid, StatusCode> {
|
||||
use crate::auth::{AuditAction, AuditOutcome, AuditResource, Principal};
|
||||
let result = authenticate_outpost(state, headers);
|
||||
let (actor, resource, outcome) = match result {
|
||||
Ok(id) => (Principal::Outpost(id), AuditResource::Outpost(id), AuditOutcome::Allowed),
|
||||
Err(_) => (Principal::Anonymous, AuditResource::Api, AuditOutcome::Denied),
|
||||
};
|
||||
state.db.audit_event(&actor, AuditAction::Authentication, resource, outcome, Uuid::new_v4()).map_err(internal)?;
|
||||
result
|
||||
}
|
||||
|
||||
fn authenticate_outpost(state: &HubState, headers: &HeaderMap) -> Result<Uuid, StatusCode> {
|
||||
let token = upload_token(state, headers)?;
|
||||
let id = state
|
||||
.db
|
||||
|
||||
Reference in New Issue
Block a user