Compare commits

...

3 Commits

Author SHA1 Message Date
Frédéric Meinnel 11af6a4f0e [DROP ME] Add a few shortcuts to test against cloudserver and against aws s3 2024-01-19 11:13:01 +01:00
Frédéric Meinnel 97e4714219 [DROP ME] Using dev version of arsenal
This reverts commit d66c838d373d6afc05aaa18d1735fcdb5b257551.
2024-01-19 11:13:01 +01:00
Frédéric Meinnel 9ed9e6c834 CLDSRV-493: Fix generateV4Headers for HTTP PUT with body 2024-01-18 16:55:04 +01:00
5 changed files with 470 additions and 219 deletions

View File

@ -20,7 +20,7 @@
"homepage": "https://github.com/scality/S3#readme",
"dependencies": {
"@hapi/joi": "^17.1.0",
"arsenal": "git+https://github.com/scality/arsenal#7.10.55",
"arsenal": "git+https://github.com/scality/arsenal#bugfix/ARSN-386/fix-generate-v4-headers-for-put-with-body-requests",
"async": "~2.5.0",
"aws-sdk": "2.905.0",
"azure-storage": "^2.1.0",
@ -66,7 +66,10 @@
"ft_awssdk_external_backends": "cd tests/functional/aws-node-sdk && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json test/multipleBackend",
"ft_management": "cd tests/functional/report && yarn test",
"ft_node": "cd tests/functional/raw-node && yarn test",
"ft_node_lifecycle": "cd tests/functional/raw-node && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json -t 40000 test/lifecycle.js",
"ft_node_lifecycle_aws": "cd tests/functional/raw-node && AWS_ON_AIR=true mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json -t 40000 test/lifecycle.js",
"ft_node_routes": "cd tests/functional/raw-node && yarn run test-routes",
"ft_node_route_backbeat": "cd tests/functional/raw-node && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json -t 40000 test/routes/routeBackbeat.js",
"ft_gcp": "cd tests/functional/raw-node && yarn run test-gcp",
"ft_healthchecks": "cd tests/functional/healthchecks && yarn test",
"ft_s3cmd": "cd tests/functional/s3cmd && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json -t 40000 *.js",

View File

@ -4,8 +4,8 @@ const { makeS3Request } = require('../utils/makeRequest');
const { randomUUID } = require('crypto');
const authCredentials = {
accessKey: process.env.AWS_ON_AIR ? 'awsAK' : 'accessKey1',
secretKey: process.env.AWS_ON_AIR ? 'awsSK' : 'verySecretKey1',
accessKey: process.env.AWS_ON_AIR ? process.env.AWS_ON_AIR_AK : 'accessKey1',
secretKey: process.env.AWS_ON_AIR ? process.env.AWS_ON_AIR_SK : 'verySecretKey1',
};
const bucket = `rawnodelifecyclebucket-${randomUUID()}`;

View File

@ -1237,7 +1237,6 @@ describeSkipIfAWS('backbeat routes', () => {
queryObj,
headers: {
'content-length': testData.length,
'content-md5': testDataMd5,
'x-scal-canonical-id': testArn,
},
authCredentials: backbeatAuthCredentials,
@ -1294,7 +1293,6 @@ describeSkipIfAWS('backbeat routes', () => {
queryObj: { v2: '' },
headers: {
'content-length': testData.length,
'content-md5': testDataMd5,
'x-scal-canonical-id': testArn,
},
authCredentials: backbeatAuthCredentials,
@ -1354,7 +1352,6 @@ describeSkipIfAWS('backbeat routes', () => {
queryObj: { v2: '' },
headers: {
'content-length': testData.length,
'content-md5': testDataMd5,
'x-scal-canonical-id': testArn,
},
authCredentials: backbeatAuthCredentials,
@ -1387,24 +1384,6 @@ describeSkipIfAWS('backbeat routes', () => {
queryObj: { v2: '' },
headers: {
'content-length': testData.length,
'content-md5': testDataMd5,
},
authCredentials: backbeatAuthCredentials,
requestBody: testData,
},
err => {
assert.strictEqual(err.code, 'BadRequest');
done();
}));
it('should refuse PUT data if no content-md5 header is provided',
done => makeBackbeatRequest({
method: 'PUT', bucket: TEST_BUCKET,
objectKey: testKey, resourceType: 'data',
queryObj: { v2: '' },
headers: {
'content-length': testData.length,
'x-scal-canonical-id': testArn,
},
authCredentials: backbeatAuthCredentials,
requestBody: testData,
@ -1447,7 +1426,6 @@ describeSkipIfAWS('backbeat routes', () => {
resourceType: 'data',
headers: {
'content-length': testData.length,
'content-md5': testDataMd5,
'x-scal-canonical-id': testArn,
},
authCredentials: backbeatAuthCredentials,
@ -1492,7 +1470,6 @@ describeSkipIfAWS('backbeat routes', () => {
resourceType: 'data',
headers: {
'content-length': testData.length,
'content-md5': testDataMd5,
'x-scal-canonical-id': testArn,
},
authCredentials: backbeatAuthCredentials,
@ -1548,7 +1525,6 @@ describeSkipIfAWS('backbeat routes', () => {
resourceType: 'data',
headers: {
'content-length': testData.length,
'content-md5': testDataMd5,
'x-scal-canonical-id': testArn,
},
authCredentials: backbeatAuthCredentials,
@ -1634,7 +1610,6 @@ describeSkipIfAWS('backbeat routes', () => {
resourceType: 'data',
headers: {
'content-length': testData.length,
'content-md5': testDataMd5,
'x-scal-canonical-id': testArn,
},
authCredentials: backbeatAuthCredentials,
@ -1685,7 +1660,6 @@ describeSkipIfAWS('backbeat routes', () => {
resourceType: 'data',
headers: {
'content-length': testData.length,
'content-md5': testDataMd5,
'x-scal-canonical-id': testArn,
},
authCredentials: backbeatAuthCredentials,
@ -1716,7 +1690,6 @@ describeSkipIfAWS('backbeat routes', () => {
resourceType: 'data',
headers: {
'content-length': testData.length,
'content-md5': testDataMd5,
'x-scal-canonical-id': testArn,
},
authCredentials: backbeatAuthCredentials,

View File

@ -111,18 +111,14 @@ function makeRequest(params, callback) {
// decode path because signing code re-encodes it
req.path = _decodeURI(encodedPath);
if (authCredentials && !params.GCP) {
if (queryObj) {
auth.client.generateV4Headers(req, queryObj,
authCredentials.accessKey, authCredentials.secretKey, 's3');
// may update later if request may contain POST body
} else {
auth.client.generateV4Headers(req, '', authCredentials.accessKey,
authCredentials.secretKey, 's3');
}
auth.client.generateV4Headers(req, queryObj || '',
authCredentials.accessKey, authCredentials.secretKey, 's3', undefined, undefined, requestBody);
}
// restore original URL-encoded path
req.path = encodedPath;
req.path = queryObj ? `${options.path}?${qs}` : req.path;
if (queryObj) {
req.path = `${options.path}?${qs}`;
}
if (requestBody) {
req.write(requestBody);
}

639
yarn.lock

File diff suppressed because it is too large Load Diff