Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ type TokenExchangeInboundGrantConfig struct {
// TokenExchangeIssuerPolicyConfig binds RFC 8693 policy to a named trusted issuer.
//
// +kubebuilder:validation:XValidation:rule="!('*' in self.allowedDelegateClients) || size(self.allowedDelegateClients) == 1",message="allowedDelegateClients must not combine the wildcard \"*\" with specific client IDs"
// +kubebuilder:validation:XValidation:rule="!(self.allowMayAct && '*' in self.allowedDelegateClients)",message="allowMayAct must not be enabled when allowedDelegateClients contains the wildcard \"*\""
// +kubebuilder:validation:XValidation:rule="!(has(self.allowMayAct) && self.allowMayAct && '*' in self.allowedDelegateClients)",message="allowMayAct must not be enabled when allowedDelegateClients contains the wildcard \"*\""
// +kubebuilder:validation:XValidation:rule="!has(self.actorClaim) || !(self.actorClaim in ['sub', 'iss', 'aud', 'exp', 'iat', 'nbf', 'jti', 'name', 'email', 'scope', 'scp', 'may_act'])",message="actorClaim must name a readable claim; use client_id or a non-reserved claim such as azp, appid, or cid"
//
//nolint:lll // CEL validation rules exceed line length limits.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ var _ = Describe("MCPExternalAuthConfig inbound grants CEL validation", func() {
}},
}}
}},
{name: "canonical token exchange wildcard delegate with omitted may_act", shouldAdmit: true, mutate: func(c *mcpv1beta1.EmbeddedAuthServerConfig) {
c.TrustedIssuers = []mcpv1beta1.TrustedIssuerConfig{{Name: "issuer", IssuerURL: "https://issuer.example.com"}}
c.InboundGrants = &mcpv1beta1.InboundGrantsConfig{TokenExchange: &mcpv1beta1.TokenExchangeInboundGrantConfig{
IssuerPolicies: []mcpv1beta1.TokenExchangeIssuerPolicyConfig{{
IssuerRef: "issuer", ExpectedAudience: "https://mcp.example.com", AllowedDelegateClients: []string{"*"},
}},
}}
}},
{name: "canonical JWT bearer", shouldAdmit: true, mutate: func(c *mcpv1beta1.EmbeddedAuthServerConfig) {
c.TrustedIssuers = []mcpv1beta1.TrustedIssuerConfig{{Name: "issuer", IssuerURL: "https://issuer.example.com"}}
c.InboundGrants = &mcpv1beta1.InboundGrantsConfig{JWTBearer: &mcpv1beta1.JWTBearerInboundGrantConfig{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,8 @@ spec:
size(self.allowedDelegateClients) == 1'
- message: allowMayAct must not be enabled when allowedDelegateClients
contains the wildcard "*"
rule: '!(self.allowMayAct && ''*'' in self.allowedDelegateClients)'
rule: '!(has(self.allowMayAct) && self.allowMayAct
&& ''*'' in self.allowedDelegateClients)'
- message: actorClaim must name a readable claim; use
client_id or a non-reserved claim such as azp, appid,
or cid
Expand Down Expand Up @@ -3463,7 +3464,8 @@ spec:
size(self.allowedDelegateClients) == 1'
- message: allowMayAct must not be enabled when allowedDelegateClients
contains the wildcard "*"
rule: '!(self.allowMayAct && ''*'' in self.allowedDelegateClients)'
rule: '!(has(self.allowMayAct) && self.allowMayAct
&& ''*'' in self.allowedDelegateClients)'
- message: actorClaim must name a readable claim; use
client_id or a non-reserved claim such as azp, appid,
or cid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,8 @@ spec:
size(self.allowedDelegateClients) == 1'
- message: allowMayAct must not be enabled when allowedDelegateClients
contains the wildcard "*"
rule: '!(self.allowMayAct && ''*'' in self.allowedDelegateClients)'
rule: '!(has(self.allowMayAct) && self.allowMayAct
&& ''*'' in self.allowedDelegateClients)'
- message: actorClaim must name a readable claim; use
client_id or a non-reserved claim such as azp, appid,
or cid
Expand Down Expand Up @@ -5501,7 +5502,8 @@ spec:
size(self.allowedDelegateClients) == 1'
- message: allowMayAct must not be enabled when allowedDelegateClients
contains the wildcard "*"
rule: '!(self.allowMayAct && ''*'' in self.allowedDelegateClients)'
rule: '!(has(self.allowMayAct) && self.allowMayAct
&& ''*'' in self.allowedDelegateClients)'
- message: actorClaim must name a readable claim; use
client_id or a non-reserved claim such as azp, appid,
or cid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,8 @@ spec:
size(self.allowedDelegateClients) == 1'
- message: allowMayAct must not be enabled when allowedDelegateClients
contains the wildcard "*"
rule: '!(self.allowMayAct && ''*'' in self.allowedDelegateClients)'
rule: '!(has(self.allowMayAct) && self.allowMayAct
&& ''*'' in self.allowedDelegateClients)'
- message: actorClaim must name a readable claim; use
client_id or a non-reserved claim such as azp, appid,
or cid
Expand Down Expand Up @@ -3466,7 +3467,8 @@ spec:
size(self.allowedDelegateClients) == 1'
- message: allowMayAct must not be enabled when allowedDelegateClients
contains the wildcard "*"
rule: '!(self.allowMayAct && ''*'' in self.allowedDelegateClients)'
rule: '!(has(self.allowMayAct) && self.allowMayAct
&& ''*'' in self.allowedDelegateClients)'
- message: actorClaim must name a readable claim; use
client_id or a non-reserved claim such as azp, appid,
or cid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,8 @@ spec:
size(self.allowedDelegateClients) == 1'
- message: allowMayAct must not be enabled when allowedDelegateClients
contains the wildcard "*"
rule: '!(self.allowMayAct && ''*'' in self.allowedDelegateClients)'
rule: '!(has(self.allowMayAct) && self.allowMayAct
&& ''*'' in self.allowedDelegateClients)'
- message: actorClaim must name a readable claim; use
client_id or a non-reserved claim such as azp, appid,
or cid
Expand Down Expand Up @@ -5504,7 +5505,8 @@ spec:
size(self.allowedDelegateClients) == 1'
- message: allowMayAct must not be enabled when allowedDelegateClients
contains the wildcard "*"
rule: '!(self.allowMayAct && ''*'' in self.allowedDelegateClients)'
rule: '!(has(self.allowMayAct) && self.allowMayAct
&& ''*'' in self.allowedDelegateClients)'
- message: actorClaim must name a readable claim; use
client_id or a non-reserved claim such as azp, appid,
or cid
Expand Down
Loading