Skip to content

Commit b8aa655

Browse files
CLDSRV-670: Check SSE KMS Key acces on createMPU
1 parent 612b824 commit b8aa655

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/api/initiateMultipartUpload.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const { setExpirationHeaders } = require('./apiUtils/object/expirationHeaders');
2222
const { data } = require('../data/wrapper');
2323
const { setSSEHeaders } = require('./apiUtils/object/sseHeaders');
2424
const { updateEncryption } = require('./apiUtils/bucket/updateEncryption');
25+
const kms = require('../kms/wrapper');
2526

2627
/*
2728
Sample xml response:
@@ -335,6 +336,14 @@ function initiateMultipartUpload(authInfo, request, log, callback) {
335336
return next(null, corsHeaders, destinationBucket, objectSSEConfig);
336337
}
337338
),
339+
// If SSE configured, test kms key encryption access, but ignore cipher bundle
340+
(corsHeaders, destinationBucket, objectSSEConfig, next) => {
341+
if (objectSSEConfig) {
342+
return kms.createCipherBundle(objectSSEConfig, log,
343+
(err) => next(err, corsHeaders, destinationBucket, objectSSEConfig));
344+
}
345+
return next(null, corsHeaders, destinationBucket, objectSSEConfig);
346+
},
338347
],
339348
(error, corsHeaders, destinationBucket, objectSSEConfig) => {
340349
if (error) {

0 commit comments

Comments
 (0)