@medplum/cdk 2.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +83 -0
- package/babel.config.json +3 -0
- package/cdk.json +3 -0
- package/dist/cjs/index.cjs +767 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/cjs/init.cjs +443 -0
- package/dist/cjs/init.cjs.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/jest.config.json +14 -0
- package/package.json +33 -0
- package/rollup.config.mjs +56 -0
- package/src/__mocks__/@aws-sdk/client-acm.ts +45 -0
- package/src/__mocks__/@aws-sdk/client-ssm.ts +13 -0
- package/src/__mocks__/@aws-sdk/client-sts.ts +18 -0
- package/src/backend.ts +416 -0
- package/src/config.ts +31 -0
- package/src/frontend.ts +168 -0
- package/src/index.test.ts +232 -0
- package/src/index.ts +68 -0
- package/src/init.test.ts +378 -0
- package/src/init.ts +505 -0
- package/src/storage.ts +134 -0
- package/src/waf.ts +122 -0
- package/tsconfig.json +8 -0
package/src/waf.ts
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// Based on https://gist.github.com/statik/f1ac9d6227d98d30c7a7cec0c83f4e64
|
|
2
|
+
|
|
3
|
+
import { aws_wafv2 as wafv2 } from 'aws-cdk-lib';
|
|
4
|
+
|
|
5
|
+
export const awsManagedRules: wafv2.CfnWebACL.RuleProperty[] = [
|
|
6
|
+
// Common Rule Set aligns with major portions of OWASP Core Rule Set
|
|
7
|
+
// https://docs.aws.amazon.com/waf/latest/developerguide/aws-managed-rule-groups-baseline.html
|
|
8
|
+
{
|
|
9
|
+
name: 'AWS-AWSManagedRulesCommonRuleSet',
|
|
10
|
+
priority: 10,
|
|
11
|
+
statement: {
|
|
12
|
+
managedRuleGroupStatement: {
|
|
13
|
+
vendorName: 'AWS',
|
|
14
|
+
name: 'AWSManagedRulesCommonRuleSet',
|
|
15
|
+
// Excluding generic RFI body rule for sns notifications
|
|
16
|
+
// https://docs.aws.amazon.com/waf/latest/developerguide/aws-managed-rule-groups-list.html
|
|
17
|
+
excludedRules: [
|
|
18
|
+
{ name: 'NoUserAgent_HEADER' },
|
|
19
|
+
{ name: 'UserAgent_BadBots_HEADER' },
|
|
20
|
+
{ name: 'SizeRestrictions_QUERYSTRING' },
|
|
21
|
+
{ name: 'SizeRestrictions_Cookie_HEADER' },
|
|
22
|
+
{ name: 'SizeRestrictions_BODY' },
|
|
23
|
+
{ name: 'SizeRestrictions_URIPATH' },
|
|
24
|
+
{ name: 'EC2MetaDataSSRF_BODY' },
|
|
25
|
+
{ name: 'EC2MetaDataSSRF_COOKIE' },
|
|
26
|
+
{ name: 'EC2MetaDataSSRF_URIPATH' },
|
|
27
|
+
{ name: 'EC2MetaDataSSRF_QUERYARGUMENTS' },
|
|
28
|
+
{ name: 'GenericLFI_QUERYARGUMENTS' },
|
|
29
|
+
{ name: 'GenericLFI_URIPATH' },
|
|
30
|
+
{ name: 'GenericLFI_BODY' },
|
|
31
|
+
{ name: 'RestrictedExtensions_URIPATH' },
|
|
32
|
+
{ name: 'RestrictedExtensions_QUERYARGUMENTS' },
|
|
33
|
+
{ name: 'GenericRFI_QUERYARGUMENTS' },
|
|
34
|
+
{ name: 'GenericRFI_BODY' },
|
|
35
|
+
{ name: 'GenericRFI_URIPATH' },
|
|
36
|
+
{ name: 'CrossSiteScripting_COOKIE' },
|
|
37
|
+
{ name: 'CrossSiteScripting_QUERYARGUMENTS' },
|
|
38
|
+
{ name: 'CrossSiteScripting_BODY' },
|
|
39
|
+
{ name: 'CrossSiteScripting_URIPATH' },
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
overrideAction: {
|
|
44
|
+
count: {},
|
|
45
|
+
},
|
|
46
|
+
visibilityConfig: {
|
|
47
|
+
sampledRequestsEnabled: true,
|
|
48
|
+
cloudWatchMetricsEnabled: true,
|
|
49
|
+
metricName: 'AWS-AWSManagedRulesCommonRuleSet',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
// AWS IP Reputation list includes known malicious actors/bots and is regularly updated
|
|
53
|
+
// https://docs.aws.amazon.com/waf/latest/developerguide/aws-managed-rule-groups-ip-rep.html
|
|
54
|
+
{
|
|
55
|
+
name: 'AWS-AWSManagedRulesAmazonIpReputationList',
|
|
56
|
+
priority: 20,
|
|
57
|
+
statement: {
|
|
58
|
+
managedRuleGroupStatement: {
|
|
59
|
+
vendorName: 'AWS',
|
|
60
|
+
name: 'AWSManagedRulesAmazonIpReputationList',
|
|
61
|
+
excludedRules: [{ name: 'AWSManagedIPReputationList' }, { name: 'AWSManagedReconnaissanceList' }],
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
overrideAction: {
|
|
65
|
+
count: {},
|
|
66
|
+
},
|
|
67
|
+
visibilityConfig: {
|
|
68
|
+
sampledRequestsEnabled: true,
|
|
69
|
+
cloudWatchMetricsEnabled: true,
|
|
70
|
+
metricName: 'AWSManagedRulesAmazonIpReputationList',
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
// Blocks common SQL Injection
|
|
74
|
+
// https://docs.aws.amazon.com/waf/latest/developerguide/aws-managed-rule-groups-use-case.html#aws-managed-rule-groups-use-case-sql-db
|
|
75
|
+
{
|
|
76
|
+
name: 'AWSManagedRulesSQLiRuleSet',
|
|
77
|
+
priority: 30,
|
|
78
|
+
visibilityConfig: {
|
|
79
|
+
sampledRequestsEnabled: true,
|
|
80
|
+
cloudWatchMetricsEnabled: true,
|
|
81
|
+
metricName: 'AWSManagedRulesSQLiRuleSet',
|
|
82
|
+
},
|
|
83
|
+
overrideAction: {
|
|
84
|
+
count: {},
|
|
85
|
+
},
|
|
86
|
+
statement: {
|
|
87
|
+
managedRuleGroupStatement: {
|
|
88
|
+
vendorName: 'AWS',
|
|
89
|
+
name: 'AWSManagedRulesSQLiRuleSet',
|
|
90
|
+
excludedRules: [
|
|
91
|
+
{ name: 'SQLi_QUERYARGUMENTS' },
|
|
92
|
+
{ name: 'SQLiExtendedPatterns_QUERYARGUMENTS' },
|
|
93
|
+
{ name: 'SQLi_BODY' },
|
|
94
|
+
{ name: 'SQLiExtendedPatterns_BODY' },
|
|
95
|
+
{ name: 'SQLi_COOKIE' },
|
|
96
|
+
{ name: 'SQLi_URIPATH' },
|
|
97
|
+
],
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
// Blocks attacks targeting LFI(Local File Injection) for linux systems
|
|
102
|
+
// https://docs.aws.amazon.com/waf/latest/developerguide/aws-managed-rule-groups-use-case.html#aws-managed-rule-groups-use-case-linux-os
|
|
103
|
+
{
|
|
104
|
+
name: 'AWSManagedRuleLinux',
|
|
105
|
+
priority: 40,
|
|
106
|
+
visibilityConfig: {
|
|
107
|
+
sampledRequestsEnabled: true,
|
|
108
|
+
cloudWatchMetricsEnabled: true,
|
|
109
|
+
metricName: 'AWSManagedRuleLinux',
|
|
110
|
+
},
|
|
111
|
+
overrideAction: {
|
|
112
|
+
count: {},
|
|
113
|
+
},
|
|
114
|
+
statement: {
|
|
115
|
+
managedRuleGroupStatement: {
|
|
116
|
+
vendorName: 'AWS',
|
|
117
|
+
name: 'AWSManagedRulesLinuxRuleSet',
|
|
118
|
+
excludedRules: [{ name: 'LFI_URIPATH' }, { name: 'LFI_QUERYSTRING' }, { name: 'LFI_COOKIE' }],
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
];
|