@kensio/yulin 1.21.23 → 1.21.25

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.
Files changed (103) hide show
  1. package/dist/service/dynamodb/command/authorize/sim-dynamodb-authorizer.d.ts +19 -1
  2. package/dist/service/dynamodb/command/authorize/sim-dynamodb-authorizer.js +21 -3
  3. package/dist/service/dynamodb/command/authorize/sim-dynamodb-reached.d.ts +6 -3
  4. package/dist/service/dynamodb/command/query/sim-dynamodb-query.js +3 -1
  5. package/dist/service/dynamodb/command/scan/sim-dynamodb-scan.js +3 -1
  6. package/dist/service/dynamodb/command/table/sim-dynamodb-table-reach.d.ts +4 -0
  7. package/dist/service/dynamodb/command/table/sim-dynamodb-table-reach.js +1 -0
  8. package/dist/service/dynamodb/table/sim-dynamodb-table-arn.d.ts +13 -0
  9. package/dist/service/dynamodb/table/sim-dynamodb-table-arn.js +20 -0
  10. package/dist/service/wafv2/association/sim-aws-waf-protected-resources.js +4 -0
  11. package/dist/service/wafv2/association/sim-waf-associations.d.ts +6 -0
  12. package/dist/service/wafv2/association/sim-waf-associations.js +17 -0
  13. package/dist/service/wafv2/association/sim-waf-protected-resource.d.ts +13 -8
  14. package/dist/service/wafv2/association/sim-waf-protected-resource.js +23 -23
  15. package/dist/service/wafv2/association/sim-waf-protected-resources.d.ts +11 -6
  16. package/dist/service/wafv2/association/sim-waf-protected-resources.js +10 -7
  17. package/dist/service/wafv2/association/sim-waf-unsimulated-resource.d.ts +33 -0
  18. package/dist/service/wafv2/association/sim-waf-unsimulated-resource.js +66 -0
  19. package/dist/service/wafv2/cfn/association/sim-cfn-waf-association-creator.js +5 -0
  20. package/dist/service/wafv2/cfn/ip-set/sim-cfn-waf-ip-set-config.js +1 -0
  21. package/dist/service/wafv2/cfn/ip-set/sim-cfn-waf-ip-set-creator.js +2 -0
  22. package/dist/service/wafv2/cfn/regex-pattern-set/sim-cfn-waf-regex-set-config.js +1 -0
  23. package/dist/service/wafv2/cfn/regex-pattern-set/sim-cfn-waf-regex-set-creator.js +2 -0
  24. package/dist/service/wafv2/cfn/sim-cfn-waf-resource-config.d.ts +4 -0
  25. package/dist/service/wafv2/cfn/sim-cfn-waf-resource-config.js +10 -0
  26. package/dist/service/wafv2/cfn/sim-cfn-waf-unsimulated.d.ts +10 -0
  27. package/dist/service/wafv2/cfn/sim-cfn-waf-unsimulated.js +12 -0
  28. package/dist/service/wafv2/cfn/web-acl/sim-cfn-waf-web-acl-config.d.ts +1 -13
  29. package/dist/service/wafv2/cfn/web-acl/sim-cfn-waf-web-acl-config.js +8 -21
  30. package/dist/service/wafv2/cfn/web-acl/sim-cfn-waf-web-acl-creator.d.ts +4 -9
  31. package/dist/service/wafv2/cfn/web-acl/sim-cfn-waf-web-acl-creator.js +7 -15
  32. package/dist/service/wafv2/command/association/sim-wafv2-association-commands.js +2 -1
  33. package/dist/service/wafv2/command/association/sim-wafv2-association-input.d.ts +10 -2
  34. package/dist/service/wafv2/command/association/sim-wafv2-association-input.js +25 -13
  35. package/dist/service/wafv2/command/ip-set/sim-wafv2-ip-set-commands.d.ts +3 -3
  36. package/dist/service/wafv2/command/ip-set/sim-wafv2-ip-set-commands.js +5 -5
  37. package/dist/service/wafv2/command/managed-rule-group/sim-wafv2-managed-rule-group-commands.js +4 -4
  38. package/dist/service/wafv2/command/regex-pattern-set/sim-wafv2-regex-pattern-set-commands.js +2 -2
  39. package/dist/service/wafv2/command/sim-wafv2-input.d.ts +0 -7
  40. package/dist/service/wafv2/command/sim-wafv2-input.js +1 -13
  41. package/dist/service/wafv2/command/web-acl/sim-waf-web-acl-output.js +1 -0
  42. package/dist/service/wafv2/command/web-acl/sim-wafv2-unsimulated-web-acl-input.d.ts +9 -12
  43. package/dist/service/wafv2/command/web-acl/sim-wafv2-unsimulated-web-acl-input.js +27 -28
  44. package/dist/service/wafv2/command/web-acl/sim-wafv2-web-acl-commands.d.ts +3 -3
  45. package/dist/service/wafv2/command/web-acl/sim-wafv2-web-acl-commands.js +6 -6
  46. package/dist/service/wafv2/command/web-acl/web-acl.command.d.ts +6 -0
  47. package/dist/service/wafv2/index.d.ts +3 -0
  48. package/dist/service/wafv2/index.js +1 -0
  49. package/dist/service/wafv2/managed/group/sim-waf-bot-control.d.ts +27 -0
  50. package/dist/service/wafv2/managed/group/sim-waf-bot-control.js +68 -0
  51. package/dist/service/wafv2/managed/group/sim-waf-ip-reputation.d.ts +18 -0
  52. package/dist/service/wafv2/managed/group/sim-waf-ip-reputation.js +51 -0
  53. package/dist/service/wafv2/managed/sim-waf-bot-declaration.d.ts +35 -0
  54. package/dist/service/wafv2/managed/sim-waf-bot-declaration.js +42 -0
  55. package/dist/service/wafv2/managed/sim-waf-managed-declaration.d.ts +35 -0
  56. package/dist/service/wafv2/managed/sim-waf-managed-declaration.js +30 -0
  57. package/dist/service/wafv2/managed/sim-waf-managed-group-configs.d.ts +11 -0
  58. package/dist/service/wafv2/managed/sim-waf-managed-group-configs.js +42 -0
  59. package/dist/service/wafv2/managed/sim-waf-managed-group-input.d.ts +5 -4
  60. package/dist/service/wafv2/managed/sim-waf-managed-group-input.js +7 -9
  61. package/dist/service/wafv2/managed/sim-waf-managed-group-statement.js +16 -14
  62. package/dist/service/wafv2/managed/sim-waf-managed-group.type.d.ts +2 -2
  63. package/dist/service/wafv2/managed/sim-waf-managed-rule-actions.d.ts +30 -0
  64. package/dist/service/wafv2/managed/sim-waf-managed-rule-actions.js +26 -0
  65. package/dist/service/wafv2/managed/sim-waf-managed-rule-groups.d.ts +5 -3
  66. package/dist/service/wafv2/managed/sim-waf-managed-rule-groups.js +10 -3
  67. package/dist/service/wafv2/managed/sim-waf-managed-rule.type.d.ts +11 -2
  68. package/dist/service/wafv2/managed/sim-waf-managed-rules.d.ts +14 -9
  69. package/dist/service/wafv2/managed/sim-waf-managed-rules.js +15 -5
  70. package/dist/service/wafv2/resource/sim-waf-resource.d.ts +10 -0
  71. package/dist/service/wafv2/resource/sim-waf-resource.js +12 -0
  72. package/dist/service/wafv2/resource/sim-waf-unsimulated-part.d.ts +24 -0
  73. package/dist/service/wafv2/resource/sim-waf-unsimulated-part.js +8 -0
  74. package/dist/service/wafv2/sim-wafv2.d.ts +12 -12
  75. package/dist/service/wafv2/sim-wafv2.fixture.d.ts +19 -1
  76. package/dist/service/wafv2/sim-wafv2.fixture.js +29 -0
  77. package/dist/service/wafv2/sim-wafv2.js +25 -23
  78. package/dist/service/wafv2/statement/sim-waf-field-to-match.type.d.ts +2 -2
  79. package/dist/service/wafv2/statement/sim-waf-rule-refusals.d.ts +6 -4
  80. package/dist/service/wafv2/statement/sim-waf-rule-refusals.js +7 -6
  81. package/dist/service/wafv2/statement/sim-waf-statement.d.ts +3 -3
  82. package/dist/service/wafv2/statement/sim-waf-statement.js +3 -3
  83. package/dist/service/wafv2/statement/sim-waf-statement.type.d.ts +3 -3
  84. package/dist/service/wafv2/statement/sim-waf-unsimulated-statement.js +1 -1
  85. package/dist/service/wafv2/web-acl/sim-waf-association-config.d.ts +14 -7
  86. package/dist/service/wafv2/web-acl/sim-waf-association-config.js +17 -27
  87. package/dist/service/wafv2/web-acl/sim-waf-rule.d.ts +15 -3
  88. package/dist/service/wafv2/web-acl/sim-waf-rule.js +46 -10
  89. package/dist/service/wafv2/web-acl/sim-waf-statement-capacity.d.ts +4 -4
  90. package/dist/service/wafv2/web-acl/sim-waf-statement-capacity.js +4 -4
  91. package/dist/service/wafv2/web-acl/sim-waf-unsimulated-body-limit.d.ts +6 -0
  92. package/dist/service/wafv2/web-acl/sim-waf-unsimulated-body-limit.js +23 -0
  93. package/dist/service/wafv2/web-acl/sim-waf-web-acl-capacity.js +2 -2
  94. package/dist/service/wafv2/web-acl/sim-waf-web-acl-configuration.d.ts +5 -0
  95. package/dist/service/wafv2/web-acl/sim-waf-web-acl.d.ts +11 -2
  96. package/dist/service/wafv2/web-acl/sim-waf-web-acl.js +20 -1
  97. package/docs/services/dynamodb/README.md +26 -0
  98. package/docs/services/wafv2/README.md +243 -51
  99. package/package.json +3 -3
  100. package/dist/service/wafv2/cfn/web-acl/sim-cfn-waf-evaluatable-rules.d.ts +0 -15
  101. package/dist/service/wafv2/cfn/web-acl/sim-cfn-waf-evaluatable-rules.js +0 -21
  102. package/dist/service/wafv2/web-acl/sim-waf-unevaluatable-rules.d.ts +0 -25
  103. package/dist/service/wafv2/web-acl/sim-waf-unevaluatable-rules.js +0 -33
@@ -1,11 +1,12 @@
1
- import { SimWafInvalidParameterException, SimWafUnsimulatedInputException, } from "../error/sim-wafv2.error.js";
1
+ import { SimWafInvalidParameterException } from "../error/sim-wafv2.error.js";
2
+ import { unsimulatedSimWafBodyLimits } from "./sim-waf-unsimulated-body-limit.js";
2
3
  /**
3
4
  * How much of a request body WAF reads for a resource type given no
4
5
  * `AssociationConfig`.
5
6
  *
6
7
  * CloudFront, API Gateway and Cognito all default to 16 KB. A load balancer
7
- * and an AppSync API are fixed at 8 KB, and a web ACL cannot be put in front
8
- * of either one here.
8
+ * and an AppSync API are fixed at 8 KB, and no simulated request reaches a web
9
+ * ACL through either one.
9
10
  */
10
11
  export const simWafBodyInspectionLimitBytes = 16_384;
11
12
  /**
@@ -17,11 +18,6 @@ const inspectionLimits = new Map([
17
18
  ["KB_48", 49_152],
18
19
  ["KB_64", 65_536],
19
20
  ]);
20
- const simulatedResourceTypes = [
21
- "CLOUDFRONT",
22
- "API_GATEWAY",
23
- "COGNITO_USER_POOL",
24
- ];
25
21
  /**
26
22
  * How much of a request body a web ACL's rules read, by resource type.
27
23
  *
@@ -36,15 +32,21 @@ export class SimWafBodyInspectionLimits {
36
32
  }
37
33
  /**
38
34
  * Read the limits an `AssociationConfig` sets, refusing anything WAF would
39
- * refuse and anything this simulation cannot apply.
35
+ * refuse.
40
36
  */
41
37
  static read(input) {
42
- const configured = Object.entries(input?.RequestBody ?? {});
43
- const limits = new Map();
44
- for (const [resourceType, config] of configured) {
45
- limits.set(simulatedResourceType(resourceType), inspectionLimit(resourceType, config));
46
- }
47
- return new SimWafBodyInspectionLimits(limits);
38
+ return new SimWafBodyInspectionLimits(new Map(Object.entries(input?.RequestBody ?? {}).map(([resourceType, config]) => [
39
+ resourceType,
40
+ inspectionLimit(resourceType, config),
41
+ ])));
42
+ }
43
+ /**
44
+ * The limits set for resource types no simulated request passes through.
45
+ *
46
+ * Each is checked as WAF checks it and held, and applies to nothing.
47
+ */
48
+ get unsimulated() {
49
+ return unsimulatedSimWafBodyLimits(this.limits.keys());
48
50
  }
49
51
  /**
50
52
  * How many bytes of a body a request reaching one resource type is inspected
@@ -60,18 +62,6 @@ export class SimWafBodyInspectionLimits {
60
62
  return this.limits.get(resourceType) ?? simWafBodyInspectionLimitBytes;
61
63
  }
62
64
  }
63
- /**
64
- * Hold a `RequestBody` key to the resource types this simulation associates.
65
- */
66
- function simulatedResourceType(resourceType) {
67
- const simulated = simulatedResourceTypes.find((candidate) => candidate === resourceType);
68
- if (simulated === undefined) {
69
- throw new SimWafUnsimulatedInputException(`AssociationConfig sets the body inspection limit for ${resourceType} ` +
70
- `resources, and ${simulatedResourceTypes.join(" and ")} are the ` +
71
- `types a web ACL goes in front of in Yulin`);
72
- }
73
- return simulated;
74
- }
75
65
  /**
76
66
  * Read one resource type's `DefaultSizeInspectionLimit`.
77
67
  *
@@ -4,17 +4,29 @@ import type { SimWafRuleInput, SimWafRuleScope } from "./sim-waf-rule.type.js";
4
4
  /**
5
5
  * One rule of a web ACL, compiled so a request can be evaluated against it.
6
6
  *
7
- * The statement is turned into an evaluator when the web ACL is written, which
8
- * is what lets a rule Yulin cannot evaluate be refused at that point rather
9
- * than silently letting requests past later on.
7
+ * The statement is turned into an evaluator when the web ACL is written. A
8
+ * rule using something Yulin does not simulate is held all the same, as a
9
+ * rule that claims no request, and says why in `unsimulatedReason`. The web
10
+ * ACL reports it from there.
10
11
  */
11
12
  export declare class SimWafRule {
12
13
  #private;
13
14
  readonly name: string;
14
15
  readonly priority: number;
16
+ /**
17
+ * Why this rule claims no request, when it uses something Yulin does not
18
+ * simulate.
19
+ *
20
+ * AWS would evaluate it. A request it would have claimed goes on to the
21
+ * next rule here.
22
+ */
23
+ readonly unsimulatedReason: string | undefined;
15
24
  private constructor();
16
25
  /**
17
26
  * Compile one rule as it was written.
27
+ *
28
+ * Input WAFv2 itself would refuse is refused here too. A rule using
29
+ * something only Yulin leaves out compiles to one that claims nothing.
18
30
  */
19
31
  static compile(input: SimWafRuleInput, scope: SimWafRuleScope): SimWafRule;
20
32
  /**
@@ -1,16 +1,32 @@
1
+ import { SimWafUnsimulatedInputException } from "../error/sim-wafv2.error.js";
1
2
  import { refuseUnsimulatedSimWafRuleInput, requiredSimWafRuleName, requiredSimWafRulePriority, } from "./sim-waf-rule-input.js";
2
3
  import { simWafRuleLabels } from "./sim-waf-rule-labels.js";
3
4
  import { compileSimWafRuleEvaluator } from "./sim-waf-rule-evaluator.js";
5
+ /**
6
+ * What a rule held without being evaluated does with every request.
7
+ */
8
+ function claimsNothing() {
9
+ // A held rule claims no request, so every request goes on to the next rule.
10
+ }
4
11
  /**
5
12
  * One rule of a web ACL, compiled so a request can be evaluated against it.
6
13
  *
7
- * The statement is turned into an evaluator when the web ACL is written, which
8
- * is what lets a rule Yulin cannot evaluate be refused at that point rather
9
- * than silently letting requests past later on.
14
+ * The statement is turned into an evaluator when the web ACL is written. A
15
+ * rule using something Yulin does not simulate is held all the same, as a
16
+ * rule that claims no request, and says why in `unsimulatedReason`. The web
17
+ * ACL reports it from there.
10
18
  */
11
19
  export class SimWafRule {
12
20
  name;
13
21
  priority;
22
+ /**
23
+ * Why this rule claims no request, when it uses something Yulin does not
24
+ * simulate.
25
+ *
26
+ * AWS would evaluate it. A request it would have claimed goes on to the
27
+ * next rule here.
28
+ */
29
+ unsimulatedReason;
14
30
  #labels;
15
31
  #evaluate;
16
32
  constructor(properties) {
@@ -18,19 +34,39 @@ export class SimWafRule {
18
34
  this.priority = properties.priority;
19
35
  this.#labels = properties.labels;
20
36
  this.#evaluate = properties.evaluate;
37
+ this.unsimulatedReason = properties.unsimulatedReason;
21
38
  }
22
39
  /**
23
40
  * Compile one rule as it was written.
41
+ *
42
+ * Input WAFv2 itself would refuse is refused here too. A rule using
43
+ * something only Yulin leaves out compiles to one that claims nothing.
24
44
  */
25
45
  static compile(input, scope) {
26
46
  const name = requiredSimWafRuleName(input.Name);
27
- refuseUnsimulatedSimWafRuleInput(input, name);
28
- return new SimWafRule({
29
- name,
30
- priority: requiredSimWafRulePriority(input.Priority, name),
31
- labels: simWafRuleLabels(input.RuleLabels, name),
32
- evaluate: compileSimWafRuleEvaluator(input, name, scope),
33
- });
47
+ const priority = requiredSimWafRulePriority(input.Priority, name);
48
+ const labels = simWafRuleLabels(input.RuleLabels, name);
49
+ try {
50
+ refuseUnsimulatedSimWafRuleInput(input, name);
51
+ return new SimWafRule({
52
+ name,
53
+ priority,
54
+ labels,
55
+ evaluate: compileSimWafRuleEvaluator(input, name, scope),
56
+ });
57
+ }
58
+ catch (error) {
59
+ if (!(error instanceof SimWafUnsimulatedInputException)) {
60
+ throw error;
61
+ }
62
+ return new SimWafRule({
63
+ name,
64
+ priority,
65
+ labels,
66
+ evaluate: claimsNothing,
67
+ unsimulatedReason: error.message,
68
+ });
69
+ }
34
70
  }
35
71
  /**
36
72
  * What this rule does with a request, which is nothing when it does not
@@ -2,9 +2,9 @@ import type { SimWafStatementInput } from "../statement/sim-waf-statement.type.j
2
2
  /**
3
3
  * What the statements that inspect a request cost.
4
4
  *
5
- * Only the kinds this simulation evaluates are counted. Every other kind is
6
- * refused where the rule is written, so a web ACL that has rules to add up
7
- * cannot hold one. Doubling the base cost for a JSON body never applies here
8
- * for the same reason.
5
+ * Only the kinds this simulation evaluates are counted. A rule using any
6
+ * other kind is held unevaluated and contributes nothing, so a web ACL holding
7
+ * one reports less than AWS would charge. Doubling the base cost for a JSON
8
+ * body never applies here for the same reason.
9
9
  */
10
10
  export declare function simWafMatchCapacity(statement: SimWafStatementInput): number;
@@ -19,10 +19,10 @@ const textTransformationCost = 10;
19
19
  /**
20
20
  * What the statements that inspect a request cost.
21
21
  *
22
- * Only the kinds this simulation evaluates are counted. Every other kind is
23
- * refused where the rule is written, so a web ACL that has rules to add up
24
- * cannot hold one. Doubling the base cost for a JSON body never applies here
25
- * for the same reason.
22
+ * Only the kinds this simulation evaluates are counted. A rule using any
23
+ * other kind is held unevaluated and contributes nothing, so a web ACL holding
24
+ * one reports less than AWS would charge. Doubling the base cost for a JSON
25
+ * body never applies here for the same reason.
26
26
  */
27
27
  export function simWafMatchCapacity(statement) {
28
28
  return (byteMatchCapacity(statement.ByteMatchStatement) +
@@ -0,0 +1,6 @@
1
+ import type { SimWafUnsimulatedPart } from "../resource/sim-waf-unsimulated-part.js";
2
+ /**
3
+ * What the body inspection limits a web ACL sets leave out, one part per
4
+ * resource type no simulated request passes through.
5
+ */
6
+ export declare function unsimulatedSimWafBodyLimits(resourceTypes: Iterable<string>): readonly SimWafUnsimulatedPart[];
@@ -0,0 +1,23 @@
1
+ /**
2
+ * The resource types a simulated request reaches a web ACL through.
3
+ */
4
+ const simulatedResourceTypes = new Set([
5
+ "CLOUDFRONT",
6
+ "API_GATEWAY",
7
+ "COGNITO_USER_POOL",
8
+ ]);
9
+ /**
10
+ * What the body inspection limits a web ACL sets leave out, one part per
11
+ * resource type no simulated request passes through.
12
+ */
13
+ export function unsimulatedSimWafBodyLimits(resourceTypes) {
14
+ return [...resourceTypes]
15
+ .filter((resourceType) => !simulatedResourceTypes.has(resourceType))
16
+ .map((resourceType) => ({
17
+ part: `AssociationConfig.RequestBody.${resourceType}`,
18
+ reason: `AssociationConfig sets the body inspection limit for ` +
19
+ `${resourceType} resources, and ` +
20
+ `${[...simulatedResourceTypes].join(" and ")} are the types a ` +
21
+ `simulated request reaches a web ACL through`,
22
+ }));
23
+ }
@@ -59,8 +59,8 @@ function nestedCapacity(statement) {
59
59
  *
60
60
  * A group is fixed at the capacity its owner gave it, and a scope-down
61
61
  * statement is charged on top. A group this simulation does not carry
62
- * contributes nothing, which cannot happen through a compiled web ACL: naming
63
- * one is refused where the rule is written.
62
+ * contributes nothing, so a web ACL holding one reports less than AWS would
63
+ * charge.
64
64
  */
65
65
  function managedGroupCapacity(statement) {
66
66
  const named = statement.ManagedRuleGroupStatement;
@@ -13,6 +13,11 @@ export interface SimWafWebAclConfiguration {
13
13
  readonly visibilityConfig?: unknown;
14
14
  readonly description?: string | undefined;
15
15
  readonly associationConfig?: SimWafAssociationConfigInput | undefined;
16
+ /**
17
+ * The members held as written and not acted on, such as `CaptchaConfig`,
18
+ * keyed by the name the API gives them.
19
+ */
20
+ readonly heldMembers?: Readonly<Record<string, unknown>> | undefined;
16
21
  }
17
22
  /**
18
23
  * Read the action a request no rule claims is given.
@@ -1,7 +1,7 @@
1
1
  import { type SimWafDecision } from "../evaluate/sim-waf-decision.js";
2
2
  import type { SimWafInspectedRequest } from "../evaluate/sim-waf-inspected-request.js";
3
3
  import { SimWafResource, type SimWafResourceProperties } from "../resource/sim-waf-resource.js";
4
- import { type SimWafBodyInspectionResourceType } from "./sim-waf-association-config.js";
4
+ import type { SimWafUnsimulatedPart } from "../resource/sim-waf-unsimulated-part.js";
5
5
  import type { SimWafWebAclRuleScope } from "./sim-waf-rule.type.js";
6
6
  import { type SimWafWebAclConfiguration } from "./sim-waf-web-acl-configuration.js";
7
7
  interface SimWafWebAclProperties extends SimWafResourceProperties, SimWafWebAclRuleScope {
@@ -33,6 +33,14 @@ export declare class SimWafWebAcl extends SimWafResource {
33
33
  * What this web ACL's rules add up to in capacity units.
34
34
  */
35
35
  get capacity(): number;
36
+ /**
37
+ * What this web ACL was written with and the simulation does not act on.
38
+ *
39
+ * A rule listed here claims no request, a member is held and does nothing,
40
+ * and a body inspection limit applies to no request. `GetWebACL` returns
41
+ * every one of them as written.
42
+ */
43
+ get unsimulated(): readonly SimWafUnsimulatedPart[];
36
44
  /**
37
45
  * What this web ACL was last written with, as the API reports it.
38
46
  */
@@ -42,6 +50,7 @@ export declare class SimWafWebAcl extends SimWafResource {
42
50
  *
43
51
  * The rules are compiled before anything is replaced, so a web ACL that
44
52
  * refuses an update keeps the rules it had rather than being left with none.
53
+ * The tags stay as they were created, since UpdateWebACL takes none.
45
54
  */
46
55
  reconfigure(configuration: SimWafWebAclConfiguration, lockToken: string | undefined): void;
47
56
  /**
@@ -51,7 +60,7 @@ export declare class SimWafWebAcl extends SimWafResource {
51
60
  * `AssociationConfig` raises it per resource type, and a web ACL written
52
61
  * without one reads the 16 KB default everything it protects has.
53
62
  */
54
- bodyInspectionLimitBytes(resourceType: SimWafBodyInspectionResourceType | undefined): number;
63
+ bodyInspectionLimitBytes(resourceType: string | undefined): number;
55
64
  /**
56
65
  * Decide what happens to one request.
57
66
  */
@@ -1,7 +1,8 @@
1
1
  import { simWafDecision, } from "../evaluate/sim-waf-decision.js";
2
2
  import { simWafEvaluateRules } from "../evaluate/sim-waf-evaluate-rules.js";
3
+ import { unsimulatedSimWafWebAclMembers } from "../command/web-acl/sim-wafv2-unsimulated-web-acl-input.js";
3
4
  import { SimWafResource, } from "../resource/sim-waf-resource.js";
4
- import { SimWafBodyInspectionLimits, } from "./sim-waf-association-config.js";
5
+ import { SimWafBodyInspectionLimits } from "./sim-waf-association-config.js";
5
6
  import { compileSimWafWebAclRules } from "./sim-waf-rules.js";
6
7
  import { simWafWebAclCapacity } from "./sim-waf-web-acl-capacity.js";
7
8
  import { readSimWafDefaultAction, } from "./sim-waf-web-acl-configuration.js";
@@ -49,6 +50,23 @@ export class SimWafWebAcl extends SimWafResource {
49
50
  get capacity() {
50
51
  return this.#capacity;
51
52
  }
53
+ /**
54
+ * What this web ACL was written with and the simulation does not act on.
55
+ *
56
+ * A rule listed here claims no request, a member is held and does nothing,
57
+ * and a body inspection limit applies to no request. `GetWebACL` returns
58
+ * every one of them as written.
59
+ */
60
+ get unsimulated() {
61
+ return [
62
+ ...this.#rules.flatMap(({ name, unsimulatedReason }) => unsimulatedReason === undefined
63
+ ? []
64
+ : [{ part: `Rules.${name}`, reason: unsimulatedReason }]),
65
+ ...unsimulatedSimWafWebAclMembers(this.#configuration.heldMembers ?? {}),
66
+ ...this.#bodyInspectionLimits.unsimulated,
67
+ ...super.unsimulated,
68
+ ];
69
+ }
52
70
  /**
53
71
  * What this web ACL was last written with, as the API reports it.
54
72
  */
@@ -60,6 +78,7 @@ export class SimWafWebAcl extends SimWafResource {
60
78
  *
61
79
  * The rules are compiled before anything is replaced, so a web ACL that
62
80
  * refuses an update keeps the rules it had rather than being left with none.
81
+ * The tags stay as they were created, since UpdateWebACL takes none.
63
82
  */
64
83
  reconfigure(configuration, lockToken) {
65
84
  const defaultAction = readSimWafDefaultAction(configuration);
@@ -1434,6 +1434,8 @@ from a different partition key is refused, since it names a collection this quer
1434
1434
  ## Reading a global secondary index
1435
1435
 
1436
1436
  Set `IndexName` on `Query` or `Scan` to read an index. Key conditions then use the index key schema.
1437
+ IAM authorizes the read against the index's own ARN, covered under
1438
+ [authorizing a read of an index](#authorizing-a-read-of-an-index).
1437
1439
 
1438
1440
  ```typescript sim-dynamodb-query-index
1439
1441
  /**
@@ -3716,6 +3718,26 @@ unauthorized caller cannot find out which names are taken.
3716
3718
  in the same way, each against the `dynamodb:` action of its own name. `ListTables` names no table.
3717
3719
  It authorizes against `*`.
3718
3720
 
3721
+ ### Authorizing a read of an index
3722
+
3723
+ A `Query` or `Scan` of the table authorizes against the table ARN. One naming an `IndexName`
3724
+ authorizes against the index's own ARN, the table ARN followed by `/index/` and the index name:
3725
+
3726
+ ```text
3727
+ arn:aws:dynamodb:eu-west-2:111111111111:table/OrdersTable/index/byStatus
3728
+ ```
3729
+
3730
+ Global and local secondary indexes work the same way. A statement allowing `dynamodb:Query` on the
3731
+ table ARN alone refuses a query of any index, with an `AccessDenied` naming the index ARN. A
3732
+ statement allowing only an index ARN refuses a query of the table. A caller that reads both needs
3733
+ the table ARN and `<table ARN>/index/*` (or each index ARN) in its policy.
3734
+
3735
+ CDK's `grantReadData` and `grantReadWriteData` add `<table ARN>/index/*` only for a table construct
3736
+ that declares its indexes. A table imported with `Table.fromTableName` declares none, so its grant
3737
+ covers the table ARN alone, and a query of an index fails here as it fails on AWS. Import the table
3738
+ with `Table.fromTableAttributes` and its `globalIndexes` or `localIndexes` to have the grant cover
3739
+ them.
3740
+
3719
3741
  ### Fine-grained access control with dynamodb:LeadingKeys
3720
3742
 
3721
3743
  `GetItem`, `BatchGetItem`, `Query`, `PutItem`, `UpdateItem`, `DeleteItem` and `BatchWriteItem`
@@ -3723,6 +3745,8 @@ supply the partition key values they reach as `dynamodb:LeadingKeys`. A policy c
3723
3745
  key restricts a caller to the items under particular partition keys. AWS scopes one user of a
3724
3746
  shared table to their own rows this way.
3725
3747
 
3748
+ A `Query` of an index supplies the index's partition key value, the value its key condition names.
3749
+
3726
3750
  The condition takes the `ForAllValues:` qualifier, as AWS requires for this key. Every partition key
3727
3751
  value the request reaches has to match. A batch or a write naming one item outside the allowed set
3728
3752
  is refused whole, and nothing it asked for is applied.
@@ -3847,6 +3871,8 @@ is written.
3847
3871
  answering with the attributes it projects, and paging with a `LastEvaluatedKey` carrying the index
3848
3872
  key and the table key together. A local secondary index also answers a strongly consistent read,
3849
3873
  and fetches an unprojected attribute from the base table.
3874
+ - `Query` and `Scan` of an index authorized against the index ARN, for a global and a local
3875
+ secondary index alike.
3850
3876
  - `dynamodb:LeadingKeys` on `GetItem`, `BatchGetItem`, `Query`, `PutItem`, `UpdateItem`,
3851
3877
  `DeleteItem` and `BatchWriteItem`, carrying the partition key values the request reaches so a
3852
3878
  `ForAllValues:` condition can scope a caller to particular items.