Skip to content

Commit

Permalink
fix(AWS APIGW): Fix default resource policy configuration
Browse files Browse the repository at this point in the history
Regression introduced with #7138
Fixes #7194 #7211
  • Loading branch information
medikoo committed Jan 14, 2020
1 parent de887ac commit 8814671
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 68 deletions.
21 changes: 1 addition & 20 deletions lib/plugins/aws/package/compile/events/apiGateway/lib/restApi.js
Expand Up @@ -3,23 +3,6 @@
const _ = require('lodash');
const BbPromise = require('bluebird');

const defaultPolicy = {
Version: '2012-10-17',
Statement: [
{
Effect: 'Allow',
Principal: '*',
Action: 'execute-api:Invoke',
Resource: ['execute-api:/*/*/*'],
Condition: {
IpAddress: {
'aws:SourceIp': ['0.0.0.0/0', '::/0'],
},
},
},
],
};

module.exports = {
compileRestApi() {
const apiGateway = this.serverless.service.provider.apiGateway || {};
Expand Down Expand Up @@ -87,9 +70,7 @@ module.exports = {
this.serverless.service.provider.compiledCloudFormationTemplate.Resources[
this.apiGatewayRestApiLogicalId
].Properties,
{
Policy: defaultPolicy,
}
{ Policy: '' }
);
}

Expand Down
Expand Up @@ -49,22 +49,7 @@ describe('#compileRestApi()', () => {
EndpointConfiguration: {
Types: ['EDGE'],
},
Policy: {
Statement: [
{
Action: 'execute-api:Invoke',
Condition: {
IpAddress: {
'aws:SourceIp': ['0.0.0.0/0', '::/0'],
},
},
Effect: 'Allow',
Principal: '*',
Resource: ['execute-api:/*/*/*'],
},
],
Version: '2012-10-17',
},
Policy: '',
},
});
}));
Expand Down Expand Up @@ -129,22 +114,7 @@ describe('#compileRestApi()', () => {
EndpointConfiguration: {
Types: ['EDGE'],
},
Policy: {
Version: '2012-10-17',
Statement: [
{
Effect: 'Allow',
Principal: '*',
Action: 'execute-api:Invoke',
Resource: ['execute-api:/*/*/*'],
Condition: {
IpAddress: {
'aws:SourceIp': ['0.0.0.0/0', '::/0'],
},
},
},
],
},
Policy: '',
},
});
});
Expand Down Expand Up @@ -178,22 +148,7 @@ describe('#compileRestApi()', () => {
Types: ['EDGE'],
},
Name: 'dev-new-service',
Policy: {
Statement: [
{
Action: 'execute-api:Invoke',
Condition: {
IpAddress: {
'aws:SourceIp': ['0.0.0.0/0', '::/0'],
},
},
Effect: 'Allow',
Principal: '*',
Resource: ['execute-api:/*/*/*'],
},
],
Version: '2012-10-17',
},
Policy: '',
},
});
});
Expand Down

0 comments on commit 8814671

Please sign in to comment.