Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ const constants = {
// for external backends, don't call unless at least 1 minute
// (60,000 milliseconds) since last call
externalBackendHealthCheckInterval: 60000,
versioningNotImplBackends: { azure: true, gcp: true },
versioningNotImplBackends: { azure: true },
mpuMDStoredExternallyBackend: { aws_s3: true, gcp: true },
skipBatchDeleteBackends: { azure: true, gcp: true },
s3HandledBackends: { azure: true, gcp: true },
Expand Down
6 changes: 4 additions & 2 deletions lib/api/apiUtils/object/createAndStoreObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const {
const { externalBackends, versioningNotImplBackends } = constants;

const externalVersioningErrorMessage =
'We do not currently support putting a versioned object to a location-constraint of type Azure or GCP.';
'We do not currently support putting a versioned object to a location-constraint of type Azure.';

/**
* Validate and compute the checksum for a zero-size object body.
Expand Down Expand Up @@ -309,7 +309,9 @@ function createAndStoreObject(
}
}

const headerChecksum = getChecksumDataFromHeaders(request.headers);
// A delete marker has no body: an x-amz-checksum-* header
// describes the request payload (e.g. a multi-object delete XML).
const headerChecksum = isDeleteMarker ? null : getChecksumDataFromHeaders(request.headers);
if (headerChecksum && headerChecksum.error) {
return next(arsenalErrorFromChecksumError(headerChecksum));
}
Expand Down
2 changes: 1 addition & 1 deletion lib/api/bucketPutVersioning.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const { config } = require('../Config');
const monitoring = require('../utilities/monitoringHandler');

const externalVersioningErrorMessage = 'We do not currently support putting ' +
'a versioned object to a location-constraint of type Azure or GCP.';
'a versioned object to a location-constraint of type Azure.';

const replicationVersioningErrorMessage = 'A replication configuration is ' +
'present on this bucket, so you cannot change the versioning state. To ' +
Expand Down
2 changes: 1 addition & 1 deletion lib/api/multiObjectDelete.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ function getObjMetadataAndDelete(authInfo, canonicalID, request,
objMD, authInfo, canonicalID, null, request,
deleteInfo.newDeleteMarker, null, overheadField, log,
's3:ObjectRemoved:DeleteMarkerCreated', (err, result) =>
callback(err, objMD, deleteInfo, result.versionId));
callback(err, objMD, deleteInfo, result?.versionId));
},
], (err, objMD, deleteInfo, versionId) => {
if (err === skipError) {
Expand Down
2 changes: 1 addition & 1 deletion lib/api/objectCopy.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const versionIdUtils = versioning.VersionID;
const locationHeader = constants.objectLocationConstraintHeader;
const versioningNotImplBackends = constants.versioningNotImplBackends;
const externalVersioningErrorMessage =
'We do not currently support putting a versioned object to a location-constraint of type AWS or Azure or GCP.';
'We do not currently support putting a versioned object to a location-constraint of type Azure.';

/**
* Compute the prior data locations that are orphaned.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@opentelemetry/instrumentation-ioredis": "~0.64.0",
"@opentelemetry/instrumentation-mongodb": "~0.69.0",
"@smithy/node-http-handler": "^3.0.0",
"arsenal": "git+https://github.com/scality/arsenal#8.5.6",
"arsenal": "git+https://github.com/scality/arsenal#9d4bffafa667e3aafc31355ede3bf7af93d1930e",
"async": "2.6.4",
"aws-crt": "^1.24.0",
"bucketclient": "scality/bucketclient#8.2.7",
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/api/bucketPutVersioning.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const xmlReplicationConfiguration =
'</ReplicationConfiguration>';

const externalVersioningErrorMessage = 'We do not currently support putting ' +
'a versioned object to a location-constraint of type Azure or GCP.';
'a versioned object to a location-constraint of type Azure.';

const log = new DummyRequestLogger();
const bucketName = 'bucketname';
Expand Down
38 changes: 38 additions & 0 deletions tests/unit/api/createAndStoreObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const { storage } = require('arsenal');
const sinon = require('sinon');

const { bucketPut } = require('../../../lib/api/bucketPut');
const { data } = require('../../../lib/data/wrapper');
const { cleanup, DummyRequestLogger, makeAuthInfo } = require('../helpers');
const metadata = require('../metadataswitch');
const rawCreateAndStoreObject = require('../../../lib/api/apiUtils/object/createAndStoreObject');
Expand Down Expand Up @@ -139,6 +140,43 @@ describe('createAndStoreObject', () => {
const objMD = await getObjectMDAsync(bucketName, objectKey, {});
assert(objMD.isDeleteMarker);
});

// The marker must still reach the backend, which uses it to drop the
// live version there.
it('should ignore the request checksum for a delete marker on an external location', async () => {
const putStub = sinon.stub(data.client, 'put').yields(null, 'key', 'versionId');
const externalBucket = 'test-bucket-external';
const bucketRequest = new DummyRequest({
bucketName: externalBucket,
namespace: 'default',
headers: { host: `${externalBucket}.s3.amazonaws.com` },
url: '/',
post: '<?xml version="1.0" encoding="UTF-8"?>' +
'<CreateBucketConfiguration ' +
'xmlns="http://s3.amazonaws.com/doc/2006-03-01/">' +
'<LocationConstraint>awsbackend</LocationConstraint>' +
'</CreateBucketConfiguration>',
});
await promisify(bucketPut)(authInfo, bucketRequest, log);
const bucket = await promisify(metadata.getBucket.bind(metadata))(externalBucket, log);

const request = new DummyRequest({
bucketName: externalBucket,
namespace: 'default',
objectKey,
headers: { 'x-amz-checksum-crc32': 'AAAAAQ==' },
url: `/${externalBucket}/${objectKey}`,
});

await createAndStoreObject(externalBucket, bucket, objectKey, null,
authInfo, canonicalID, null, request, true, null,
['overhead'], log, 's3:ObjectRemoved:DeleteMarkerCreated');

assert(putStub.calledOnce, 'delete marker must still reach the backend');
assert(putStub.firstCall.args[2].isDeleteMarker);
const objMD = await getObjectMDAsync(externalBucket, objectKey, {});
assert(objMD.isDeleteMarker);
});
});

describe('Archived object replacement', () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/multipleBackend/VersioningBackendClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ describe('AwsClient::copyObject', () => {
genTests.forEach(test => it(test.msg, done => {
testClient._supportsVersioning = test.input.supportsVersioning;
testClient._client.versioning = test.input.enableMockVersioning;
testClient.copyObject(copyObjectRequest, null, key,
testClient.copyObject(copyObjectRequest, null, key, undefined,
sourceLocationConstraint, null, config, log,
err => test.callback(err, done));
}));
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@aws-sdk/types" "^3.222.0"
tslib "^1.11.1"

"@aws-crypto/crc32@5.2.0", "@aws-crypto/crc32@^5.2.0":
"@aws-crypto/crc32@5.2.0":
version "5.2.0"
resolved "https://registry.yarnpkg.com/@aws-crypto/crc32/-/crc32-5.2.0.tgz#cfcc22570949c98c6689cfcbd2d693d36cdae2e1"
integrity sha512-nLbCWqQNgUiwwtFsen1AdzAtvuLRsQS8rYgMuxCrdKf9kOssamGLuPwyTY9wyYblNr9+1XM8v6zoDTPPSIeANg==
Expand All @@ -28,7 +28,7 @@
"@aws-sdk/types" "^3.222.0"
tslib "^2.6.2"

"@aws-crypto/crc32c@5.2.0", "@aws-crypto/crc32c@^5.2.0":
"@aws-crypto/crc32c@5.2.0":
version "5.2.0"
resolved "https://registry.yarnpkg.com/@aws-crypto/crc32c/-/crc32c-5.2.0.tgz#4e34aab7f419307821509a98b9b08e84e0c1917e"
integrity sha512-+iWb8qaHLYKrNvGRbiYRHSdKRWhto5XlZUEBwDjYNf+ly5SVYG6zEoYIdxvf5R3zyeP16w4PLBn3rH1xc74Rag==
Expand Down Expand Up @@ -6596,9 +6596,9 @@ arraybuffer.prototype.slice@^1.0.4:
optionalDependencies:
ioctl "^2.0.2"

"arsenal@git+https://github.com/scality/arsenal#8.5.6":
version "8.5.6"
resolved "git+https://github.com/scality/arsenal#0db557930c7d13204167188a7503e6e00d154df5"
"arsenal@git+https://github.com/scality/arsenal#9d4bffafa667e3aafc31355ede3bf7af93d1930e":
version "8.5.12"
resolved "git+https://github.com/scality/arsenal#9d4bffafa667e3aafc31355ede3bf7af93d1930e"
dependencies:
"@aws-sdk/client-kms" "^3.975.0"
"@aws-sdk/client-s3" "^3.975.0"
Expand Down
Loading