Add L0-L4 security clearance for fleet commands and AI elevation.

Gate manual and AI commands by per-agent clearance, auto-elevate stuck hosts to L4 when AI mode allows, and surface clearance in Access Depth and LOTL timeline.
This commit is contained in:
AetherForge
2026-06-07 02:30:00 -07:00
parent dd612251d1
commit f89ba94cb7
21 changed files with 952 additions and 46 deletions

View File

@@ -88,3 +88,33 @@ func (h *FleetAIHandler) GetDecisions(w http.ResponseWriter, r *http.Request) {
}
writeJSON(w, rows)
}
func (h *FleetAIHandler) GetClearanceEvents(w http.ResponseWriter, r *http.Request) {
if h.db == nil {
writeJSON(w, []db.ClearanceEvent{})
return
}
listFn, ok := h.db.(interface {
ListClearanceEvents(agentID string, limit int) ([]db.ClearanceEvent, error)
})
if !ok {
writeJSON(w, []db.ClearanceEvent{})
return
}
agentID := strings.TrimSpace(r.URL.Query().Get("agent_id"))
limit := 50
if raw := r.URL.Query().Get("limit"); raw != "" {
if n, err := strconv.Atoi(raw); err == nil && n > 0 {
limit = n
}
}
rows, err := listFn.ListClearanceEvents(agentID, limit)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
if rows == nil {
rows = []db.ClearanceEvent{}
}
writeJSON(w, rows)
}