Skip to content

Commit 24fd0ac

Browse files
committed
update
Signed-off-by: Huabing Zhao <[email protected]>
1 parent 1964232 commit 24fd0ac

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

api/v1alpha1/mcp_route.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,10 @@ type MCPAuthorizationTarget struct {
280280
type MCPAuthorizationSource struct {
281281
// JWTSource defines the JWT scopes required for this rule to match.
282282
//
283-
// +kubebuilder:validation:Optional
284-
JWTSource *JWTSource `json:"jwtSource,omitempty"`
283+
// +kubebuilder:validation:Required
284+
JWTSource JWTSource `json:"jwtSource"`
285+
286+
// TODO: JWTSource can be optional in the future when we support more source types.
285287
}
286288

287289
type JWTSource struct {

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 1 addition & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/mcpproxy/authorization.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,8 @@ func (m *MCPProxy) authorizeRequest(authorization *filterapi.MCPRouteAuthorizati
3434
}
3535

3636
claims := jwt.MapClaims{}
37-
parser := jwt.NewParser(jwt.WithoutClaimsValidation())
3837
// JWT verification is performed by Envoy before reaching here. So we only need to parse the token without verification.
39-
// codeql[go/missing-jwt-signature-check]
40-
if _, _, err := parser.ParseUnverified(token, claims); err != nil {
38+
if _, _, err := jwt.NewParser().ParseUnverified(token, claims); err != nil {
4139
m.l.Info("failed to parse JWT token", slog.String("error", err.Error()))
4240
return false
4341
}

manifests/charts/ai-gateway-crds-helm/templates/aigateway.envoyproxy.io_mcproutes.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,8 @@ spec:
632632
required:
633633
- scopes
634634
type: object
635+
required:
636+
- jwtSource
635637
type: object
636638
target:
637639
description: Target defines the authorization target

0 commit comments

Comments
 (0)