Skip to content

Commit d5ffd23

Browse files
fix: #114 More secure IoT policy
1 parent eb2ac26 commit d5ffd23

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

src/infraDeploy.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,15 @@ const policyDocument = {
3737
Version: '2012-10-17',
3838
Statement: [
3939
{
40-
Action: 'iot:*',
41-
Resource: '*',
4240
Effect: 'Allow',
41+
Action: [
42+
'iot:DescribeEndpoint',
43+
'iot:Connect',
44+
'iot:Publish',
45+
'iot:Subscribe',
46+
'iot:Receive',
47+
],
48+
Resource: '*',
4349
},
4450
],
4551
};

test/utils/expectInfraDeployed.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,20 @@ export async function expectInfraDeployed(lambdaName: any) {
3030
':layer:LambdaLiveDebugger:',
3131
);
3232
expect(policyDocument).toEqual({
33+
Version: '2012-10-17',
3334
Statement: [
3435
{
35-
Action: 'iot:*',
3636
Effect: 'Allow',
37+
Action: [
38+
'iot:DescribeEndpoint',
39+
'iot:Connect',
40+
'iot:Publish',
41+
'iot:Subscribe',
42+
'iot:Receive',
43+
],
3744
Resource: '*',
3845
},
3946
],
40-
Version: '2012-10-17',
4147
});
4248
}
4349
}

0 commit comments

Comments
 (0)