Skip to content

Agent Mesh

OIDC semantic alignment with Biscuis facts

Antonio Ojeaef4dc73d12fb
diff --git a/api/constants.go b/api/constants.go
index a18f78dc..28571e21 100644
--- a/api/constants.go
+++ b/api/constants.go
@@ -29,6 +29,7 @@ const (
FactNode = "node"
FactClientPeerID = "client_peer_id"
FactGroup = "group"
+ FactRole = "role"
FactMCPTool = "allow_mcp_tool"
FactNetworkTarget = "allow_network_target"
)
diff --git a/cmd/sam-hub/main.go b/cmd/sam-hub/main.go
index 31b584b2..28c5dabc 100644
--- a/cmd/sam-hub/main.go
+++ b/cmd/sam-hub/main.go
@@ -462,13 +462,24 @@ func (h *Hub) mintBiscuitToken(claims jwt.MapClaims, token *oidc.IDToken, remote
return nil, fmt.Errorf("failed to add client_peer_id fact: %w", err)
}
- for role := range resolvedRoles {
+ // Assert original OIDC groups in the token (semantic audit trail)
+ for _, cg := range claimsGroups {
if err := builder.AddAuthorityFact(biscuit.Fact{Predicate: biscuit.Predicate{
Name: api.FactGroup,
- IDs: []biscuit.Term{biscuit.String(role)},
+ IDs: []biscuit.Term{biscuit.String(cg)},
}}); err != nil {
return nil, fmt.Errorf("failed to add group fact: %w", err)
}
+ }
+
+ // Assert resolved authorized roles in the token
+ for role := range resolvedRoles {
+ if err := builder.AddAuthorityFact(biscuit.Fact{Predicate: biscuit.Predicate{
+ Name: api.FactRole,
+ IDs: []biscuit.Term{biscuit.String(role)},
+ }}); err != nil {
+ return nil, fmt.Errorf("failed to add role fact: %w", err)
+ }
if h.Policy != nil {
if rolePolicy, ok := h.Policy.Roles[role]; ok {