Skip to content

Commit 1ca5ec8

Browse files
committed
CLDSRV-744: add config variable to disable PutObjectRetention checksum check
1 parent 0dfee33 commit 1ca5ec8

3 files changed

Lines changed: 74 additions & 0 deletions

File tree

config.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,5 +142,8 @@
142142
},
143143
"kmip": {
144144
"providerName": "thales"
145+
},
146+
"integrityChecks": {
147+
"objectPutRetention": true
145148
}
146149
}

lib/Config.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,37 @@ function bucketNotifAssert(bucketNotifConfig) {
533533
return bucketNotifConfig;
534534
}
535535

536+
function parseIntegrityChecks(config) {
537+
const integrityChecks = {
538+
'bucketPutACL': true,
539+
'bucketPutCors': true,
540+
'bucketPutEncryption': true,
541+
'bucketPutLifecycle': true,
542+
'bucketPutNotification': true,
543+
'bucketPutObjectLock': true,
544+
'bucketPutPolicy': true,
545+
'bucketPutReplication': true,
546+
'bucketPutVersioning': true,
547+
'bucketPutWebsite': true,
548+
'multiObjectDelete': true,
549+
'objectPutACL': true,
550+
'objectPutLegalHold': true,
551+
'objectPutTagging': true,
552+
'objectPutRetention': true,
553+
};
554+
555+
if (config && config.integrityChecks) {
556+
for (const method in integrityChecks) {
557+
if (method in config.integrityChecks) {
558+
assert(typeof config.integrityChecks[method] == 'boolean', `bad config: ${method} not boolean`);
559+
integrityChecks[method] = config.integrityChecks[method];
560+
}
561+
}
562+
}
563+
564+
return integrityChecks;
565+
}
566+
536567
/**
537568
* Reads from a config file and returns the content as a config object
538569
*/
@@ -1743,6 +1774,8 @@ class Config extends EventEmitter {
17431774

17441775
this.supportedLifecycleRules = parseSupportedLifecycleRules(config.supportedLifecycleRules);
17451776

1777+
this.integrityChecks = parseIntegrityChecks(config);
1778+
17461779
/**
17471780
* S3C-10336: PutObject max size of 5GB is new in 9.5.1
17481781
* Provides a way to bypass the new validation if it breaks customer workflows
@@ -2081,4 +2114,5 @@ module.exports = {
20812114
azureGetStorageAccountName,
20822115
azureGetLocationCredentials,
20832116
parseSupportedLifecycleRules,
2117+
parseIntegrityChecks,
20842118
};

tests/unit/Config.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const {
77
azureGetLocationCredentials,
88
locationConstraintAssert,
99
parseSupportedLifecycleRules,
10+
parseIntegrityChecks,
1011
ConfigObject,
1112
} = require('../../lib/Config');
1213

@@ -885,4 +886,40 @@ describe('Config', () => {
885886
assert.strictEqual(config.instanceId.length, 6);
886887
});
887888
});
889+
890+
describe('parse integrity checks', () => {
891+
it('should replace default values with new values', () => {
892+
const newConfig = {
893+
integrityChecks: {
894+
'bucketPutACL': false,
895+
'bucketPutCors': false,
896+
'bucketPutEncryption': false,
897+
'bucketPutLifecycle': false,
898+
'bucketPutNotification': false,
899+
'bucketPutObjectLock': false,
900+
'bucketPutPolicy': false,
901+
'bucketPutReplication': false,
902+
'bucketPutVersioning': false,
903+
'bucketPutWebsite': false,
904+
'multiObjectDelete': false,
905+
'objectPutACL': false,
906+
'objectPutLegalHold': false,
907+
'objectPutTagging': false,
908+
'objectPutRetention': false,
909+
},
910+
};
911+
912+
const result = parseIntegrityChecks(newConfig);
913+
for (const method in result) {
914+
assert(result[method] == false, method);
915+
}
916+
});
917+
918+
it('default method value is true', () => {
919+
const result = parseIntegrityChecks(null);
920+
for (const method in result) {
921+
assert(result[method] == true, method);
922+
}
923+
});
924+
});
888925
});

0 commit comments

Comments
 (0)