Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@collaborne/custom-cloudformation-resources

Package Overview
Dependencies
Maintainers
5
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@collaborne/custom-cloudformation-resources - npm Package Compare versions

Comparing version 0.5.17 to 0.5.18

7

dist/cloudfront-waf-v2/index.d.ts

@@ -14,2 +14,5 @@ import { WAFV2 } from 'aws-sdk';

};
Rules: {
type: "string";
};
};

@@ -26,7 +29,7 @@ required: string[];

constructor(logicalResourceId: string, logger: Logger);
createResource(physicalResourceId: string, { Name, MetricName }: SchemaType<typeof SCHEMA>): Promise<Response<ResourceAttributes>>;
createResource(physicalResourceId: string, { Name, MetricName, Rules }: SchemaType<typeof SCHEMA>): Promise<Response<ResourceAttributes>>;
deleteResource(physicalResourceId: string, { Name }: SchemaType<typeof SCHEMA>): Promise<Response<ResourceAttributes>>;
updateResource(physicalResourceId: string, { Name }: SchemaType<typeof SCHEMA>): Promise<Response<ResourceAttributes>>;
updateResource(physicalResourceId: string, { Name, Rules }: SchemaType<typeof SCHEMA>): Promise<Response<ResourceAttributes>>;
protected getWebAcl(name: string): Promise<WAFV2.GetWebACLResponse>;
}
export {};

@@ -15,2 +15,5 @@ "use strict";

},
Rules: {
type: 'string',
},
},

@@ -28,4 +31,5 @@ required: ['Name', 'MetricName'],

}
async createResource(physicalResourceId, { Name, MetricName }) {
async createResource(physicalResourceId, { Name, MetricName, Rules }) {
var _a, _b, _c, _d;
const rules = JSON.parse(Rules);
const webACLParams = {

@@ -37,2 +41,3 @@ Name,

},
Rules: rules,
VisibilityConfig: {

@@ -78,9 +83,21 @@ MetricName,

}
async updateResource(physicalResourceId, { Name }) {
async updateResource(physicalResourceId, { Name, Rules }) {
var _a, _b;
const webAcl = await this.getWebAcl(Name);
if (!webAcl.WebACL) {
throw new Error(`WAF V2 is not found ${Name}`);
if (!webAcl.WebACL || !webAcl.LockToken) {
throw new Error(`WAF V2 is not able to update ${Name}`);
}
console.warn(`WAF V2 is not updatable. You have to delete and create new one.`);
const rules = JSON.parse(Rules);
const updateWebAclParams = {
Id: webAcl.WebACL.Id,
Name,
Description: webAcl.WebACL.Description || '',
DefaultAction: webAcl.WebACL.DefaultAction,
Scope: SCOPE,
Rules: rules,
VisibilityConfig: webAcl.WebACL.VisibilityConfig,
LockToken: webAcl.LockToken,
};
await this.wafV2.updateWebACL(updateWebAclParams).promise();
console.warn(`WAF V2 is updated ${Name}`);
return {

@@ -87,0 +104,0 @@ physicalResourceId,

{
"name": "@collaborne/custom-cloudformation-resources",
"version": "0.5.17",
"version": "0.5.18",
"description": "Custom CloudFormation resources",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -7,2 +7,3 @@ import { WAFV2 } from 'aws-sdk';

import { Logger } from '../logger';
import { Rules } from 'aws-sdk/clients/wafv2';

@@ -18,2 +19,5 @@ const SCHEMA = {

},
Rules: {
type: 'string' as const,
},
},

@@ -46,4 +50,5 @@ required: ['Name', 'MetricName'],

physicalResourceId: string,
{ Name, MetricName }: SchemaType<typeof SCHEMA>,
{ Name, MetricName, Rules }: SchemaType<typeof SCHEMA>,
): Promise<Response<ResourceAttributes>> {
const rules: Rules = JSON.parse(Rules);
const webACLParams = {

@@ -55,2 +60,3 @@ Name,

},
Rules: rules,
VisibilityConfig: {

@@ -108,14 +114,27 @@ MetricName,

physicalResourceId: string,
{ Name }: SchemaType<typeof SCHEMA>,
{ Name, Rules }: SchemaType<typeof SCHEMA>,
): Promise<Response<ResourceAttributes>> {
const webAcl = await this.getWebAcl(Name);
if (!webAcl.WebACL) {
throw new Error(`WAF V2 is not found ${Name}`);
if (!webAcl.WebACL || !webAcl.LockToken) {
throw new Error(`WAF V2 is not able to update ${Name}`);
}
console.warn(
`WAF V2 is not updatable. You have to delete and create new one.`,
);
const rules: Rules = JSON.parse(Rules);
const updateWebAclParams = {
Id: webAcl.WebACL.Id,
Name,
Description: webAcl.WebACL.Description || '',
DefaultAction: webAcl.WebACL.DefaultAction,
Scope: SCOPE,
Rules: rules,
VisibilityConfig: webAcl.WebACL.VisibilityConfig,
LockToken: webAcl.LockToken,
};
await this.wafV2.updateWebACL(updateWebAclParams).promise();
console.warn(`WAF V2 is updated ${Name}`);
return {

@@ -122,0 +141,0 @@ physicalResourceId,

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc