Phase 4: SSO scaffolding, RBAC enforcement, tenant-scoped dashboards, audit logging, K8s deployment
RBAC (api/internal/authz) is live on /query and /dashboards, backed by a new enterprise/ module (session issuance, audit logging, RBAC storage, OIDC/SAML protocol wiring) that core never imports -- only calls over HTTP. Found and fixed a real cross-tenant vulnerability in dashboards (no tenant_id filtering at all) while writing the threat model doc. Two things are explicitly NOT done, documented rather than hidden: tenant isolation for log data itself (/query still shares one ClickHouse connection and Tantivy index across every tenant -- RBAC controls who can query, not what a query can see), and human SSO login (protocol wiring exists, no HTTP handler calls it yet). See docs/security/threat-model.md and docs/phase-4-runbook.md. Also adds deploy/ (Go Operator + Helm chart, validated offline only -- no cluster was reachable in this environment).
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package authz
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestRoleSatisfies(t *testing.T) {
|
||||
tests := []struct {
|
||||
have, want Role
|
||||
satisfies bool
|
||||
}{
|
||||
{RoleViewer, RoleViewer, true},
|
||||
{RoleEditor, RoleViewer, true},
|
||||
{RoleAdmin, RoleViewer, true},
|
||||
{RoleOwner, RoleViewer, true},
|
||||
{RoleViewer, RoleEditor, false},
|
||||
{RoleViewer, RoleAdmin, false},
|
||||
{RoleEditor, RoleAdmin, false},
|
||||
{RoleAdmin, RoleOwner, false},
|
||||
{RoleOwner, RoleOwner, true},
|
||||
// RoleService is a separate lane, not on the human rank scale --
|
||||
// per /docs/phase-4-isolation-design.md's alerting service
|
||||
// identity, it must never satisfy a human role requirement no
|
||||
// matter how "high" that might look on paper, and a human role
|
||||
// (even Owner) must never satisfy a RoleService requirement.
|
||||
{RoleService, RoleViewer, false},
|
||||
{RoleService, RoleOwner, false},
|
||||
{RoleOwner, RoleService, false},
|
||||
{RoleViewer, RoleService, false},
|
||||
{RoleService, RoleService, true},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
got := tt.have.Satisfies(tt.want)
|
||||
if got != tt.satisfies {
|
||||
t.Errorf("Role(%q).Satisfies(%q) = %v, want %v", tt.have, tt.want, got, tt.satisfies)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user