Skip to content

Agent Mesh

Refactor policy bindings to use strongly-typed 'members' array

Antonio Ojea3be2f2944070
diff --git a/.github/k8s/sam-hub-template.yaml b/.github/k8s/sam-hub-template.yaml
index a72da18a..1178884d 100644
--- a/.github/k8s/sam-hub-template.yaml
+++ b/.github/k8s/sam-hub-template.yaml
@@ -111,14 +111,21 @@ data:
policies.yaml: |
version: "v1alpha1"
bindings:
- - user: "system:serviceaccount:sam-canary-${ENV_NAME}:sam-node-sa"
+ - members: ["user:system:serviceaccount:sam-canary-${ENV_NAME}:sam-node-sa"]
role: "sam-canary"
+ - members: ["system:authenticated"]
+ role: "public-mesh"
roles:
sam-canary:
allowed_services:
- "*"
allowed_targets:
- "*"
+ public-mesh:
+ allowed_services:
+ - "system://sam.catalog"
+ allowed_targets:
+ - "*"
---
apiVersion: monitoring.googleapis.com/v1
kind: PodMonitoring
diff --git a/api/datalog.go b/api/datalog.go
index aebf4fb6..d13a92ee 100644
--- a/api/datalog.go
+++ b/api/datalog.go
@@ -51,9 +51,6 @@ import (
// If target_unrestricted is present, target checking succeeds immediately.
// Otherwise, it requires a matching allow_network_target rule to succeed.
//
-// For a high-level overview of policy translation and schemas, see the
-// documentation in site/content/docs/development/policy.md.
-//
// ============================================================================
// Biscuit fact names represent the Datalog predicates used in auth tokens and policy evaluation.
@@ -214,12 +211,25 @@ var (
func init() {
// 1. Service Allow Policies
policyStrs := []string{
+ // Exact Match: Allows access if the token possesses a granted_service_exact fact
+ // that perfectly matches both the protocol type (e.g. "mcp") and the service name (e.g. "calculator").
fmt.Sprintf(`allow if %s($type, $name), %s($type, $name)`, FactService, FactGrantedServiceExact),
+
+ // Prefix Match: Allows access if the token possesses a granted_service_prefix fact
+ // for the given protocol type, and the requested service name starts with that prefix.
fmt.Sprintf(`allow if %s($type, $name), %s($type, $prefix), $name.starts_with($prefix)`, FactService, FactGrantedServicePrefix),
+
+ // Suffix Match: Allows access if the token possesses a granted_service_suffix fact
+ // for the given protocol type, and the requested service name ends with that suffix.
fmt.Sprintf(`allow if %s($type, $name), %s($type, $suffix), $name.ends_with($suffix)`, FactService, FactGrantedServiceSuffix),
+
+ // Type Wildcard: Allows access if the token possesses a granted_service_all fact
+ // for the given protocol type, granting access to ANY service name within that namespace.
fmt.Sprintf(`allow if %s($type, $name), %s($type)`, FactService, FactGrantedServiceAll),
+
+ // Global Wildcard: Allows access if the token possesses a granted_service_all_types fact,
+ // granting access to literally any service in any namespace (equivalent to '*').
fmt.Sprintf(`allow if %s($type, $name), %s()`, FactService, FactGrantedServiceAllTypes),
- fmt.Sprintf(`allow if %s(%q, "%s")`, FactService, SystemNamespace, CatalogTarget),
}
for i, pStr := range policyStrs {
@@ -233,10 +243,19 @@ func init() {
// 2. Target Evaluation Rules
// These rules satisfy the check if allow_network_target($fact, $val) injected by the Hub.
ruleStrs := []string{
+ // Exact Match: Derives allow_network_target if the token has a granted_target_exact fact matching a target_fact exactly.
fmt.Sprintf(`%s($fact, $val) <- %s($fact, $val), %s($fact, $val)`, FactAllowNetworkTarget, FactTargetFact, FactGrantedTargetExact),
+
+ // Prefix Match: Derives allow_network_target if the token has a granted_target_prefix fact and the target_fact value starts with that prefix.
fmt.Sprintf(`%s($fact, $val) <- %s($fact, $val), %s($fact, $prefix), $val.starts_with($prefix)`, FactAllowNetworkTarget, FactTargetFact, FactGrantedTargetPrefix),
+
+ // Suffix Match: Derives allow_network_target if the token has a granted_target_suffix fact and the target_fact value ends with that suffix.
fmt.Sprintf(`%s($fact, $val) <- %s($fact, $val), %s($fact, $suffix), $val.ends_with($suffix)`, FactAllowNetworkTarget, FactTargetFact, FactGrantedTargetSuffix),
+
+ // Wildcard Fact Match: Derives allow_network_target if the token has a granted_target_all fact for a specific fact name (e.g. all values for "group").
fmt.Sprintf(`%s($fact, $val) <- %s($fact, $val), %s($fact)`, FactAllowNetworkTarget, FactTargetFact, FactGrantedTargetAll),
+
+ // Global Wildcard Match: Derives allow_network_target if the token has a granted_target_all_facts fact, unconditionally allowing any target_fact.
fmt.Sprintf(`%s($fact, $val) <- %s($fact, $val), %s()`, FactAllowNetworkTarget, FactTargetFact, FactGrantedTargetAllFacts),
}
@@ -249,16 +268,23 @@ func init() {
}
var err error
+
+ // BaselineReplayCheck prevents token theft/replay by ensuring the client_peer_id fact (embedded by the Hub during issuance)
+ // perfectly matches the connection_peer_id fact (provided by the local node verifying the incoming libp2p connection).
BaselineReplayCheck, err = parser.FromStringCheck(fmt.Sprintf(`check if %s($id), %s($id)`, FactClientPeerID, FactConnectionPeerID))
if err != nil {
panic(fmt.Sprintf("failed to parse replay check: %v", err))
}
+ // BaselineTargetCheck enforces network target restrictions. The token must either have an unrestricted target,
+ // or one of the Target Evaluation Rules must have successfully derived an allow_network_target fact.
BaselineTargetCheck, err = parser.FromStringCheck(fmt.Sprintf(`check if %s($fact, $val) or %s()`, FactAllowNetworkTarget, FactTargetUnrestricted))
if err != nil {
panic(fmt.Sprintf("failed to parse target check: %v", err))
}
+ // OIDC Claims to Target Facts: Maps dynamically generated OIDC facts (like `user("alice")`)
+ // into standard `target_fact("user", "alice")` facts for unified evaluation against network target policies.
for _, val := range OIDCClaimToFact() {
ruleStr := fmt.Sprintf(`%s(%q, $val) <- %s($val)`, FactTargetFact, val, val)
r, err := parser.FromStringRule(ruleStr)
@@ -268,17 +294,23 @@ func init() {
TargetFactRules = append(TargetFactRules, r)
}
+ // Node PeerID Target Fact: Ensures the target node's PeerID is also evaluated as a standard target_fact.
r, err := parser.FromStringRule(fmt.Sprintf(`%s(%q, $val) <- %s($val)`, FactTargetFact, FactNode, FactNode))
if err != nil {
panic(fmt.Sprintf("failed to parse node fact rule: %v", err))
}
TargetFactRules = append(TargetFactRules, r)
+ // HubStaticTimeCheck ensures the token is not expired at the time of evaluation.
HubStaticTimeCheck, err = parser.FromStringCheck(fmt.Sprintf(`check if %s($time), %s($exp), $time <= $exp`, FactTime, FactExpiration))
if err != nil {
panic(fmt.Sprintf("failed to parse static time check: %v", err))
}
+ // AllowIfTruePolicy is a permissive fallback policy used when explicit local node policies are omitted.
+ // Note that this does NOT mean all requests are automatically allowed. Biscuit requires at least one policy
+ // to evaluate to true AND all checks to pass. This simply satisfies the policy requirement, effectively
+ // deferring entirely to the Hub's checks and granted facts without imposing extra local restrictions.
AllowIfTruePolicy, err = parser.FromStringPolicy("allow if true")
if err != nil {
panic(fmt.Sprintf("failed to parse static allow policy: %v", err))
diff --git a/api/datalog_test.go b/api/datalog_test.go
index 4171bd1f..7d3bb3bd 100644
--- a/api/datalog_test.go
+++ b/api/datalog_test.go
@@ -114,12 +114,6 @@ func TestBaselinePolicies(t *testing.T) {
requestTarget: "mcp://calculator",
expectAllow: true,
},
- {
- name: "System catalog is always allowed",
- tokenFacts: []biscuit.Fact{},
- requestTarget: "system://sam.catalog",
- expectAllow: true,
- },
}
for _, tt := range tests {
diff --git a/api/policy.go b/api/policy.go
index 1f059ef8..1fb94c73 100644
--- a/api/policy.go
+++ b/api/policy.go
@@ -14,6 +14,21 @@
package api
+const (
+ // SystemAuthenticated is a special member string representing any authenticated user.
+ SystemAuthenticated = "system:authenticated"
+)
+
+var (
+ // ValidMemberPrefixes defines the allowed identity prefixes in policy configuration.
+ ValidMemberPrefixes = map[string]struct{}{
+ FactUser: {},
+ FactGroup: {},
+ FactEmail: {},
+ FactNode: {},
+ }
+)
+
// PolicyConfig is the root authorization configuration for the SAM Hub.
type PolicyConfig struct {
Version string `yaml:"version"`
@@ -22,10 +37,8 @@ type PolicyConfig struct {
}
type Binding struct {
- Group string `yaml:"group,omitempty"`
- User string `yaml:"user,omitempty"`
- Email string `yaml:"email,omitempty"`
- Role string `yaml:"role"`
+ Role string `yaml:"role"`
+ Members []string `yaml:"members"` // format: "type:value" e.g. "user:alice", "group:eng"
}
// RolePolicy defines the capabilities granted to a specific authorization role.
diff --git a/cmd/sam-hub/biscuit.go b/cmd/sam-hub/biscuit.go
index 1b98713a..49b368bd 100644
--- a/cmd/sam-hub/biscuit.go
+++ b/cmd/sam-hub/biscuit.go
@@ -46,23 +46,40 @@ func (h *Hub) mintBiscuitToken(claims jwt.MapClaims, token *oidc.IDToken, remote
// Resolve roles based on configured bindings and explicit OIDC roles
resolvedRoles := make(map[string]bool)
if h.Policy != nil {
- // 1. Map OIDC groups, users, and emails to roles via configured bindings (RBAC mapping)
+ // 1. Evaluate explicit Policy Bindings
for _, b := range h.Policy.Bindings {
- if b.Group != "" {
- for _, cg := range oidcGroups {
- if b.Group == cg {
- resolvedRoles[b.Role] = true
- }
- }
- }
- if b.User != "" && oidcSub != "" {
- if b.User == oidcSub {
+ for _, member := range b.Members {
+ if member == api.SystemAuthenticated {
resolvedRoles[b.Role] = true
+ break
}
- }
- if b.Email != "" && oidcEmail != "" {
- if b.Email == oidcEmail {
- resolvedRoles[b.Role] = true
+
+ parts := strings.SplitN(member, ":", 2)
+ if len(parts) != 2 {
+ continue // validated at startup, but ignore if broken
+ }
+ prefix := parts[0]
+ value := parts[1]
+
+ switch prefix {
+ case "group":
+ for _, cg := range oidcGroups {
+ if value == cg {
+ resolvedRoles[b.Role] = true
+ }
+ }
+ case "user":
+ if oidcSub != "" && value == oidcSub {
+ resolvedRoles[b.Role] = true
+ }
+ case "email":
+ if oidcEmail != "" && value == oidcEmail {
+ resolvedRoles[b.Role] = true
+ }
+ case "node":
+ if value == remotePeer.String() {
+ resolvedRoles[b.Role] = true
+ }
}
}
}
diff --git a/cmd/sam-hub/biscuit_benchmark_test.go b/cmd/sam-hub/biscuit_benchmark_test.go
index a582b2f9..22ad11f7 100644
--- a/cmd/sam-hub/biscuit_benchmark_test.go
+++ b/cmd/sam-hub/biscuit_benchmark_test.go
@@ -40,10 +40,7 @@ func BenchmarkMintBiscuitToken(b *testing.B) {
KeyRing: kr,
Policy: &api.PolicyConfig{
Bindings: []api.Binding{
- {
- Group: "engineering",
- Role: "developer-role",
- },
+ {Role: "developer-role", Members: []string{"group:engineering"}},
},
Roles: map[string]api.RolePolicy{
"developer-role": {
diff --git a/cmd/sam-hub/biscuit_test.go b/cmd/sam-hub/biscuit_test.go
index 61dc473b..d34e9a4b 100644
--- a/cmd/sam-hub/biscuit_test.go
+++ b/cmd/sam-hub/biscuit_test.go
@@ -44,14 +44,8 @@ func TestMintBiscuitToken(t *testing.T) {
KeyRing: kr,
Policy: &api.PolicyConfig{
Bindings: []api.Binding{
- {
- Group: "system:serviceaccounts:sam-canary",
- Role: "canary-role",
- },
- {
- User: "system:serviceaccount:sam-canary:sam-node-sa",
- Role: "canary-role",
- },
+ {Role: "canary-role", Members: []string{"group:system:serviceaccounts:sam-canary"}},
+ {Role: "canary-role", Members: []string{"user:system:serviceaccount:sam-canary:sam-node-sa"}},
},
Roles: map[string]api.RolePolicy{
"admin": {
@@ -292,10 +286,7 @@ func TestMintBiscuitToken_ClaimsTranslation(t *testing.T) {
KeyRing: kr,
Policy: &api.PolicyConfig{
Bindings: []api.Binding{
- {
- Group: "engineering",
- Role: "developer-role",
- },
+ {Role: "developer-role", Members: []string{"group:engineering"}},
},
Roles: map[string]api.RolePolicy{
"developer-role": {
@@ -473,10 +464,7 @@ func TestMintBiscuitToken_VariousClaimsTypes(t *testing.T) {
KeyRing: kr,
Policy: &api.PolicyConfig{
Bindings: []api.Binding{
- {
- Group: "eng-group",
- Role: "eng-role",
- },
+ {Role: "eng-role", Members: []string{"group:eng-group"}},
},
Roles: map[string]api.RolePolicy{
"admin": {},
diff --git a/cmd/sam-hub/config.go b/cmd/sam-hub/config.go
index 1885a0ad..6f08b8ef 100644
--- a/cmd/sam-hub/config.go
+++ b/cmd/sam-hub/config.go
@@ -51,23 +51,24 @@ func LoadPolicyConfig(path string) (*api.PolicyConfig, error) {
// ValidatePolicyConfig ensures that no wildcards are used in policies, and that all referenced roles in bindings exist.
func ValidatePolicyConfig(config *api.PolicyConfig) error {
for _, b := range config.Bindings {
- if b.Group == "" && b.User == "" && b.Email == "" {
- return fmt.Errorf("binding must specify either 'group', 'user', or 'email'")
+ if len(b.Members) == 0 {
+ return fmt.Errorf("binding must specify at least one member")
}
- // A binding should only specify one of them
- count := 0
- if b.Group != "" {
- count++
- }
- if b.User != "" {
- count++
- }
- if b.Email != "" {
- count++
- }
- if count > 1 {
- return fmt.Errorf("binding cannot specify multiple identities (group/user/email) concurrently")
+
+ for _, member := range b.Members {
+ if member == api.SystemAuthenticated {
+ continue
+ }
+ parts := strings.SplitN(member, ":", 2)
+ if len(parts) != 2 {
+ return fmt.Errorf("member %q is invalid, must be in format 'type:value' or '%s'", member, api.SystemAuthenticated)
+ }
+ prefix := parts[0]
+ if _, validPrefix := api.ValidMemberPrefixes[prefix]; !validPrefix {
+ return fmt.Errorf("member prefix %q is invalid, expected one of the standard identity facts (e.g., user, group, email, node)", prefix)
+ }
}
+
if b.Role == "" {
return fmt.Errorf("binding role cannot be empty")
}
diff --git a/cmd/sam-hub/config_test.go b/cmd/sam-hub/config_test.go
index 2875ced9..0b4d6135 100644
--- a/cmd/sam-hub/config_test.go
+++ b/cmd/sam-hub/config_test.go
@@ -100,7 +100,7 @@ roles:
yamlContent: `
version: "v1alpha1"
bindings:
- - group: "system:serviceaccounts:sam-canary-bananas"
+ - members: ["group:system:serviceaccounts:sam-canary-bananas"]
role: "mesh-member"
roles:
mesh-member:
@@ -111,7 +111,7 @@ roles:
if len(config.Bindings) != 1 {
t.Errorf("expected 1 binding, got %d", len(config.Bindings))
}
- if config.Bindings[0].Group != "system:serviceaccounts:sam-canary-bananas" || config.Bindings[0].Role != "mesh-member" {
+ if len(config.Bindings[0].Members) == 0 || config.Bindings[0].Members[0] != "group:system:serviceaccounts:sam-canary-bananas" || config.Bindings[0].Role != "mesh-member" {
t.Errorf("unexpected binding values: %+v", config.Bindings[0])
}
},
@@ -121,7 +121,7 @@ roles:
yamlContent: `
version: "v1alpha1"
bindings:
- - group: "system:serviceaccounts:sam-canary-bananas"
+ - members: ["group:system:serviceaccounts:sam-canary-bananas"]
role: "non-existent-role"
roles:
mesh-member:
@@ -134,7 +134,7 @@ roles:
yamlContent: `
version: "v1alpha1"
bindings:
- - user: "system:serviceaccount:sam-canary:sam-node-sa"
+ - members: ["user:system:serviceaccount:sam-canary:sam-node-sa"]
role: "mesh-member"
roles:
mesh-member:
@@ -145,13 +145,13 @@ roles:
if len(config.Bindings) != 1 {
t.Errorf("expected 1 binding, got %d", len(config.Bindings))
}
- if config.Bindings[0].User != "system:serviceaccount:sam-canary:sam-node-sa" || config.Bindings[0].Role != "mesh-member" {
+ if len(config.Bindings[0].Members) == 0 || config.Bindings[0].Members[0] != "user:system:serviceaccount:sam-canary:sam-node-sa" || config.Bindings[0].Role != "mesh-member" {
t.Errorf("unexpected binding values: %+v", config.Bindings[0])
}
},
},
{
- name: "Invalid binding with both group and user missing",
+ name: "Invalid binding with no members",
yamlContent: `
version: "v1alpha1"
bindings:
@@ -163,12 +163,45 @@ roles:
wantErr: true,
},
{
- name: "Invalid binding with both group and user populated",
+ name: "Invalid binding with invalid prefix",
yamlContent: `
version: "v1alpha1"
bindings:
- - group: "some-group"
- user: "some-user"
+ - members: ["invalid-prefix:some-user"]
+ role: "mesh-member"
+roles:
+ mesh-member:
+ allowed_services: ["mcp://1.0.0"]
+`,
+ wantErr: true,
+ },
+ {
+ name: "Valid binding with all valid member prefixes",
+ yamlContent: `
+version: "v1alpha1"
+bindings:
+ - members: ["user:bob", "group:eng", "email:[email protected]", "node:12D3KooW", "system:authenticated"]
+ role: "mesh-member"
+roles:
+ mesh-member:
+ allowed_services: ["mcp://1.0.0"]
+`,
+ wantErr: false,
+ verify: func(t *testing.T, config *api.PolicyConfig) {
+ if len(config.Bindings) != 1 {
+ t.Errorf("expected 1 binding, got %d", len(config.Bindings))
+ }
+ if len(config.Bindings[0].Members) != 5 {
+ t.Errorf("expected 5 members, got %d", len(config.Bindings[0].Members))
+ }
+ },
+ },
+ {
+ name: "Invalid binding missing colon in member string",
+ yamlContent: `
+version: "v1alpha1"
+bindings:
+ - members: ["userbob"]
role: "mesh-member"
roles:
mesh-member:
diff --git a/cmd/sam-node/mcp_handlers_test.go b/cmd/sam-node/mcp_handlers_test.go
index 7d9c3e4a..fbedeeaf 100644
--- a/cmd/sam-node/mcp_handlers_test.go
+++ b/cmd/sam-node/mcp_handlers_test.go
@@ -362,11 +362,9 @@ func buildAndSaveCustomBiscuit(node *SamNode, rootPriv ed25519.PrivateKey, allow
return err
}
for _, svc := range allowedServices {
- parts := strings.SplitN(svc, ":", 2)
- opType := parts[0]
- opName := "*"
- if len(parts) > 1 {
- opName = parts[1]
+ opType, opName := api.ParseServiceTarget(svc)
+ if opName == "" {
+ opName = "*"
}
if err := builder.AddAuthorityFact(biscuit.Fact{Predicate: biscuit.Predicate{
Name: "granted_service_exact",
@@ -405,9 +403,8 @@ func TestFetchRemoteToolCatalogue_AuthRejected(t *testing.T) {
t.Fatal(err)
}
- // Create a biscuit that DOES NOT allow "summarizer", only "some_other_service".
- // By baseline rules, it will STILL allow the catalog fetch.
- if err := buildAndSaveCustomBiscuit(nodeA, rootPrivEd, []string{"some_other_service"}); err != nil {
+ // Create a biscuit that DOES NOT allow "summarizer", only "some_other_service" and "system://sam.catalog".
+ if err := buildAndSaveCustomBiscuit(nodeA, rootPrivEd, []string{"mcp://some_other_service", "system://sam.catalog"}); err != nil {
t.Fatalf("buildAndSaveCustomBiscuit: %v", err)
}
diff --git a/cmd/sam-node/middleware_test.go b/cmd/sam-node/middleware_test.go
index 142fcd6b..e3f01c3a 100644
--- a/cmd/sam-node/middleware_test.go
+++ b/cmd/sam-node/middleware_test.go
@@ -198,15 +198,7 @@ func TestBaselineRules(t *testing.T) {
target: "mcp://anything",
expectSuccess: true,
},
- {
- name: "Baseline Rule 3: Catalog Target",
- mintToken: func(t *testing.T, builder biscuit.Builder) {
- // No specific allowed_service facts needed
- },
- protocol: api.CatalogTarget, // "catalog"
- target: "system://" + api.CatalogTarget,
- expectSuccess: true,
- },
+
{
name: "Baseline Rule 4: Type Wildcard",
mintToken: func(t *testing.T, builder biscuit.Builder) {
diff --git a/site/content/docs/development/policy.md b/site/content/docs/development/policy.md
index 442d6d1e..ee6c6201 100644
--- a/site/content/docs/development/policy.md
+++ b/site/content/docs/development/policy.md
@@ -223,21 +223,21 @@ version: "v1alpha1"
# so they must be bound explicitly using their 'user' claim format.
bindings:
# 1. Global Admins (Infrastructure SAs, Lead Architects)
- - user: "system:serviceaccount:sam-mesh:admin-sa"
+ - members: ["user:system:serviceaccount:sam-mesh:admin-sa"]
role: "admin"
- - group: "infrastructure-leads"
+ - members: ["group:infrastructure-leads"]
role: "admin"
# 2. Software Developers
- - group: "software-engineering-team"
+ - members: ["group:software-engineering-team"]
role: "developer"
# 3. Data Scientists & AI Engineers
- - group: "data-science-team"
+ - members: ["group:data-science-team"]
role: "data-scientist"
# 4. Contractors / Read-Only Audits
- - email: "[email protected]"
+ - members: ["email:[email protected]"]
role: "auditor"
# Roles define the allowed destinations (allowed_targets) and tools (allowed_services)
diff --git a/site/content/docs/user/hub-configuration.md b/site/content/docs/user/hub-configuration.md
index 10fa348b..1ba1742e 100644
--- a/site/content/docs/user/hub-configuration.md
+++ b/site/content/docs/user/hub-configuration.md
@@ -78,11 +78,11 @@ roles:
# Bind OIDC user subs, emails, or group claims to roles
bindings:
- - email: "[email protected]"
+ - members: ["email:[email protected]"]
role: "admin-role"
- - user: "auth0|123456"
+ - members: ["user:auth0|123456"]
role: "admin-role"
- - group: "eng-team"
+ - members: ["group:eng-team"]
role: "developer-role"
```
diff --git a/site/content/docs/user/kubernetes-deployment.md b/site/content/docs/user/kubernetes-deployment.md
index 592e9ef7..e8b11a6a 100644
--- a/site/content/docs/user/kubernetes-deployment.md
+++ b/site/content/docs/user/kubernetes-deployment.md
@@ -111,7 +111,7 @@ data:
policies.yaml: |
version: "v1alpha1"
bindings:
- - user: "system:serviceaccount:sam-nodes:sam-node-sa"
+ - members: ["user:system:serviceaccount:sam-nodes:sam-node-sa"]
role: "node-role"
roles:
node-role:
diff --git a/tests/e2e/fixtures/default-policy.yaml b/tests/e2e/fixtures/default-policy.yaml
index 9d1c5c3c..8cd17c22 100644
--- a/tests/e2e/fixtures/default-policy.yaml
+++ b/tests/e2e/fixtures/default-policy.yaml
@@ -1,6 +1,6 @@
version: v1alpha1
bindings:
- - group: "*"
+ - members: ["group:*"]
role: admin
roles:
admin:
diff --git a/tests/e2e/fixtures/sam-hub.yaml b/tests/e2e/fixtures/sam-hub.yaml
index 2a99bcbf..1d49a689 100644
--- a/tests/e2e/fixtures/sam-hub.yaml
+++ b/tests/e2e/fixtures/sam-hub.yaml
@@ -9,13 +9,13 @@ data:
policy.yaml: |
version: v1alpha1
bindings:
- - user: "system:serviceaccount:default:sam-node-sa"
+ - members: ["user:system:serviceaccount:default:sam-node-sa"]
role: admin
- - group: "data-scientist"
+ - members: ["group:data-scientist"]
role: mesh-member
- - group: "admin"
+ - members: ["group:admin"]
role: admin
- - user: "admin-user"
+ - members: ["user:admin-user"]
role: admin
roles:
admin:
@@ -29,6 +29,7 @@ data:
- "mcp://db-agent"
- "mcp://http-tool"
- "mcp://stdio-tool"
+ - "system://sam.catalog"
allowed_targets:
- "*"
---
diff --git a/tests/integration/federation_test.go b/tests/integration/federation_test.go
index 6a1add8e..f8a47ca7 100644
--- a/tests/integration/federation_test.go
+++ b/tests/integration/federation_test.go
@@ -30,12 +30,13 @@ func TestHubFederationAndRelay(t *testing.T) {
policyFile := filepath.Join(tmpDir, "policies.yaml")
policyContent := `version: "v1alpha1"
bindings:
- - user: mock-user
+ - members: ["user:mock-user"]
role: admin
roles:
admin:
allowed_services:
- "mcp://*"
+ - "system://sam.catalog"
`
if err := os.WriteFile(policyFile, []byte(policyContent), 0644); err != nil {
t.Fatal(err)
diff --git a/tests/integration/local_policy_test.go b/tests/integration/local_policy_test.go
index 01bd4588..1694fddc 100644
--- a/tests/integration/local_policy_test.go
+++ b/tests/integration/local_policy_test.go
@@ -25,9 +25,9 @@ roles:
allowed_targets: []
bindings:
- role: none
- user: "unprivileged-user"
+ members: ["user:unprivileged-user"]
- role: none
- user: "nodeB-user"
+ members: ["user:nodeB-user"]
`
if err := os.WriteFile(hubPolicyFile, []byte(hubPolicyYAML), 0644); err != nil {
t.Fatal(err)
@@ -185,9 +185,9 @@ roles:
allowed_targets: ["group:admin-only"]
bindings:
- role: restricted-role
- user: "client-user"
+ members: ["user:client-user"]
- role: restricted-role
- user: "nodeB-user"
+ members: ["user:nodeB-user"]
`
if err := os.WriteFile(hubPolicyFile, []byte(hubPolicyYAML), 0644); err != nil {
t.Fatal(err)
diff --git a/tests/integration/policy_permutations_test.go b/tests/integration/policy_permutations_test.go
index 610fe544..29a98bbc 100644
--- a/tests/integration/policy_permutations_test.go
+++ b/tests/integration/policy_permutations_test.go
@@ -100,17 +100,17 @@ roles:
bindings:
- role: role-user
- user: "bob-subject"
+ members: ["user:bob-subject"]
- role: role-email
+ members: ["email:[email protected]"]
- role: role-group
- group: "eng-team"
+ members: ["group:eng-team"]
- role: role-node
- user: "node-user"
+ members: ["user:node-user"]
- role: admin
- user: "admin-user"
+ members: ["user:admin-user"]
- role: admin
- user: "nodeB"
+ members: ["user:nodeB"]
`
if err := os.WriteFile(hubPolicyFile, []byte(hubPolicyYAML), 0644); err != nil {
t.Fatal(err)