Compare commits
3 Commits
developmen
...
bugfix/CLD
Author | SHA1 | Date |
---|---|---|
Frédéric Meinnel | 11af6a4f0e | |
Frédéric Meinnel | 97e4714219 | |
Frédéric Meinnel | 9ed9e6c834 |
|
@ -20,7 +20,7 @@
|
||||||
"homepage": "https://github.com/scality/S3#readme",
|
"homepage": "https://github.com/scality/S3#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@hapi/joi": "^17.1.0",
|
"@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",
|
"async": "~2.5.0",
|
||||||
"aws-sdk": "2.905.0",
|
"aws-sdk": "2.905.0",
|
||||||
"azure-storage": "^2.1.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_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_management": "cd tests/functional/report && yarn test",
|
||||||
"ft_node": "cd tests/functional/raw-node && 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_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_gcp": "cd tests/functional/raw-node && yarn run test-gcp",
|
||||||
"ft_healthchecks": "cd tests/functional/healthchecks && yarn test",
|
"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",
|
"ft_s3cmd": "cd tests/functional/s3cmd && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json -t 40000 *.js",
|
||||||
|
|
|
@ -4,8 +4,8 @@ const { makeS3Request } = require('../utils/makeRequest');
|
||||||
const { randomUUID } = require('crypto');
|
const { randomUUID } = require('crypto');
|
||||||
|
|
||||||
const authCredentials = {
|
const authCredentials = {
|
||||||
accessKey: process.env.AWS_ON_AIR ? 'awsAK' : 'accessKey1',
|
accessKey: process.env.AWS_ON_AIR ? process.env.AWS_ON_AIR_AK : 'accessKey1',
|
||||||
secretKey: process.env.AWS_ON_AIR ? 'awsSK' : 'verySecretKey1',
|
secretKey: process.env.AWS_ON_AIR ? process.env.AWS_ON_AIR_SK : 'verySecretKey1',
|
||||||
};
|
};
|
||||||
|
|
||||||
const bucket = `rawnodelifecyclebucket-${randomUUID()}`;
|
const bucket = `rawnodelifecyclebucket-${randomUUID()}`;
|
||||||
|
|
|
@ -1237,7 +1237,6 @@ describeSkipIfAWS('backbeat routes', () => {
|
||||||
queryObj,
|
queryObj,
|
||||||
headers: {
|
headers: {
|
||||||
'content-length': testData.length,
|
'content-length': testData.length,
|
||||||
'content-md5': testDataMd5,
|
|
||||||
'x-scal-canonical-id': testArn,
|
'x-scal-canonical-id': testArn,
|
||||||
},
|
},
|
||||||
authCredentials: backbeatAuthCredentials,
|
authCredentials: backbeatAuthCredentials,
|
||||||
|
@ -1294,7 +1293,6 @@ describeSkipIfAWS('backbeat routes', () => {
|
||||||
queryObj: { v2: '' },
|
queryObj: { v2: '' },
|
||||||
headers: {
|
headers: {
|
||||||
'content-length': testData.length,
|
'content-length': testData.length,
|
||||||
'content-md5': testDataMd5,
|
|
||||||
'x-scal-canonical-id': testArn,
|
'x-scal-canonical-id': testArn,
|
||||||
},
|
},
|
||||||
authCredentials: backbeatAuthCredentials,
|
authCredentials: backbeatAuthCredentials,
|
||||||
|
@ -1354,7 +1352,6 @@ describeSkipIfAWS('backbeat routes', () => {
|
||||||
queryObj: { v2: '' },
|
queryObj: { v2: '' },
|
||||||
headers: {
|
headers: {
|
||||||
'content-length': testData.length,
|
'content-length': testData.length,
|
||||||
'content-md5': testDataMd5,
|
|
||||||
'x-scal-canonical-id': testArn,
|
'x-scal-canonical-id': testArn,
|
||||||
},
|
},
|
||||||
authCredentials: backbeatAuthCredentials,
|
authCredentials: backbeatAuthCredentials,
|
||||||
|
@ -1387,24 +1384,6 @@ describeSkipIfAWS('backbeat routes', () => {
|
||||||
queryObj: { v2: '' },
|
queryObj: { v2: '' },
|
||||||
headers: {
|
headers: {
|
||||||
'content-length': testData.length,
|
'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,
|
authCredentials: backbeatAuthCredentials,
|
||||||
requestBody: testData,
|
requestBody: testData,
|
||||||
|
@ -1447,7 +1426,6 @@ describeSkipIfAWS('backbeat routes', () => {
|
||||||
resourceType: 'data',
|
resourceType: 'data',
|
||||||
headers: {
|
headers: {
|
||||||
'content-length': testData.length,
|
'content-length': testData.length,
|
||||||
'content-md5': testDataMd5,
|
|
||||||
'x-scal-canonical-id': testArn,
|
'x-scal-canonical-id': testArn,
|
||||||
},
|
},
|
||||||
authCredentials: backbeatAuthCredentials,
|
authCredentials: backbeatAuthCredentials,
|
||||||
|
@ -1492,7 +1470,6 @@ describeSkipIfAWS('backbeat routes', () => {
|
||||||
resourceType: 'data',
|
resourceType: 'data',
|
||||||
headers: {
|
headers: {
|
||||||
'content-length': testData.length,
|
'content-length': testData.length,
|
||||||
'content-md5': testDataMd5,
|
|
||||||
'x-scal-canonical-id': testArn,
|
'x-scal-canonical-id': testArn,
|
||||||
},
|
},
|
||||||
authCredentials: backbeatAuthCredentials,
|
authCredentials: backbeatAuthCredentials,
|
||||||
|
@ -1548,7 +1525,6 @@ describeSkipIfAWS('backbeat routes', () => {
|
||||||
resourceType: 'data',
|
resourceType: 'data',
|
||||||
headers: {
|
headers: {
|
||||||
'content-length': testData.length,
|
'content-length': testData.length,
|
||||||
'content-md5': testDataMd5,
|
|
||||||
'x-scal-canonical-id': testArn,
|
'x-scal-canonical-id': testArn,
|
||||||
},
|
},
|
||||||
authCredentials: backbeatAuthCredentials,
|
authCredentials: backbeatAuthCredentials,
|
||||||
|
@ -1634,7 +1610,6 @@ describeSkipIfAWS('backbeat routes', () => {
|
||||||
resourceType: 'data',
|
resourceType: 'data',
|
||||||
headers: {
|
headers: {
|
||||||
'content-length': testData.length,
|
'content-length': testData.length,
|
||||||
'content-md5': testDataMd5,
|
|
||||||
'x-scal-canonical-id': testArn,
|
'x-scal-canonical-id': testArn,
|
||||||
},
|
},
|
||||||
authCredentials: backbeatAuthCredentials,
|
authCredentials: backbeatAuthCredentials,
|
||||||
|
@ -1685,7 +1660,6 @@ describeSkipIfAWS('backbeat routes', () => {
|
||||||
resourceType: 'data',
|
resourceType: 'data',
|
||||||
headers: {
|
headers: {
|
||||||
'content-length': testData.length,
|
'content-length': testData.length,
|
||||||
'content-md5': testDataMd5,
|
|
||||||
'x-scal-canonical-id': testArn,
|
'x-scal-canonical-id': testArn,
|
||||||
},
|
},
|
||||||
authCredentials: backbeatAuthCredentials,
|
authCredentials: backbeatAuthCredentials,
|
||||||
|
@ -1716,7 +1690,6 @@ describeSkipIfAWS('backbeat routes', () => {
|
||||||
resourceType: 'data',
|
resourceType: 'data',
|
||||||
headers: {
|
headers: {
|
||||||
'content-length': testData.length,
|
'content-length': testData.length,
|
||||||
'content-md5': testDataMd5,
|
|
||||||
'x-scal-canonical-id': testArn,
|
'x-scal-canonical-id': testArn,
|
||||||
},
|
},
|
||||||
authCredentials: backbeatAuthCredentials,
|
authCredentials: backbeatAuthCredentials,
|
||||||
|
|
|
@ -111,18 +111,14 @@ function makeRequest(params, callback) {
|
||||||
// decode path because signing code re-encodes it
|
// decode path because signing code re-encodes it
|
||||||
req.path = _decodeURI(encodedPath);
|
req.path = _decodeURI(encodedPath);
|
||||||
if (authCredentials && !params.GCP) {
|
if (authCredentials && !params.GCP) {
|
||||||
if (queryObj) {
|
auth.client.generateV4Headers(req, queryObj || '',
|
||||||
auth.client.generateV4Headers(req, queryObj,
|
authCredentials.accessKey, authCredentials.secretKey, 's3', undefined, undefined, requestBody);
|
||||||
authCredentials.accessKey, authCredentials.secretKey, 's3');
|
|
||||||
// may update later if request may contain POST body
|
|
||||||
} else {
|
|
||||||
auth.client.generateV4Headers(req, '', authCredentials.accessKey,
|
|
||||||
authCredentials.secretKey, 's3');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// restore original URL-encoded path
|
// restore original URL-encoded path
|
||||||
req.path = encodedPath;
|
req.path = encodedPath;
|
||||||
req.path = queryObj ? `${options.path}?${qs}` : req.path;
|
if (queryObj) {
|
||||||
|
req.path = `${options.path}?${qs}`;
|
||||||
|
}
|
||||||
if (requestBody) {
|
if (requestBody) {
|
||||||
req.write(requestBody);
|
req.write(requestBody);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue