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 (aws#18544)

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

closes aws#18410


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
leestkly authored and LukvonStrom committed Jan 26, 2022
1 parent e7e182a commit b3bc3be
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 b3bc3be

Please sign in to comment.