@mapbox/cloudfriend
Advanced tools
Comparing version 2.8.0 to 2.8.1
@@ -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 @@ |
{ | ||
"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: [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
277529
61
7502
1