Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(aws-events): restrict eventbus statementId to 64 characters #22296

Merged
merged 8 commits into from Oct 29, 2022
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-events/lib/rule.ts
Expand Up @@ -370,7 +370,7 @@ export class Rule extends Resource implements IRule {
});
new CfnEventBusPolicy(eventBusPolicyStack, 'GivePermToOtherAccount', {
action: 'events:PutEvents',
statementId: `Allow-account-${sourceAccount}-${this.node.addr}`,
statementId: `Allow-account-${sourceAccount}-${this.node.addr}`.substring(0, 64),
sennyeya marked this conversation as resolved.
Show resolved Hide resolved
principal: sourceAccount,
});
}
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-events/test/rule.test.ts
Expand Up @@ -933,7 +933,7 @@ describe('rule', () => {
const app = new cdk.App();

const sourceAccount = '123456789012';
const nodeAddr = 'c810f4680339b01edf1f157c4fd07da73469742773';
const trimmedNodeAddr = 'c810f4680339b01edf1f157c4fd07da734697';
const sourceStack = new cdk.Stack(app, 'SourceStack', {
env: {
account: sourceAccount,
Expand Down Expand Up @@ -1015,7 +1015,7 @@ describe('rule', () => {
const eventBusPolicyStack = app.node.findChild(`EventBusPolicy-${sourceAccount}-us-west-2-${targetAccount}`) as cdk.Stack;
Template.fromStack(eventBusPolicyStack).hasResourceProperties('AWS::Events::EventBusPolicy', {
'Action': 'events:PutEvents',
'StatementId': `Allow-account-${sourceAccount}-${nodeAddr}`,
'StatementId': `Allow-account-${sourceAccount}-${trimmedNodeAddr}`,
'Principal': sourceAccount,
});
});
Expand Down