@jaypie/constructs 1.2.38 → 1.2.40
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/cjs/JaypieDistribution.d.ts +11 -0
- package/dist/cjs/JaypieMigration.d.ts +2 -0
- package/dist/cjs/index.cjs +11 -3
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/JaypieDistribution.d.ts +11 -0
- package/dist/esm/JaypieMigration.d.ts +2 -0
- package/dist/esm/index.js +11 -3
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -22,6 +22,17 @@ export interface JaypieWafConfig {
|
|
|
22
22
|
* @default true
|
|
23
23
|
*/
|
|
24
24
|
logBucket?: boolean | s3.IBucket;
|
|
25
|
+
/**
|
|
26
|
+
* Override actions for specific rules within managed rule groups.
|
|
27
|
+
* Key is the managed rule group name; value is an array of rule action overrides.
|
|
28
|
+
* @example
|
|
29
|
+
* managedRuleOverrides: {
|
|
30
|
+
* AWSManagedRulesCommonRuleSet: [
|
|
31
|
+
* { name: "SizeRestrictions_BODY", actionToUse: { count: {} } },
|
|
32
|
+
* ],
|
|
33
|
+
* }
|
|
34
|
+
*/
|
|
35
|
+
managedRuleOverrides?: Record<string, wafv2.CfnWebACL.RuleActionOverrideProperty[]>;
|
|
25
36
|
/**
|
|
26
37
|
* Managed rule group names to apply
|
|
27
38
|
* @default ["AWSManagedRulesCommonRuleSet", "AWSManagedRulesKnownBadInputsRuleSet"]
|
|
@@ -8,6 +8,8 @@ export interface JaypieMigrationProps {
|
|
|
8
8
|
code: lambda.Code | string;
|
|
9
9
|
/** Constructs that must be created before the migration runs */
|
|
10
10
|
dependencies?: Construct[];
|
|
11
|
+
/** Environment variables for the migration Lambda */
|
|
12
|
+
environment?: Record<string, string> | (Record<string, string> | string)[];
|
|
11
13
|
/** Lambda handler entry point */
|
|
12
14
|
handler?: string;
|
|
13
15
|
/** Secrets to make available to the migration Lambda */
|
package/dist/esm/index.js
CHANGED
|
@@ -2612,11 +2612,12 @@ class JaypieDistribution extends Construct {
|
|
|
2612
2612
|
}
|
|
2613
2613
|
else {
|
|
2614
2614
|
// Create new WebACL
|
|
2615
|
-
const { managedRules = DEFAULT_MANAGED_RULES, rateLimitPerIp = DEFAULT_RATE_LIMIT, } = wafConfig;
|
|
2615
|
+
const { managedRuleOverrides, managedRules = DEFAULT_MANAGED_RULES, rateLimitPerIp = DEFAULT_RATE_LIMIT, } = wafConfig;
|
|
2616
2616
|
let priority = 0;
|
|
2617
2617
|
const rules = [];
|
|
2618
2618
|
// Add managed rule groups
|
|
2619
2619
|
for (const ruleName of managedRules) {
|
|
2620
|
+
const ruleActionOverrides = managedRuleOverrides?.[ruleName];
|
|
2620
2621
|
rules.push({
|
|
2621
2622
|
name: ruleName,
|
|
2622
2623
|
priority: priority++,
|
|
@@ -2625,6 +2626,7 @@ class JaypieDistribution extends Construct {
|
|
|
2625
2626
|
managedRuleGroupStatement: {
|
|
2626
2627
|
name: ruleName,
|
|
2627
2628
|
vendorName: "AWS",
|
|
2629
|
+
...(ruleActionOverrides && { ruleActionOverrides }),
|
|
2628
2630
|
},
|
|
2629
2631
|
},
|
|
2630
2632
|
visibilityConfig: {
|
|
@@ -3395,11 +3397,12 @@ class JaypieInfrastructureStack extends JaypieStack {
|
|
|
3395
3397
|
class JaypieMigration extends Construct {
|
|
3396
3398
|
constructor(scope, id, props) {
|
|
3397
3399
|
super(scope, id);
|
|
3398
|
-
const { code, dependencies = [], handler = "index.handler", secrets = [], tables = [], } = props;
|
|
3400
|
+
const { code, dependencies = [], environment, handler = "index.handler", secrets = [], tables = [], } = props;
|
|
3399
3401
|
// Migration Lambda — 5 minute timeout for long-running migrations
|
|
3400
3402
|
this.lambda = new JaypieLambda(this, "MigrationLambda", {
|
|
3401
3403
|
code,
|
|
3402
3404
|
description: "DynamoDB migration custom resource",
|
|
3405
|
+
environment,
|
|
3403
3406
|
handler,
|
|
3404
3407
|
roleTag: CDK$2.ROLE.PROCESSING,
|
|
3405
3408
|
secrets,
|
|
@@ -3410,8 +3413,13 @@ class JaypieMigration extends Construct {
|
|
|
3410
3413
|
const provider = new cr.Provider(this, "MigrationProvider", {
|
|
3411
3414
|
onEventHandler: this.lambda,
|
|
3412
3415
|
});
|
|
3413
|
-
// Custom Resource that triggers on every deploy
|
|
3416
|
+
// Custom Resource that triggers on every deploy.
|
|
3417
|
+
// deployNonce forces CloudFormation to re-invoke the custom resource
|
|
3418
|
+
// even when only Lambda code changes (issue #261).
|
|
3414
3419
|
const resource = new cdk.CustomResource(this, "MigrationResource", {
|
|
3420
|
+
properties: {
|
|
3421
|
+
deployNonce: Date.now().toString(),
|
|
3422
|
+
},
|
|
3415
3423
|
serviceToken: provider.serviceToken,
|
|
3416
3424
|
});
|
|
3417
3425
|
// Ensure dependencies are created before the migration runs
|