Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test bucket updates #640

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
1 change: 0 additions & 1 deletion cloudformation/bucketName.js

This file was deleted.

67 changes: 0 additions & 67 deletions cloudformation/ci.template.js

This file was deleted.

98 changes: 36 additions & 62 deletions cloudformation/node-pre-gyp.template.js
Original file line number Diff line number Diff line change
@@ -1,75 +1,49 @@
'use strict';

const s3Template = require('@mapbox/s3-bucket-template');
const bucketName = require('./bucketName');

module.exports = s3Template.build({
BucketName: bucketName,
const bucket = s3Template.build({
BucketName: 'mapbox-node-pre-gyp-public-testing-bucket',
// We allow public access to objects IF they have been set to "public-read"
// node-pre-gyp sets public-read when publishing binaries:
// https://github.com/mapbox/node-pre-gyp/blob/eb1ec94913cbb72acbf2a4dc69896581d131fef8/lib/publish.js#L46-L51
PublicAccessBlock: false,
// The custom policy requires users to s3:PutObjectAcl when publishing
// binaries. Otherwise these objects cannot be downloaded by the public internet
// when installing.
BucketPolicy: {
'Type': 'AWS::S3::BucketPolicy',
'DependsOn': 'Bucket',
'Properties': {
'Bucket': bucketName,
'PolicyDocument': {
'Statement': [
Type: 'AWS::S3::BucketPolicy',
DependsOn: 'Bucket',
Properties: {
Bucket: 'mapbox-node-pre-gyp-public-testing-bucket',
PolicyDocument: {
Statement: [
{
'Sid': 'Prevent Changing Bucket ACL',
'Effect': 'Deny',
'Principal': {
'AWS': '*'
Sid: 'Deny changing the bucket ACL',
Effect: 'Deny',
Principal: {
AWS: '*'
},
'Action': [
's3:PutBucketAcl'
],
'Resource': [
{
'Fn::Join': [
'',
[
'arn:',
{
'Ref': 'AWS::Partition'
},
':s3:::',
bucketName
]
]
}
]
Action: 's3:PutBucketAcl',
Resource: 'arn:aws:s3:::mapbox-node-pre-gyp-public-testing-bucket'
},
{
'Sid': 'Allow setting Objects and ACLs, deleting, getting',
'Effect': 'Allow',
'Principal': {
'AWS': '*'
},
'Action': [
's3:DeleteObject',
's3:GetObject',
's3:GetObjectAcl',
's3:PutObject',
's3:PutObjectAcl'
],
'Resource': [
{
'Fn::Join': [
'',
[
'arn:',
{
'Ref': 'AWS::Partition'
},
':s3:::',
bucketName,
'/*'
]
]
}
]
}
// prevent deletions of any kind (human or application) on this bucket
// even though node-pre-gyp allows for binaries to be deleted, Mapbox
// intends to prevent them from being removed.
// {
// Sid: 'DenyDeletions',
// Effect: 'Deny',
// Principal: '*',
// Action: 's3:Delete*',
// Resource: [
// 'arn:aws:s3:::mapbox-node-pre-gyp-public-testing-bucket',
// 'arn:aws:s3:::mapbox-node-pre-gyp-public-testing-bucket/*'
// ]
// }
]
}
}
}
});
});

module.exports = bucket;
Loading