Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/bugfix/CLDSRV-494/fix-generate-v…
Browse files Browse the repository at this point in the history
…4-headers-for-put-with-body-requests' into w/7.70/bugfix/CLDSRV-494/fix-generate-v4-headers-for-put-with-body-requests
  • Loading branch information
fredmnl committed Jan 23, 2024
2 parents acc5f74 + 7162577 commit b481d24
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 42 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.70.21",
"arsenal": "git+https://github.com/scality/arsenal#7.70.22",
"async": "~2.5.0",
"aws-sdk": "2.905.0",
"azure-storage": "^2.1.0",
Expand Down Expand Up @@ -69,6 +69,7 @@
"ft_backbeat": "cd tests/functional/backbeat && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json -t 40000 *.js",
"ft_node": "cd tests/functional/raw-node && yarn test",
"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",
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/raw-node/test/lifecycle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()}`;
Expand Down
27 changes: 0 additions & 27 deletions tests/functional/raw-node/test/routes/routeBackbeat.js
Original file line number Diff line number Diff line change
Expand Up @@ -1237,7 +1237,6 @@ describeSkipIfAWS('backbeat routes', () => {
queryObj,
headers: {
'content-length': testData.length,
'content-md5': testDataMd5,
'x-scal-canonical-id': testArn,
},
authCredentials: backbeatAuthCredentials,
Expand Down Expand Up @@ -1294,7 +1293,6 @@ describeSkipIfAWS('backbeat routes', () => {
queryObj: { v2: '' },
headers: {
'content-length': testData.length,
'content-md5': testDataMd5,
'x-scal-canonical-id': testArn,
},
authCredentials: backbeatAuthCredentials,
Expand Down Expand Up @@ -1354,7 +1352,6 @@ describeSkipIfAWS('backbeat routes', () => {
queryObj: { v2: '' },
headers: {
'content-length': testData.length,
'content-md5': testDataMd5,
'x-scal-canonical-id': testArn,
},
authCredentials: backbeatAuthCredentials,
Expand Down Expand Up @@ -1387,7 +1384,6 @@ describeSkipIfAWS('backbeat routes', () => {
queryObj: { v2: '' },
headers: {
'content-length': testData.length,
'content-md5': testDataMd5,
},
authCredentials: backbeatAuthCredentials,
requestBody: testData,
Expand All @@ -1397,23 +1393,6 @@ describeSkipIfAWS('backbeat routes', () => {
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,
},
err => {
assert.strictEqual(err.code, 'BadRequest');
done();
}));

it('should refuse PUT in metadata-only mode if object does not exist',
done => {
async.waterfall([next => {
Expand Down Expand Up @@ -1447,7 +1426,6 @@ describeSkipIfAWS('backbeat routes', () => {
resourceType: 'data',
headers: {
'content-length': testData.length,
'content-md5': testDataMd5,
'x-scal-canonical-id': testArn,
},
authCredentials: backbeatAuthCredentials,
Expand Down Expand Up @@ -1492,7 +1470,6 @@ describeSkipIfAWS('backbeat routes', () => {
resourceType: 'data',
headers: {
'content-length': testData.length,
'content-md5': testDataMd5,
'x-scal-canonical-id': testArn,
},
authCredentials: backbeatAuthCredentials,
Expand Down Expand Up @@ -1548,7 +1525,6 @@ describeSkipIfAWS('backbeat routes', () => {
resourceType: 'data',
headers: {
'content-length': testData.length,
'content-md5': testDataMd5,
'x-scal-canonical-id': testArn,
},
authCredentials: backbeatAuthCredentials,
Expand Down Expand Up @@ -1634,7 +1610,6 @@ describeSkipIfAWS('backbeat routes', () => {
resourceType: 'data',
headers: {
'content-length': testData.length,
'content-md5': testDataMd5,
'x-scal-canonical-id': testArn,
},
authCredentials: backbeatAuthCredentials,
Expand Down Expand Up @@ -1685,7 +1660,6 @@ describeSkipIfAWS('backbeat routes', () => {
resourceType: 'data',
headers: {
'content-length': testData.length,
'content-md5': testDataMd5,
'x-scal-canonical-id': testArn,
},
authCredentials: backbeatAuthCredentials,
Expand Down Expand Up @@ -1716,7 +1690,6 @@ describeSkipIfAWS('backbeat routes', () => {
resourceType: 'data',
headers: {
'content-length': testData.length,
'content-md5': testDataMd5,
'x-scal-canonical-id': testArn,
},
authCredentials: backbeatAuthCredentials,
Expand Down
14 changes: 5 additions & 9 deletions tests/functional/raw-node/utils/makeRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -494,9 +494,9 @@ arraybuffer.slice@~0.0.7:
optionalDependencies:
ioctl "^2.0.2"

"arsenal@git+https://github.com/scality/arsenal#7.70.21":
version "7.70.21"
resolved "git+https://github.com/scality/arsenal#5734d11cf1e1ba5b7f485285a249fa7c748f0e47"
"arsenal@git+https://github.com/scality/arsenal#7.70.22":
version "7.70.22"
resolved "git+https://github.com/scality/arsenal#918c2c54735d5ccea7410e2f24f9fb2b8b33ba68"
dependencies:
"@types/async" "^3.2.12"
"@types/utf8" "^3.0.1"
Expand Down

0 comments on commit b481d24

Please sign in to comment.