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

@mapbox/cloudfriend

Package Overview
Dependencies
Maintainers
14
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mapbox/cloudfriend - npm Package Compare versions

Comparing version 2.8.0 to 2.8.1

test/fixtures/shortcuts/service-role-no-url-suffix.json

4

changelog.md

@@ -0,1 +1,5 @@

# v2.8.1
- Implement a list of AWS service namespaces where use of `AWS::URLSuffix` results in an invalid service URL in China regions.
# v2.8.0

@@ -2,0 +6,0 @@

@@ -61,4 +61,26 @@ 'use strict';

const avoidSuffix = [
'apigateway',
'autoscaling',
'cloudformation',
'codedeploy',
'ecs-tasks',
'elasticbeanstalk',
'iot',
'lambda',
'rds',
'redshift',
's3',
'sms',
'storagegateway',
'swf'
];
const prefix = Service.replace(/\.amazonaws.com(\..*)?$/, '');
Service = {
'Fn::Sub': `${Service.replace(/\.amazonaws.com(\..*)?$/, '')}.\${AWS::URLSuffix}`
'Fn::Sub': avoidSuffix.includes(prefix)
? `${prefix}.amazonaws.com`
: `${prefix}.\${AWS::URLSuffix}`
};

@@ -65,0 +87,0 @@

2

package.json
{
"name": "@mapbox/cloudfriend",
"version": "2.8.0",
"version": "2.8.1",
"description": "Helper functions for assembling CloudFormation templates in JavaScript",

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

@@ -18,3 +18,3 @@ {

"Service": {
"Fn::Sub": "lambda.${AWS::URLSuffix}"
"Fn::Sub": "lambda.amazonaws.com"
}

@@ -21,0 +21,0 @@ }

@@ -36,3 +36,3 @@ {

"Service": {
"Fn::Sub": "lambda.${AWS::URLSuffix}"
"Fn::Sub": "lambda.amazonaws.com"
}

@@ -39,0 +39,0 @@ }

@@ -346,7 +346,7 @@ 'use strict';

template = cf.merge(role);
if (update) fixtures.update('service-role-suffix-replace', template);
if (update) fixtures.update('service-role-no-url-suffix', template);
assert.deepEqual(
noUndefined(template),
fixtures.get('service-role-suffix-replace'),
'expected resources generated, region-specific service suffix replaced'
fixtures.get('service-role-no-url-suffix'),
'expected resources generated, service for which AWS::URLSuffix is invalid'
);

@@ -356,2 +356,28 @@

LogicalName: 'MyRole',
Service: 'ec2'
});
template = cf.merge(role);
if (update) fixtures.update('service-role-url-suffix', template);
assert.deepEqual(
noUndefined(template),
fixtures.get('service-role-url-suffix'),
'expected resources generated, service for which AWS::URLSuffix is invalid'
);
role = new cf.shortcuts.ServiceRole({
LogicalName: 'MyRole',
Service: 'ec2.amazonaws.com'
});
template = cf.merge(role);
if (update) fixtures.update('service-role-url-suffix-with-replacement', template);
assert.deepEqual(
noUndefined(template),
fixtures.get('service-role-url-suffix-with-replacement'),
'expected resources generated, service for which AWS::URLSuffix is invalid specified with a suffix'
);
role = new cf.shortcuts.ServiceRole({
LogicalName: 'MyRole',
Service: 'lambda.amazonaws.com',

@@ -358,0 +384,0 @@ Statement: [

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