-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.ts
63 lines (58 loc) · 2.14 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import * as aws from "@pulumi/aws";
// https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-reference-policy-checks.html#access-analyzer-reference-policy-checks-security-warning-pass-role-with-star-in-resource
const overlyPermissivePolicy = new aws.iam.Policy("overly-permissive-policy", {
policy: {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": ["iam:GetRole", "iam:PassRole"],
"Resource": "*",
}
]
}
});
// https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-reference-policy-checks.html#access-analyzer-reference-policy-checks-general-warning-invalid-date-value
const invalidDatePolicy = new aws.iam.Policy("invalid-date-policy", {
policy: {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "s3:*",
"Resource": "*",
"Condition": {
"DateGreaterThan": { "aws:CurrentTime": "2021" },
"DateLessThan": { "aws:CurrentTime": "2022-12-31" }
}
}
]
}
});
// https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-reference-policy-checks.html#access-analyzer-reference-policy-checks-error-invalid-service-in-action
const invalidActionPolicy = new aws.iam.Policy("invalid-action-policy", {
policy: {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "DOES_NOT_EXIST:*",
"Resource": "*"
}
]
}
});
// https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-reference-policy-checks.html#access-analyzer-reference-policy-checks-suggestion-empty-array-action
// But is a "SUGGESTION" so will not report a violation.
const emptyArrayPolicy = new aws.iam.Policy("empty-array-action-policy", {
policy: {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [],
"Resource": "*"
}
]
}
});