@@ -6,6 +6,11 @@ const withV4 = require('../support/withV4');
6
6
const BucketUtility = require ( '../../lib/utility/bucket-util' ) ;
7
7
const kms = require ( '../../../../../lib/kms/wrapper' ) ;
8
8
const { DummyRequestLogger } = require ( '../../../../unit/helpers' ) ;
9
+ const { config } = require ( '../../../../../lib/Config' ) ;
10
+ const { getKeyIdFromArn } = require ( 'arsenal/build/lib/network/KMSInterface' ) ;
11
+
12
+ // For this test env S3_CONFIG_FILE should be the same as running cloudserver
13
+ // to have the same config.kmsHideScalityArn value
9
14
10
15
const log = new DummyRequestLogger ( ) ;
11
16
@@ -55,7 +60,9 @@ function createExpected(sseConfig, kmsKeyId) {
55
60
}
56
61
57
62
if ( sseConfig . masterKeyId ) {
58
- expected . masterKeyId = kmsKeyId ;
63
+ expected . masterKeyId = config . kmsHideScalityArn
64
+ ? getKeyIdFromArn ( kmsKeyId )
65
+ : kmsKeyId ;
59
66
}
60
67
return expected ;
61
68
}
@@ -91,7 +98,7 @@ describe('per object encryption headers', () => {
91
98
const bucket = new BucketInfo ( 'enc-bucket-test' , 'OwnerId' ,
92
99
'OwnerDisplayName' , new Date ( ) . toJSON ( ) ) ;
93
100
kms . createBucketKey ( bucket , log ,
94
- ( err , { masterKeyId : keyId } ) => {
101
+ ( err , { masterKeyArn : keyId } ) => {
95
102
assert . ifError ( err ) ;
96
103
kmsKeyId = keyId ;
97
104
done ( ) ;
@@ -221,7 +228,9 @@ describe('per object encryption headers', () => {
221
228
done => {
222
229
const _existing = Object . assign ( { } , existing ) ;
223
230
if ( existing . masterKeyId ) {
224
- _existing . masterKeyId = kmsKeyId ;
231
+ _existing . masterKeyId = config . kmsHideScalityArn
232
+ ? getKeyIdFromArn ( kmsKeyId )
233
+ : kmsKeyId ;
225
234
}
226
235
const params = {
227
236
Bucket : bucket2 ,
0 commit comments