Skip to content

Commit

Permalink
fix(apigatewayv2): websocket api: allow all methods in grant manage c…
Browse files Browse the repository at this point in the history
…onnections

Current code only grants POST method, but GET and DELETE
methods are also needed for full connection management.

closes #18410
  • Loading branch information
Lee Steakley committed Jan 19, 2022
1 parent c7f39ca commit c2b1221
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-apigatewayv2/lib/websocket/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export class WebSocketApi extends ApiBase implements IWebSocketApi {
return Grant.addToPrincipal({
grantee: identity,
actions: ['execute-api:ManageConnections'],
resourceArns: [`${arn}/*/POST/@connections/*`],
resourceArns: [`${arn}/*/*/@connections/*`],
});
}
}
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-apigatewayv2/lib/websocket/stage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export class WebSocketStage extends StageBase implements IWebSocketStage {
return Grant.addToPrincipal({
grantee: identity,
actions: ['execute-api:ManageConnections'],
resourceArns: [`${arn}/${this.stageName}/POST/@connections/*`],
resourceArns: [`${arn}/${this.stageName}/*/@connections/*`],
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ describe('WebSocketApi', () => {
{
Ref: 'apiC8550315',
},
'/*/POST/@connections/*',
'/*/*/@connections/*',
]],
},
}]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ describe('WebSocketStage', () => {
{
Ref: 'ApiF70053CD',
},
`/${defaultStage.stageName}/POST/@connections/*`,
`/${defaultStage.stageName}/*/@connections/*`,
]],
},
}]),
Expand Down

0 comments on commit c2b1221

Please sign in to comment.