Skip to content

Commit 41c8a3f

Browse files
authored
fix(apigatewayv2): websocket api: allow all methods in grant manage connections (#18544)
Current code only grants POST method, but GET and DELETE methods are also needed for full connection management. closes #18410 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 66f8bb0 commit 41c8a3f

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

packages/@aws-cdk/aws-apigatewayv2/lib/websocket/api.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ export class WebSocketApi extends ApiBase implements IWebSocketApi {
150150
return Grant.addToPrincipal({
151151
grantee: identity,
152152
actions: ['execute-api:ManageConnections'],
153-
resourceArns: [`${arn}/*/POST/@connections/*`],
153+
resourceArns: [`${arn}/*/*/@connections/*`],
154154
});
155155
}
156156
}

packages/@aws-cdk/aws-apigatewayv2/lib/websocket/stage.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export class WebSocketStage extends StageBase implements IWebSocketStage {
131131
return Grant.addToPrincipal({
132132
grantee: identity,
133133
actions: ['execute-api:ManageConnections'],
134-
resourceArns: [`${arn}/${this.stageName}/POST/@connections/*`],
134+
resourceArns: [`${arn}/${this.stageName}/*/@connections/*`],
135135
});
136136
}
137137
}

packages/@aws-cdk/aws-apigatewayv2/test/websocket/api.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ describe('WebSocketApi', () => {
141141
{
142142
Ref: 'apiC8550315',
143143
},
144-
'/*/POST/@connections/*',
144+
'/*/*/@connections/*',
145145
]],
146146
},
147147
}]),

packages/@aws-cdk/aws-apigatewayv2/test/websocket/stage.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ describe('WebSocketStage', () => {
9999
{
100100
Ref: 'ApiF70053CD',
101101
},
102-
`/${defaultStage.stageName}/POST/@connections/*`,
102+
`/${defaultStage.stageName}/*/@connections/*`,
103103
]],
104104
},
105105
}]),

0 commit comments

Comments
 (0)