@kensio/yulin 1.21.23 → 1.21.24
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/dist/service/wafv2/association/sim-aws-waf-protected-resources.js +4 -0
- package/dist/service/wafv2/association/sim-waf-associations.d.ts +6 -0
- package/dist/service/wafv2/association/sim-waf-associations.js +17 -0
- package/dist/service/wafv2/association/sim-waf-protected-resource.d.ts +13 -8
- package/dist/service/wafv2/association/sim-waf-protected-resource.js +23 -23
- package/dist/service/wafv2/association/sim-waf-protected-resources.d.ts +11 -6
- package/dist/service/wafv2/association/sim-waf-protected-resources.js +10 -7
- package/dist/service/wafv2/association/sim-waf-unsimulated-resource.d.ts +33 -0
- package/dist/service/wafv2/association/sim-waf-unsimulated-resource.js +66 -0
- package/dist/service/wafv2/cfn/association/sim-cfn-waf-association-creator.js +5 -0
- package/dist/service/wafv2/cfn/ip-set/sim-cfn-waf-ip-set-config.js +1 -0
- package/dist/service/wafv2/cfn/ip-set/sim-cfn-waf-ip-set-creator.js +2 -0
- package/dist/service/wafv2/cfn/regex-pattern-set/sim-cfn-waf-regex-set-config.js +1 -0
- package/dist/service/wafv2/cfn/regex-pattern-set/sim-cfn-waf-regex-set-creator.js +2 -0
- package/dist/service/wafv2/cfn/sim-cfn-waf-resource-config.d.ts +4 -0
- package/dist/service/wafv2/cfn/sim-cfn-waf-resource-config.js +10 -0
- package/dist/service/wafv2/cfn/sim-cfn-waf-unsimulated.d.ts +10 -0
- package/dist/service/wafv2/cfn/sim-cfn-waf-unsimulated.js +12 -0
- package/dist/service/wafv2/cfn/web-acl/sim-cfn-waf-web-acl-config.d.ts +1 -13
- package/dist/service/wafv2/cfn/web-acl/sim-cfn-waf-web-acl-config.js +8 -21
- package/dist/service/wafv2/cfn/web-acl/sim-cfn-waf-web-acl-creator.d.ts +4 -9
- package/dist/service/wafv2/cfn/web-acl/sim-cfn-waf-web-acl-creator.js +7 -15
- package/dist/service/wafv2/command/association/sim-wafv2-association-commands.js +2 -1
- package/dist/service/wafv2/command/association/sim-wafv2-association-input.d.ts +10 -2
- package/dist/service/wafv2/command/association/sim-wafv2-association-input.js +25 -13
- package/dist/service/wafv2/command/ip-set/sim-wafv2-ip-set-commands.d.ts +3 -3
- package/dist/service/wafv2/command/ip-set/sim-wafv2-ip-set-commands.js +5 -5
- package/dist/service/wafv2/command/managed-rule-group/sim-wafv2-managed-rule-group-commands.js +4 -4
- package/dist/service/wafv2/command/regex-pattern-set/sim-wafv2-regex-pattern-set-commands.js +2 -2
- package/dist/service/wafv2/command/sim-wafv2-input.d.ts +0 -7
- package/dist/service/wafv2/command/sim-wafv2-input.js +1 -13
- package/dist/service/wafv2/command/web-acl/sim-waf-web-acl-output.js +1 -0
- package/dist/service/wafv2/command/web-acl/sim-wafv2-unsimulated-web-acl-input.d.ts +9 -12
- package/dist/service/wafv2/command/web-acl/sim-wafv2-unsimulated-web-acl-input.js +27 -28
- package/dist/service/wafv2/command/web-acl/sim-wafv2-web-acl-commands.d.ts +3 -3
- package/dist/service/wafv2/command/web-acl/sim-wafv2-web-acl-commands.js +6 -6
- package/dist/service/wafv2/command/web-acl/web-acl.command.d.ts +6 -0
- package/dist/service/wafv2/index.d.ts +3 -0
- package/dist/service/wafv2/index.js +1 -0
- package/dist/service/wafv2/managed/group/sim-waf-bot-control.d.ts +27 -0
- package/dist/service/wafv2/managed/group/sim-waf-bot-control.js +68 -0
- package/dist/service/wafv2/managed/group/sim-waf-ip-reputation.d.ts +18 -0
- package/dist/service/wafv2/managed/group/sim-waf-ip-reputation.js +51 -0
- package/dist/service/wafv2/managed/sim-waf-bot-declaration.d.ts +35 -0
- package/dist/service/wafv2/managed/sim-waf-bot-declaration.js +42 -0
- package/dist/service/wafv2/managed/sim-waf-managed-declaration.d.ts +35 -0
- package/dist/service/wafv2/managed/sim-waf-managed-declaration.js +30 -0
- package/dist/service/wafv2/managed/sim-waf-managed-group-configs.d.ts +11 -0
- package/dist/service/wafv2/managed/sim-waf-managed-group-configs.js +42 -0
- package/dist/service/wafv2/managed/sim-waf-managed-group-input.d.ts +5 -4
- package/dist/service/wafv2/managed/sim-waf-managed-group-input.js +7 -9
- package/dist/service/wafv2/managed/sim-waf-managed-group-statement.js +16 -14
- package/dist/service/wafv2/managed/sim-waf-managed-group.type.d.ts +2 -2
- package/dist/service/wafv2/managed/sim-waf-managed-rule-actions.d.ts +30 -0
- package/dist/service/wafv2/managed/sim-waf-managed-rule-actions.js +26 -0
- package/dist/service/wafv2/managed/sim-waf-managed-rule-groups.d.ts +5 -3
- package/dist/service/wafv2/managed/sim-waf-managed-rule-groups.js +10 -3
- package/dist/service/wafv2/managed/sim-waf-managed-rule.type.d.ts +11 -2
- package/dist/service/wafv2/managed/sim-waf-managed-rules.d.ts +14 -9
- package/dist/service/wafv2/managed/sim-waf-managed-rules.js +15 -5
- package/dist/service/wafv2/resource/sim-waf-resource.d.ts +10 -0
- package/dist/service/wafv2/resource/sim-waf-resource.js +12 -0
- package/dist/service/wafv2/resource/sim-waf-unsimulated-part.d.ts +24 -0
- package/dist/service/wafv2/resource/sim-waf-unsimulated-part.js +8 -0
- package/dist/service/wafv2/sim-wafv2.d.ts +12 -12
- package/dist/service/wafv2/sim-wafv2.fixture.d.ts +19 -1
- package/dist/service/wafv2/sim-wafv2.fixture.js +29 -0
- package/dist/service/wafv2/sim-wafv2.js +25 -23
- package/dist/service/wafv2/statement/sim-waf-field-to-match.type.d.ts +2 -2
- package/dist/service/wafv2/statement/sim-waf-rule-refusals.d.ts +6 -4
- package/dist/service/wafv2/statement/sim-waf-rule-refusals.js +7 -6
- package/dist/service/wafv2/statement/sim-waf-statement.d.ts +3 -3
- package/dist/service/wafv2/statement/sim-waf-statement.js +3 -3
- package/dist/service/wafv2/statement/sim-waf-statement.type.d.ts +3 -3
- package/dist/service/wafv2/statement/sim-waf-unsimulated-statement.js +1 -1
- package/dist/service/wafv2/web-acl/sim-waf-association-config.d.ts +14 -7
- package/dist/service/wafv2/web-acl/sim-waf-association-config.js +17 -27
- package/dist/service/wafv2/web-acl/sim-waf-rule.d.ts +15 -3
- package/dist/service/wafv2/web-acl/sim-waf-rule.js +46 -10
- package/dist/service/wafv2/web-acl/sim-waf-statement-capacity.d.ts +4 -4
- package/dist/service/wafv2/web-acl/sim-waf-statement-capacity.js +4 -4
- package/dist/service/wafv2/web-acl/sim-waf-unsimulated-body-limit.d.ts +6 -0
- package/dist/service/wafv2/web-acl/sim-waf-unsimulated-body-limit.js +23 -0
- package/dist/service/wafv2/web-acl/sim-waf-web-acl-capacity.js +2 -2
- package/dist/service/wafv2/web-acl/sim-waf-web-acl-configuration.d.ts +5 -0
- package/dist/service/wafv2/web-acl/sim-waf-web-acl.d.ts +11 -2
- package/dist/service/wafv2/web-acl/sim-waf-web-acl.js +20 -1
- package/docs/services/wafv2/README.md +243 -51
- package/package.json +2 -2
- package/dist/service/wafv2/cfn/web-acl/sim-cfn-waf-evaluatable-rules.d.ts +0 -15
- package/dist/service/wafv2/cfn/web-acl/sim-cfn-waf-evaluatable-rules.js +0 -21
- package/dist/service/wafv2/web-acl/sim-waf-unevaluatable-rules.d.ts +0 -25
- package/dist/service/wafv2/web-acl/sim-waf-unevaluatable-rules.js +0 -33
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { requiredSimWafArn } from "../sim-wafv2-input.js";
|
|
2
2
|
import { simWafWebAclOutput } from "../web-acl/sim-waf-web-acl-output.js";
|
|
3
|
-
import { simWafListedResourceType } from "./sim-wafv2-association-input.js";
|
|
3
|
+
import { refuseSimWafAccountTakeoverForUserPool, simWafListedResourceType, } from "./sim-wafv2-association-input.js";
|
|
4
4
|
/**
|
|
5
5
|
* The commands that put a web ACL in front of a resource and take it away
|
|
6
6
|
* again.
|
|
@@ -27,6 +27,7 @@ export class SimWafAssociationCommands {
|
|
|
27
27
|
this.#access.authorizeWebAcl("wafv2:AssociateWebACL", webAclArn, options?.caller);
|
|
28
28
|
const webAcl = this.#access.webAcl(webAclArn);
|
|
29
29
|
this.#access.requireResource(resource);
|
|
30
|
+
refuseSimWafAccountTakeoverForUserPool(resource, webAcl);
|
|
30
31
|
this.#associations.associate(resource, webAcl);
|
|
31
32
|
return { $metadata: {} };
|
|
32
33
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { SimAwsAccountRegionScope } from "../../../aws/sim-aws-account-region-scope.js";
|
|
2
2
|
import { type SimWafProtectedResource, type SimWafProtectedResourceType } from "../../association/sim-waf-protected-resource.js";
|
|
3
|
+
import type { SimWafWebAcl } from "../../web-acl/sim-waf-web-acl.js";
|
|
3
4
|
/**
|
|
4
5
|
* Read the resource an association named, and hold it to one Account and
|
|
5
6
|
* Region.
|
|
@@ -11,7 +12,14 @@ import { type SimWafProtectedResource, type SimWafProtectedResourceType } from "
|
|
|
11
12
|
*/
|
|
12
13
|
export declare function simWafAssociationResource(resourceArn: string | undefined, accountRegionScope: SimAwsAccountRegionScope): SimWafProtectedResource;
|
|
13
14
|
/**
|
|
14
|
-
* Read the resource type a listing named, refusing one
|
|
15
|
-
* not hold.
|
|
15
|
+
* Read the resource type a listing named, refusing one WAFv2 does not list.
|
|
16
16
|
*/
|
|
17
17
|
export declare function simWafListedResourceType(resourceType: string | undefined): SimWafProtectedResourceType;
|
|
18
|
+
/**
|
|
19
|
+
* Refuse a web ACL carrying the account takeover group in front of a user
|
|
20
|
+
* pool, as AWS does.
|
|
21
|
+
*
|
|
22
|
+
* AWS refuses the whole association over the one rule group. Yulin holds the
|
|
23
|
+
* group without evaluating it, and this is where the refusal lands.
|
|
24
|
+
*/
|
|
25
|
+
export declare function refuseSimWafAccountTakeoverForUserPool(resource: SimWafProtectedResource, webAcl: SimWafWebAcl): void;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { simWafProtectedResource, simWafProtectedResourceTypes, } from "../../association/sim-waf-protected-resource.js";
|
|
2
|
-
import { SimWafInvalidParameterException
|
|
2
|
+
import { SimWafInvalidParameterException } from "../../error/sim-wafv2.error.js";
|
|
3
3
|
import { requiredSimWafArn } from "../sim-wafv2-input.js";
|
|
4
4
|
/**
|
|
5
|
-
* What ListResourcesForWebACL lists when the request names no resource type
|
|
6
|
-
*
|
|
7
|
-
* Real WAFv2 documents that default, and it is not one of the types simulated
|
|
8
|
-
* here. A listing that names nothing is refused, because the empty list a load
|
|
9
|
-
* balancer listing produces reads as a web ACL protecting nothing.
|
|
5
|
+
* What ListResourcesForWebACL lists when the request names no resource type,
|
|
6
|
+
* as real WAFv2 documents it.
|
|
10
7
|
*/
|
|
11
8
|
const defaultResourceType = "APPLICATION_LOAD_BALANCER";
|
|
12
9
|
/**
|
|
@@ -32,21 +29,36 @@ export function simWafAssociationResource(resourceArn, accountRegionScope) {
|
|
|
32
29
|
return resource;
|
|
33
30
|
}
|
|
34
31
|
/**
|
|
35
|
-
* Read the resource type a listing named, refusing one
|
|
36
|
-
* not hold.
|
|
32
|
+
* Read the resource type a listing named, refusing one WAFv2 does not list.
|
|
37
33
|
*/
|
|
38
34
|
export function simWafListedResourceType(resourceType) {
|
|
39
35
|
const listed = resourceType ?? defaultResourceType;
|
|
40
36
|
const simulated = simWafProtectedResourceTypes.find((candidate) => candidate === listed);
|
|
41
37
|
if (simulated === undefined) {
|
|
42
|
-
throw new
|
|
43
|
-
`${simWafProtectedResourceTypes.join("
|
|
44
|
-
`
|
|
45
|
-
`a request names no ResourceType, so name one of the simulated types ` +
|
|
46
|
-
`to list the resources a web ACL protects.`);
|
|
38
|
+
throw new SimWafInvalidParameterException(`Error reason: ListResourcesForWebACL lists one of ` +
|
|
39
|
+
`${simWafProtectedResourceTypes.join(", ")}, field: RESOURCE_TYPE, ` +
|
|
40
|
+
`parameter: ${listed}`);
|
|
47
41
|
}
|
|
48
42
|
return simulated;
|
|
49
43
|
}
|
|
44
|
+
const accountTakeoverGroup = "AWSManagedRulesATPRuleSet";
|
|
45
|
+
/**
|
|
46
|
+
* Refuse a web ACL carrying the account takeover group in front of a user
|
|
47
|
+
* pool, as AWS does.
|
|
48
|
+
*
|
|
49
|
+
* AWS refuses the whole association over the one rule group. Yulin holds the
|
|
50
|
+
* group without evaluating it, and this is where the refusal lands.
|
|
51
|
+
*/
|
|
52
|
+
export function refuseSimWafAccountTakeoverForUserPool(resource, webAcl) {
|
|
53
|
+
if (resource.resourceType !== "COGNITO_USER_POOL") {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const carriesGroup = (webAcl.configuration.rules ?? []).some((rule) => rule.Statement?.ManagedRuleGroupStatement?.Name === accountTakeoverGroup);
|
|
57
|
+
if (carriesGroup) {
|
|
58
|
+
throw refusedResourceArn(`A web ACL carrying ${accountTakeoverGroup} cannot protect a Cognito ` +
|
|
59
|
+
`user pool`, resource.arn);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
50
62
|
/**
|
|
51
63
|
* The refusal a bad resource ARN reports, in the form WAFv2 writes.
|
|
52
64
|
*/
|
|
@@ -12,9 +12,9 @@ interface SimWafIpSetCommandsProperties {
|
|
|
12
12
|
/**
|
|
13
13
|
* The commands that make, read, list and remove IP sets.
|
|
14
14
|
*
|
|
15
|
-
* The addresses are held and reported and nothing evaluates them
|
|
16
|
-
* `IPSetReferenceStatement` is
|
|
17
|
-
* from 127.0.0.1.
|
|
15
|
+
* The addresses are held and reported and nothing evaluates them. A rule
|
|
16
|
+
* naming one with `IPSetReferenceStatement` is held unevaluated, because every
|
|
17
|
+
* request in this simulation comes from 127.0.0.1.
|
|
18
18
|
*/
|
|
19
19
|
export declare class SimWafIpSetCommands {
|
|
20
20
|
#private;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { SimWafIpSet, requiredSimWafIpAddressVersion, } from "../../ip-set/sim-waf-ip-set.js";
|
|
2
2
|
import { requiredSimWafScope } from "../../scope/sim-waf-scope.js";
|
|
3
3
|
import { SimWafPage } from "../sim-wafv2-page.js";
|
|
4
|
-
import { checkedSimWafDescription,
|
|
4
|
+
import { checkedSimWafDescription, requiredSimWafName, } from "../sim-wafv2-input.js";
|
|
5
5
|
import { requireSimWafResource } from "../sim-wafv2-resource-lookup.js";
|
|
6
6
|
/**
|
|
7
7
|
* The commands that make, read, list and remove IP sets.
|
|
8
8
|
*
|
|
9
|
-
* The addresses are held and reported and nothing evaluates them
|
|
10
|
-
* `IPSetReferenceStatement` is
|
|
11
|
-
* from 127.0.0.1.
|
|
9
|
+
* The addresses are held and reported and nothing evaluates them. A rule
|
|
10
|
+
* naming one with `IPSetReferenceStatement` is held unevaluated, because every
|
|
11
|
+
* request in this simulation comes from 127.0.0.1.
|
|
12
12
|
*/
|
|
13
13
|
export class SimWafIpSetCommands {
|
|
14
14
|
#ipSets;
|
|
@@ -24,12 +24,12 @@ export class SimWafIpSetCommands {
|
|
|
24
24
|
*/
|
|
25
25
|
createIpSet(command, options) {
|
|
26
26
|
const { input } = command;
|
|
27
|
-
refuseSimWafTags(input.Tags, "CreateIPSet");
|
|
28
27
|
const ipSet = new SimWafIpSet({
|
|
29
28
|
name: requiredSimWafName(input.Name),
|
|
30
29
|
scope: requiredSimWafScope(input.Scope, this.#accountRegionScope.regionName),
|
|
31
30
|
accountRegionScope: this.#accountRegionScope,
|
|
32
31
|
description: checkedSimWafDescription(input.Description),
|
|
32
|
+
tags: input.Tags,
|
|
33
33
|
ipAddressVersion: requiredSimWafIpAddressVersion(input.IPAddressVersion),
|
|
34
34
|
addresses: input.Addresses ?? [],
|
|
35
35
|
});
|
package/dist/service/wafv2/command/managed-rule-group/sim-wafv2-managed-rule-group-commands.js
CHANGED
|
@@ -30,11 +30,11 @@ export class SimWafManagedRuleGroupCommands {
|
|
|
30
30
|
LabelNamespace: `${group.labelNamespace}:`,
|
|
31
31
|
Rules: group.rules.map((rule) => ({
|
|
32
32
|
Name: rule.name,
|
|
33
|
-
Action: { Block: {} },
|
|
34
|
-
})),
|
|
35
|
-
AvailableLabels: group.rules.map((rule) => ({
|
|
36
|
-
Name: `${group.labelNamespace}:${rule.label}`,
|
|
33
|
+
Action: rule.counts === true ? { Count: {} } : { Block: {} },
|
|
37
34
|
})),
|
|
35
|
+
AvailableLabels: group.rules
|
|
36
|
+
.flatMap((rule) => [rule.label, ...(rule.labels ?? [])])
|
|
37
|
+
.map((label) => ({ Name: `${group.labelNamespace}:${label}` })),
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
40
|
}
|
package/dist/service/wafv2/command/regex-pattern-set/sim-wafv2-regex-pattern-set-commands.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SimWafRegexPatternSet } from "../../regex-pattern-set/sim-waf-regex-pattern-set.js";
|
|
2
2
|
import { requiredSimWafScope } from "../../scope/sim-waf-scope.js";
|
|
3
3
|
import { SimWafPage } from "../sim-wafv2-page.js";
|
|
4
|
-
import { checkedSimWafDescription,
|
|
4
|
+
import { checkedSimWafDescription, requiredSimWafName, } from "../sim-wafv2-input.js";
|
|
5
5
|
import { requireSimWafResource } from "../sim-wafv2-resource-lookup.js";
|
|
6
6
|
/**
|
|
7
7
|
* The commands that make, read, list and remove regex pattern sets.
|
|
@@ -24,12 +24,12 @@ export class SimWafRegexPatternSetCommands {
|
|
|
24
24
|
*/
|
|
25
25
|
createRegexPatternSet(command, options) {
|
|
26
26
|
const { input } = command;
|
|
27
|
-
refuseSimWafTags(input.Tags, "CreateRegexPatternSet");
|
|
28
27
|
const patternSet = new SimWafRegexPatternSet({
|
|
29
28
|
name: requiredSimWafName(input.Name),
|
|
30
29
|
scope: requiredSimWafScope(input.Scope, this.#accountRegionScope.regionName),
|
|
31
30
|
accountRegionScope: this.#accountRegionScope,
|
|
32
31
|
description: checkedSimWafDescription(input.Description),
|
|
32
|
+
tags: input.Tags,
|
|
33
33
|
regularExpressions: input.RegularExpressionList ?? [],
|
|
34
34
|
});
|
|
35
35
|
this.#authorizer.authorizeResource("wafv2:CreateRegexPatternSet", patternSet.arn, options?.caller);
|
|
@@ -10,13 +10,6 @@ export declare function requiredSimWafName(name: string | undefined): string;
|
|
|
10
10
|
* read, and so does this.
|
|
11
11
|
*/
|
|
12
12
|
export declare function requiredSimWafId(id: string | undefined): string;
|
|
13
|
-
/**
|
|
14
|
-
* Refuse tags on a WAFv2 resource.
|
|
15
|
-
*
|
|
16
|
-
* Nothing here reads a tag, and a resource that reported tags it was never
|
|
17
|
-
* asked about would be worse than one that says it does not carry them.
|
|
18
|
-
*/
|
|
19
|
-
export declare function refuseSimWafTags(tags: readonly unknown[] | undefined, operation: string): void;
|
|
20
13
|
/**
|
|
21
14
|
* Read an ARN a request named, refusing a request with none.
|
|
22
15
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SimWafInvalidParameterException,
|
|
1
|
+
import { SimWafInvalidParameterException, SimWafValidationException, } from "../error/sim-wafv2.error.js";
|
|
2
2
|
/**
|
|
3
3
|
* Read the name a request named, refusing a request with none.
|
|
4
4
|
*/
|
|
@@ -22,18 +22,6 @@ export function requiredSimWafId(id) {
|
|
|
22
22
|
}
|
|
23
23
|
return id;
|
|
24
24
|
}
|
|
25
|
-
/**
|
|
26
|
-
* Refuse tags on a WAFv2 resource.
|
|
27
|
-
*
|
|
28
|
-
* Nothing here reads a tag, and a resource that reported tags it was never
|
|
29
|
-
* asked about would be worse than one that says it does not carry them.
|
|
30
|
-
*/
|
|
31
|
-
export function refuseSimWafTags(tags, operation) {
|
|
32
|
-
if (tags !== undefined && tags.length > 0) {
|
|
33
|
-
throw new SimWafUnsimulatedInputException(`WAFv2 resource tags are not simulated, so ${operation} refuses them ` +
|
|
34
|
-
`rather than dropping them`);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
25
|
/**
|
|
38
26
|
* Read an ARN a request named, refusing a request with none.
|
|
39
27
|
*
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
+
import type { SimWafUnsimulatedPart } from "../../resource/sim-waf-unsimulated-part.js";
|
|
1
2
|
import type { SimWafWebAclWriteInput } from "./web-acl.command.js";
|
|
2
3
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
4
|
+
* The web ACL members a write carries that this simulation holds without
|
|
5
|
+
* acting on, keyed by member name.
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* Each of them changes what a web ACL does on real WAF. The web ACL keeps
|
|
8
|
+
* them, `GetWebACL` returns them as written, and `unsimulatedSimWafWebAclMembers`
|
|
9
|
+
* says which ones a request evaluated here goes without.
|
|
9
10
|
*/
|
|
10
|
-
export declare
|
|
11
|
+
export declare function heldSimWafWebAclMembers(input: SimWafWebAclWriteInput): Readonly<Record<string, unknown>>;
|
|
11
12
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* Each of them changes what a web ACL does on real WAF, so accepting one and
|
|
15
|
-
* dropping it would leave the web ACL looking configured to the request that
|
|
16
|
-
* wrote it and unconfigured to every request it then evaluated.
|
|
13
|
+
* What a web ACL's held members leave out, one part per member.
|
|
17
14
|
*/
|
|
18
|
-
export declare function
|
|
15
|
+
export declare function unsimulatedSimWafWebAclMembers(members: Readonly<Record<string, unknown>>): readonly SimWafUnsimulatedPart[];
|
|
@@ -1,49 +1,48 @@
|
|
|
1
|
-
import { SimWafUnsimulatedInputException } from "../../error/sim-wafv2.error.js";
|
|
2
|
-
import { refuseSimWafTags } from "../sim-wafv2-input.js";
|
|
3
1
|
const tokenActions = "the CAPTCHA and Challenge actions are answered by a browser, and nothing " +
|
|
4
2
|
"in a test does that";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Why each web ACL member this simulation does not model is held and not
|
|
5
|
+
* acted on, by the name a request and a template both write.
|
|
6
|
+
*/
|
|
7
|
+
const unsimulatedMembers = new Map([
|
|
8
|
+
["CaptchaConfig", tokenActions],
|
|
9
|
+
["ChallengeConfig", tokenActions],
|
|
10
|
+
["TokenDomains", tokenActions],
|
|
9
11
|
[
|
|
10
|
-
(input) => input.DataProtectionConfig,
|
|
11
12
|
"DataProtectionConfig",
|
|
12
13
|
"it decides what a request field looks like in logs, and web ACL logging " +
|
|
13
14
|
"is not simulated",
|
|
14
15
|
],
|
|
15
16
|
[
|
|
16
|
-
(input) => input.OnSourceDDoSProtectionConfig,
|
|
17
17
|
"OnSourceDDoSProtectionConfig",
|
|
18
18
|
"it responds to traffic volume, which a simulated request never has",
|
|
19
19
|
],
|
|
20
20
|
[
|
|
21
|
-
(input) => input.ApplicationConfig,
|
|
22
21
|
"ApplicationConfig",
|
|
23
22
|
"it configures the WAF-hosted sign-in pages, which are not simulated",
|
|
24
23
|
],
|
|
25
|
-
];
|
|
24
|
+
]);
|
|
26
25
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
26
|
+
* The web ACL members a write carries that this simulation holds without
|
|
27
|
+
* acting on, keyed by member name.
|
|
29
28
|
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
29
|
+
* Each of them changes what a web ACL does on real WAF. The web ACL keeps
|
|
30
|
+
* them, `GetWebACL` returns them as written, and `unsimulatedSimWafWebAclMembers`
|
|
31
|
+
* says which ones a request evaluated here goes without.
|
|
33
32
|
*/
|
|
34
|
-
export
|
|
33
|
+
export function heldSimWafWebAclMembers(input) {
|
|
34
|
+
return Object.fromEntries(Object.entries(input).filter(([member, value]) => unsimulatedMembers.has(member) && value !== undefined));
|
|
35
|
+
}
|
|
35
36
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* Each of them changes what a web ACL does on real WAF, so accepting one and
|
|
39
|
-
* dropping it would leave the web ACL looking configured to the request that
|
|
40
|
-
* wrote it and unconfigured to every request it then evaluated.
|
|
37
|
+
* What a web ACL's held members leave out, one part per member.
|
|
41
38
|
*/
|
|
42
|
-
export function
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
39
|
+
export function unsimulatedSimWafWebAclMembers(members) {
|
|
40
|
+
return unsimulatedMembers
|
|
41
|
+
.entries()
|
|
42
|
+
.filter(([member]) => Object.hasOwn(members, member))
|
|
43
|
+
.map(([member, reason]) => ({
|
|
44
|
+
part: member,
|
|
45
|
+
reason: `${member} is not simulated: ${reason}`,
|
|
46
|
+
}))
|
|
47
|
+
.toArray();
|
|
49
48
|
}
|
|
@@ -20,9 +20,9 @@ interface SimWafWebAclCommandsProperties {
|
|
|
20
20
|
/**
|
|
21
21
|
* The commands that make, read, list, change and remove web ACLs.
|
|
22
22
|
*
|
|
23
|
-
* Every rule is compiled where the web ACL is written
|
|
24
|
-
*
|
|
25
|
-
*
|
|
23
|
+
* Every rule is compiled where the web ACL is written. A rule or member this
|
|
24
|
+
* simulation cannot act on is held as written, so `GetWebACL` returns it, and
|
|
25
|
+
* the web ACL reports it in `unsimulated`.
|
|
26
26
|
*/
|
|
27
27
|
export declare class SimWafWebAclCommands {
|
|
28
28
|
#private;
|
|
@@ -4,14 +4,14 @@ import { SimWafWebAcl } from "../../web-acl/sim-waf-web-acl.js";
|
|
|
4
4
|
import { SimWafPage } from "../sim-wafv2-page.js";
|
|
5
5
|
import { checkedSimWafDescription, requiredSimWafName, } from "../sim-wafv2-input.js";
|
|
6
6
|
import { requireSimWafResource, } from "../sim-wafv2-resource-lookup.js";
|
|
7
|
-
import {
|
|
7
|
+
import { heldSimWafWebAclMembers } from "./sim-wafv2-unsimulated-web-acl-input.js";
|
|
8
8
|
import { simWafWebAclOutput } from "./sim-waf-web-acl-output.js";
|
|
9
9
|
/**
|
|
10
10
|
* The commands that make, read, list, change and remove web ACLs.
|
|
11
11
|
*
|
|
12
|
-
* Every rule is compiled where the web ACL is written
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* Every rule is compiled where the web ACL is written. A rule or member this
|
|
13
|
+
* simulation cannot act on is held as written, so `GetWebACL` returns it, and
|
|
14
|
+
* the web ACL reports it in `unsimulated`.
|
|
15
15
|
*/
|
|
16
16
|
export class SimWafWebAclCommands {
|
|
17
17
|
#webAcls;
|
|
@@ -37,7 +37,6 @@ export class SimWafWebAclCommands {
|
|
|
37
37
|
const { input } = command;
|
|
38
38
|
const name = requiredSimWafName(input.Name);
|
|
39
39
|
const scope = requiredSimWafScope(input.Scope, this.#accountRegionScope.regionName);
|
|
40
|
-
refuseUnsimulatedSimWafWebAclInput(input, "CreateWebACL");
|
|
41
40
|
const configuration = configurationOf(input);
|
|
42
41
|
const webAcl = new SimWafWebAcl({
|
|
43
42
|
name,
|
|
@@ -45,6 +44,7 @@ export class SimWafWebAclCommands {
|
|
|
45
44
|
accountRegionScope: this.#accountRegionScope,
|
|
46
45
|
description: configuration.description,
|
|
47
46
|
configuration,
|
|
47
|
+
tags: input.Tags,
|
|
48
48
|
regexPatternSets: this.#regexPatternSets,
|
|
49
49
|
managedRules: this.#managedRules,
|
|
50
50
|
clock: this.#clock,
|
|
@@ -68,7 +68,6 @@ export class SimWafWebAclCommands {
|
|
|
68
68
|
*/
|
|
69
69
|
updateWebAcl(command, options) {
|
|
70
70
|
const { input } = command;
|
|
71
|
-
refuseUnsimulatedSimWafWebAclInput(input, "UpdateWebACL");
|
|
72
71
|
const configuration = configurationOf(input);
|
|
73
72
|
const webAcl = this.require(input, "wafv2:UpdateWebACL", options);
|
|
74
73
|
webAcl.reconfigure(configuration, input.LockToken);
|
|
@@ -138,5 +137,6 @@ function configurationOf(input) {
|
|
|
138
137
|
visibilityConfig: input.VisibilityConfig,
|
|
139
138
|
description: checkedSimWafDescription(input.Description),
|
|
140
139
|
associationConfig: input.AssociationConfig,
|
|
140
|
+
heldMembers: heldSimWafWebAclMembers(input),
|
|
141
141
|
};
|
|
142
142
|
}
|
|
@@ -74,6 +74,12 @@ export interface SimWafWebAclOutput {
|
|
|
74
74
|
readonly VisibilityConfig: unknown;
|
|
75
75
|
readonly CustomResponseBodies: SimWafCustomResponseBodies | undefined;
|
|
76
76
|
readonly AssociationConfig: SimWafAssociationConfigInput | undefined;
|
|
77
|
+
readonly CaptchaConfig?: unknown;
|
|
78
|
+
readonly ChallengeConfig?: unknown;
|
|
79
|
+
readonly TokenDomains?: readonly string[] | undefined;
|
|
80
|
+
readonly DataProtectionConfig?: unknown;
|
|
81
|
+
readonly OnSourceDDoSProtectionConfig?: unknown;
|
|
82
|
+
readonly ApplicationConfig?: unknown;
|
|
77
83
|
}
|
|
78
84
|
export interface SimGetWebAclCommandOutput {
|
|
79
85
|
readonly WebACL?: SimWafWebAclOutput | undefined;
|
|
@@ -11,6 +11,8 @@ export { SimWafNoProtection, type SimWafProtectedRequest, type SimWafProtection,
|
|
|
11
11
|
export { SimWafInspected, SimWafRequestInspection, } from "./association/sim-waf-request-inspection.js";
|
|
12
12
|
export { SimWafRestApiStage } from "./association/sim-waf-rest-api-stage.js";
|
|
13
13
|
export { SimWafUserPool } from "./association/sim-waf-user-pool.js";
|
|
14
|
+
export { SimWafUnsimulatedResource, type SimWafUnsimulatedResourceType, simWafUnsimulatedResourceTypes, } from "./association/sim-waf-unsimulated-resource.js";
|
|
15
|
+
export type { SimWafUnsimulatedPart } from "./resource/sim-waf-unsimulated-part.js";
|
|
14
16
|
export { SimWafResource, type SimWafResourceSummary, } from "./resource/sim-waf-resource.js";
|
|
15
17
|
export { SimWafWebAcl } from "./web-acl/sim-waf-web-acl.js";
|
|
16
18
|
export type { SimWafWebAclConfiguration } from "./web-acl/sim-waf-web-acl-configuration.js";
|
|
@@ -24,6 +26,7 @@ export { SimWafRegexPatternSet } from "./regex-pattern-set/sim-waf-regex-pattern
|
|
|
24
26
|
export type { SimWafDecision } from "./evaluate/sim-waf-decision.js";
|
|
25
27
|
export { SimWafRequestLabels } from "./evaluate/sim-waf-request-labels.js";
|
|
26
28
|
export { SimWafManagedRules, type SimWafManagedMatchDeclaration, } from "./managed/sim-waf-managed-rules.js";
|
|
29
|
+
export type { SimWafBotDeclaration } from "./managed/sim-waf-bot-declaration.js";
|
|
27
30
|
export type { SimWafManagedRuleReport } from "./managed/sim-waf-managed-rule-report.js";
|
|
28
31
|
export type { SimWafManagedRuleTier } from "./managed/sim-waf-managed-rule.type.js";
|
|
29
32
|
export type { SimWafManagedRuleGroupStatementInput, SimWafOverrideActionInput, SimWafRuleActionOverrideInput, } from "./managed/sim-waf-managed-group.type.js";
|
|
@@ -9,6 +9,7 @@ export { SimWafNoProtection, } from "./association/sim-waf-protection.js";
|
|
|
9
9
|
export { SimWafInspected, SimWafRequestInspection, } from "./association/sim-waf-request-inspection.js";
|
|
10
10
|
export { SimWafRestApiStage } from "./association/sim-waf-rest-api-stage.js";
|
|
11
11
|
export { SimWafUserPool } from "./association/sim-waf-user-pool.js";
|
|
12
|
+
export { SimWafUnsimulatedResource, simWafUnsimulatedResourceTypes, } from "./association/sim-waf-unsimulated-resource.js";
|
|
12
13
|
export { SimWafResource, } from "./resource/sim-waf-resource.js";
|
|
13
14
|
export { SimWafWebAcl } from "./web-acl/sim-waf-web-acl.js";
|
|
14
15
|
export { SimWafRule } from "./web-acl/sim-waf-rule.js";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { SimWafManagedRuleGroupDefinition } from "../sim-waf-managed-rule.type.js";
|
|
2
|
+
/**
|
|
3
|
+
* The bot categories Bot Control's common level names, each with the rule
|
|
4
|
+
* that matches an unverified bot of that category.
|
|
5
|
+
*
|
|
6
|
+
* The category is spelled the way the `bot:category:` label spells it, and
|
|
7
|
+
* the rule name is `Category` and the category in Pascal case.
|
|
8
|
+
*/
|
|
9
|
+
export declare const simWafBotCategories: ReadonlyMap<string, string>;
|
|
10
|
+
/**
|
|
11
|
+
* The one category whose rule matches a verified bot as well.
|
|
12
|
+
*/
|
|
13
|
+
export declare const simWafBotCategoryMatchingVerified = "ai";
|
|
14
|
+
/**
|
|
15
|
+
* AWS WAF Bot Control at its common inspection level.
|
|
16
|
+
*
|
|
17
|
+
* The common level identifies a bot by what the request says about itself,
|
|
18
|
+
* and AWS publishes the rule names, the categories and the labels and none of
|
|
19
|
+
* the signatures. Verifying a bot reads the source address, which is
|
|
20
|
+
* `127.0.0.1` for every request here. So every rule is declared-only, and a
|
|
21
|
+
* test says which bot sent a request with `managedRules().onRequest` and a
|
|
22
|
+
* `bot` declaration.
|
|
23
|
+
*
|
|
24
|
+
* The targeted level is held without being evaluated. Its rules read tokens,
|
|
25
|
+
* browser signals and traffic across requests.
|
|
26
|
+
*/
|
|
27
|
+
export declare const simWafBotControlRuleSet: SimWafManagedRuleGroupDefinition;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The bot categories Bot Control's common level names, each with the rule
|
|
3
|
+
* that matches an unverified bot of that category.
|
|
4
|
+
*
|
|
5
|
+
* The category is spelled the way the `bot:category:` label spells it, and
|
|
6
|
+
* the rule name is `Category` and the category in Pascal case.
|
|
7
|
+
*/
|
|
8
|
+
export const simWafBotCategories = new Map([
|
|
9
|
+
["advertising", "CategoryAdvertising"],
|
|
10
|
+
["archiver", "CategoryArchiver"],
|
|
11
|
+
["content_fetcher", "CategoryContentFetcher"],
|
|
12
|
+
["email_client", "CategoryEmailClient"],
|
|
13
|
+
["http_library", "CategoryHttpLibrary"],
|
|
14
|
+
["link_checker", "CategoryLinkChecker"],
|
|
15
|
+
["miscellaneous", "CategoryMiscellaneous"],
|
|
16
|
+
["monitoring", "CategoryMonitoring"],
|
|
17
|
+
["page_preview", "CategoryPagePreview"],
|
|
18
|
+
["scraping_framework", "CategoryScrapingFramework"],
|
|
19
|
+
["search_engine", "CategorySearchEngine"],
|
|
20
|
+
["security", "CategorySecurity"],
|
|
21
|
+
["seo", "CategorySeo"],
|
|
22
|
+
["social_media", "CategorySocialMedia"],
|
|
23
|
+
["webhooks", "CategoryWebhooks"],
|
|
24
|
+
["ai", "CategoryAI"],
|
|
25
|
+
]);
|
|
26
|
+
/**
|
|
27
|
+
* The one category whose rule matches a verified bot as well.
|
|
28
|
+
*/
|
|
29
|
+
export const simWafBotCategoryMatchingVerified = "ai";
|
|
30
|
+
const signals = [
|
|
31
|
+
["SignalAutomatedBrowser", "automated_browser"],
|
|
32
|
+
["SignalKnownBotDataCenter", "known_bot_data_center"],
|
|
33
|
+
["SignalNonBrowserUserAgent", "non_browser_user_agent"],
|
|
34
|
+
];
|
|
35
|
+
const categoryRules = simWafBotCategories
|
|
36
|
+
.entries()
|
|
37
|
+
.map(([category, name]) => ({
|
|
38
|
+
name,
|
|
39
|
+
label: name,
|
|
40
|
+
labels: [`bot:category:${category}`],
|
|
41
|
+
tier: "declared",
|
|
42
|
+
}))
|
|
43
|
+
.toArray();
|
|
44
|
+
const signalRules = signals.map(([name, signal]) => ({
|
|
45
|
+
name,
|
|
46
|
+
label: name,
|
|
47
|
+
labels: [`signal:${signal}`],
|
|
48
|
+
tier: "declared",
|
|
49
|
+
}));
|
|
50
|
+
/**
|
|
51
|
+
* AWS WAF Bot Control at its common inspection level.
|
|
52
|
+
*
|
|
53
|
+
* The common level identifies a bot by what the request says about itself,
|
|
54
|
+
* and AWS publishes the rule names, the categories and the labels and none of
|
|
55
|
+
* the signatures. Verifying a bot reads the source address, which is
|
|
56
|
+
* `127.0.0.1` for every request here. So every rule is declared-only, and a
|
|
57
|
+
* test says which bot sent a request with `managedRules().onRequest` and a
|
|
58
|
+
* `bot` declaration.
|
|
59
|
+
*
|
|
60
|
+
* The targeted level is held without being evaluated. Its rules read tokens,
|
|
61
|
+
* browser signals and traffic across requests.
|
|
62
|
+
*/
|
|
63
|
+
export const simWafBotControlRuleSet = {
|
|
64
|
+
name: "AWSManagedRulesBotControlRuleSet",
|
|
65
|
+
labelNamespace: "awswaf:managed:aws:bot-control",
|
|
66
|
+
capacity: 50,
|
|
67
|
+
rules: [...categoryRules, ...signalRules],
|
|
68
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { SimWafManagedRuleGroupDefinition } from "../sim-waf-managed-rule.type.js";
|
|
2
|
+
/**
|
|
3
|
+
* The Amazon IP reputation list, which decides by the address a request came
|
|
4
|
+
* from.
|
|
5
|
+
*
|
|
6
|
+
* Every request in this simulation reports a source address of `127.0.0.1`,
|
|
7
|
+
* so every rule here is declared-only. A test says which requests come from a
|
|
8
|
+
* flagged address with `managedRules().onRequest`, and the group labels and
|
|
9
|
+
* acts on them as AWS documents.
|
|
10
|
+
*/
|
|
11
|
+
export declare const simWafIpReputationList: SimWafManagedRuleGroupDefinition;
|
|
12
|
+
/**
|
|
13
|
+
* The anonymous IP list, for VPNs, proxies, Tor nodes and hosting providers.
|
|
14
|
+
*
|
|
15
|
+
* It decides by source address as the reputation list does, and every rule is
|
|
16
|
+
* declared-only for the same reason.
|
|
17
|
+
*/
|
|
18
|
+
export declare const simWafAnonymousIpList: SimWafManagedRuleGroupDefinition;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Amazon IP reputation list, which decides by the address a request came
|
|
3
|
+
* from.
|
|
4
|
+
*
|
|
5
|
+
* Every request in this simulation reports a source address of `127.0.0.1`,
|
|
6
|
+
* so every rule here is declared-only. A test says which requests come from a
|
|
7
|
+
* flagged address with `managedRules().onRequest`, and the group labels and
|
|
8
|
+
* acts on them as AWS documents.
|
|
9
|
+
*/
|
|
10
|
+
export const simWafIpReputationList = {
|
|
11
|
+
name: "AWSManagedRulesAmazonIpReputationList",
|
|
12
|
+
labelNamespace: "awswaf:managed:aws:amazon-ip-list",
|
|
13
|
+
capacity: 25,
|
|
14
|
+
rules: [
|
|
15
|
+
{
|
|
16
|
+
name: "AWSManagedIPReputationList",
|
|
17
|
+
label: "AWSManagedIPReputationList",
|
|
18
|
+
tier: "declared",
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: "AWSManagedReconnaissanceList",
|
|
22
|
+
label: "AWSManagedReconnaissanceList",
|
|
23
|
+
tier: "declared",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: "AWSManagedIPDDoSList",
|
|
27
|
+
label: "AWSManagedIPDDoSList",
|
|
28
|
+
counts: true,
|
|
29
|
+
tier: "declared",
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* The anonymous IP list, for VPNs, proxies, Tor nodes and hosting providers.
|
|
35
|
+
*
|
|
36
|
+
* It decides by source address as the reputation list does, and every rule is
|
|
37
|
+
* declared-only for the same reason.
|
|
38
|
+
*/
|
|
39
|
+
export const simWafAnonymousIpList = {
|
|
40
|
+
name: "AWSManagedRulesAnonymousIpList",
|
|
41
|
+
labelNamespace: "awswaf:managed:aws:anonymous-ip-list",
|
|
42
|
+
capacity: 50,
|
|
43
|
+
rules: [
|
|
44
|
+
{ name: "AnonymousIPList", label: "AnonymousIPList", tier: "declared" },
|
|
45
|
+
{
|
|
46
|
+
name: "HostingProviderIPList",
|
|
47
|
+
label: "HostingProviderIPList",
|
|
48
|
+
tier: "declared",
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
};
|