Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feature/S3C-3748_add_PutBucketEn…
Browse files Browse the repository at this point in the history
…cyption_handler' into w/8.1/feature/S3C-3748_add_PutBucketEncyption_handler
  • Loading branch information
tmacro committed Apr 29, 2021
2 parents 2a78d4f + 990987b commit d572fc9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/models/BucketInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const NotificationConfiguration = require('./NotificationConfiguration');

// WHEN UPDATING THIS NUMBER, UPDATE MODELVERSION.MD CHANGELOG
// MODELVERSION.MD can be found in S3 repo: lib/metadata/ModelVersion.md
const modelVersion = 13;
const modelVersion = 14;

class BucketInfo {
/**
Expand All @@ -33,6 +33,8 @@ class BucketInfo {
* algorithm to use
* @param {string} serverSideEncryption.masterKeyId -
* key to get master key
* @param {string} serverSideEncryption.configuredMasterKeyId -
* custom KMS key id specified by user
* @param {boolean} serverSideEncryption.mandatory -
* true for mandatory encryption
* bucket has been made
Expand Down Expand Up @@ -90,12 +92,15 @@ class BucketInfo {
}
if (serverSideEncryption) {
assert.strictEqual(typeof serverSideEncryption, 'object');
const { cryptoScheme, algorithm, masterKeyId, mandatory } =
serverSideEncryption;
const { cryptoScheme, algorithm, masterKeyId,
configuredMasterKeyId, mandatory } = serverSideEncryption;
assert.strictEqual(typeof cryptoScheme, 'number');
assert.strictEqual(typeof algorithm, 'string');
assert.strictEqual(typeof masterKeyId, 'string');
assert.strictEqual(typeof mandatory, 'boolean');
if (configuredMasterKeyId !== undefined) {
assert.strictEqual(typeof configuredMasterKeyId, 'string');
}
}
if (versioningConfiguration) {
assert.strictEqual(typeof versioningConfiguration, 'object');
Expand Down
2 changes: 2 additions & 0 deletions lib/policyEvaluator/utils/actionMaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const sharedActionMap = {
bucketHead: 's3:ListBucket',
bucketPutACL: 's3:PutBucketAcl',
bucketPutCors: 's3:PutBucketCORS',
bucketPutEncryption: 'PutBucketEncryption',
bucketPutLifecycle: 's3:PutLifecycleConfiguration',
bucketPutNotification: 's3:PutBucketNotificationConfiguration',
bucketPutObjectLock: 's3:PutBucketObjectLockConfiguration',
Expand Down Expand Up @@ -104,6 +105,7 @@ const actionMonitoringMapS3 = {
bucketPutPolicy: 'PutBucketPolicy',
bucketPutReplication: 'PutBucketReplication',
bucketPutVersioning: 'PutBucketVersioning',
bucketPutEncryption: 'PutBucketEncryption',
bucketPutWebsite: 'PutBucketWebsite',
completeMultipartUpload: 'CompleteMultipartUpload',
initiateMultipartUpload: 'CreateMultipartUpload',
Expand Down
7 changes: 7 additions & 0 deletions lib/s3routes/routes/routePUT.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ function routePUT(request, response, api, log, statsClient) {
routesUtils.responseNoBody(err, corsHeaders, response, 200,
log);
});
} else if (request.query.encryption !== undefined) {
api.callApiMethod('bucketPutEncryption', request, response, log,
(err, corsHeaders) => {
routesUtils.statsReport500(err, statsClient);
return routesUtils.responseNoBody(err, corsHeaders,
response, 200, log);
});
} else {
// PUT bucket
return api.callApiMethod('bucketPut', request, response, log,
Expand Down

0 comments on commit d572fc9

Please sign in to comment.