Skip to content

Commit 051a2d8

Browse files
committed
Merge remote-tracking branch 'origin/w/9.2/feature/CLDSRV-812/list-objects-v2-optional-permissions' into w/9.3/feature/CLDSRV-812/list-objects-v2-optional-permissions
2 parents c931c94 + 146226a commit 051a2d8

File tree

9 files changed

+392
-111
lines changed

9 files changed

+392
-111
lines changed

docs/RELEASE.md

Lines changed: 24 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -26,42 +26,33 @@ docker pull ghcr.io/scality/cloudserver:<tag>
2626

2727
To release a production image:
2828

29-
* Create a PR to bump the package version
30-
Update Cloudserver's `package.json` by bumping it to the relevant next
31-
version in a new PR. Per example if the last released version was
32-
`8.4.7`, the next version would be `8.4.8`.
33-
34-
```js
35-
{
36-
"name": "cloudserver",
37-
"version": "8.4.8", <--- Here
38-
[...]
39-
}
40-
```
29+
* Create a PR to bump the package version :
30+
update Cloudserver's `package.json` by bumping it to the relevant next
31+
version in a new PR. Per example if the last released version was `8.4.7`,
32+
the next version would be `8.4.8`.
33+
34+
```js
35+
{
36+
"name": "cloudserver",
37+
"version": "8.4.8", <--- Here
38+
[...]
39+
}
40+
```
4141

4242
* Review & merge the PR
4343

44-
* Create the release on GitHub
45-
46-
* Go the Release tab (https://github.com/scality/cloudserver/releases);
47-
* Click on the `Draft new release button`;
48-
* In the `tag` field, type the name of the release (`8.4.8`), and confirm
49-
to create the tag on publish;
50-
* Click on `Generate release notes` button to fill the fields;
51-
* Rename the release to `Release x.y.z` (e.g. `Release 8.4.8` in this case);
52-
* Click to `Publish the release` to create the GitHub release and git tag
53-
54-
Notes:
55-
* the Git tag will be created automatically.
56-
* this should be done as soon as the PR is merged, so that the tag
57-
is put on the "version bump" commit.
58-
59-
* With the following parameters, [force a build here](https://eve.devsca.com/github/scality/cloudserver/#/builders/3/force/force)
60-
61-
* Branch Name: The one used for the tag earlier. In this example `development/8.4`
62-
* Override Stage: 'release'
63-
* Extra properties:
64-
* name: `'tag'`, value: `[release version]`, in this example`'8.4.8'`
44+
* Trigger the release workflow on GitHub
45+
46+
* Go to the [**Actions** tab on GitHub](https://github.com/scality/cloudserver/actions)
47+
* Select the `release` workflow from the list
48+
* Click on **Run workflow** (manual dispatch)
49+
* Enter the new tag (e.g., `8.4.8`) in the input field
50+
* Start the workflow
51+
52+
This workflow will create the tag and push the Docker images.
53+
54+
This should be done as soon as the PR is merged,
55+
so that the tag is put on the "version bump" commit.
6556

6657
* Release the release version on Jira
6758

lib/api/apiUtils/authorization/prepareRequestContexts.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,15 @@ function prepareRequestContexts(apiMethod, request, sourceBucket,
252252
generateRequestContext('bypassGovernanceRetention');
253253
requestContexts.push(checkUserGovernanceBypassRequestContext);
254254
}
255+
} else if (apiMethodAfterVersionCheck === 'bucketGet') {
256+
requestContexts.push(generateRequestContext(apiMethodAfterVersionCheck));
257+
258+
const optionalAttributesHeader = request.headers['x-amz-optional-object-attributes'];
259+
const requestedAttributes = optionalAttributesHeader ? optionalAttributesHeader.split(',') : [];
260+
261+
if (requestedAttributes.filter(attr => attr != 'RestoreStatus').length > 0) {
262+
requestContexts.push(generateRequestContext('listObjectsV2OptionalAttributes'));
263+
}
255264
} else {
256265
const requestContext =
257266
generateRequestContext(apiMethodAfterVersionCheck);

lib/api/bucketGet.js

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,15 @@ function bucketGet(authInfo, request, log, callback) {
284284
const params = request.query;
285285
const bucketName = request.bucketName;
286286
const v2 = params['list-type'];
287+
288+
const optionalAttributes =
289+
request.headers['x-amz-optional-object-attributes']?.split(',').map(attr => attr.trim()) ?? [];
290+
if (optionalAttributes.some(attr => !attr.startsWith('x-amz-meta-') && attr != 'RestoreStatus')) {
291+
return callback(
292+
errorInstances.InvalidArgument.customizeDescription('Invalid attribute name specified')
293+
);
294+
}
295+
287296
if (v2 !== undefined && Number.parseInt(v2, 10) !== 2) {
288297
return callback(errorInstances.InvalidArgument.customizeDescription('Invalid ' +
289298
'List Type specified in Request'));
@@ -352,21 +361,22 @@ function bucketGet(authInfo, request, log, callback) {
352361
}
353362

354363
standardMetadataValidateBucket(metadataValParams, request.actionImplicitDenies, log, (err, bucket) => {
355-
const corsHeaders = collectCorsHeaders(request.headers.origin,
356-
request.method, bucket);
364+
const corsHeaders = collectCorsHeaders(request.headers.origin, request.method, bucket);
365+
357366
if (err) {
358367
log.debug('error processing request', { error: err });
359-
monitoring.promMetrics(
360-
'GET', bucketName, err.code, 'listBucket');
368+
monitoring.promMetrics('GET', bucketName, err.code, 'listBucket');
361369
return callback(err, null, corsHeaders);
362370
}
371+
363372
if (params.versions !== undefined) {
364373
listParams.listingType = 'DelimiterVersions';
365374
delete listParams.marker;
366375
listParams.keyMarker = params['key-marker'];
367376
listParams.versionIdMarker = params['version-id-marker'] ?
368377
versionIdUtils.decode(params['version-id-marker']) : undefined;
369378
}
379+
370380
if (!requestMaxKeys) {
371381
const emptyList = {
372382
CommonPrefixes: [],
@@ -377,14 +387,14 @@ function bucketGet(authInfo, request, log, callback) {
377387
return handleResult(listParams, requestMaxKeys, encoding, authInfo,
378388
bucketName, emptyList, corsHeaders, log, callback);
379389
}
380-
return services.getObjectListing(bucketName, listParams, log,
381-
(err, list) => {
390+
391+
return services.getObjectListing(bucketName, listParams, log, (err, list) => {
382392
if (err) {
383393
log.debug('error processing request', { error: err });
384-
monitoring.promMetrics(
385-
'GET', bucketName, err.code, 'listBucket');
394+
monitoring.promMetrics('GET', bucketName, err.code, 'listBucket');
386395
return callback(err, null, corsHeaders);
387396
}
397+
388398
return handleResult(listParams, requestMaxKeys, encoding, authInfo,
389399
bucketName, list, corsHeaders, log, callback);
390400
});

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
"@aws-sdk/client-iam": "^3.930.0",
2323
"@aws-sdk/client-s3": "^3.908.0",
2424
"@aws-sdk/client-sts": "^3.930.0",
25-
"aws-sdk": "^2.1692.0",
2625
"@aws-sdk/credential-providers": "^3.864.0",
2726
"@aws-sdk/middleware-retry": "^3.374.0",
2827
"@aws-sdk/protocol-http": "^3.374.0",
@@ -31,8 +30,9 @@
3130
"@azure/storage-blob": "^12.28.0",
3231
"@hapi/joi": "^17.1.1",
3332
"@smithy/node-http-handler": "^3.0.0",
34-
"arsenal": "git+https://github.com/scality/Arsenal#8.3.0",
33+
"arsenal": "git+https://github.com/scality/arsenal#8.3.1",
3534
"async": "2.6.4",
35+
"aws-sdk": "^2.1692.0",
3636
"bucketclient": "scality/bucketclient#8.2.7",
3737
"bufferutil": "^4.0.8",
3838
"commander": "^12.1.0",
@@ -78,6 +78,7 @@
7878
"node-mocks-http": "^1.16.1",
7979
"nodemon": "^3.1.10",
8080
"nyc": "^15.1.0",
81+
"pino-pretty": "^13.1.3",
8182
"sinon": "^13.0.1",
8283
"tv4": "^1.3.0"
8384
},
@@ -91,7 +92,7 @@
9192
},
9293
"scripts": {
9394
"cloudserver": "S3METADATA=mongodb npm-run-all --parallel start_dataserver start_s3server",
94-
"dev": "nodemon --exec \"yarn run start\"",
95+
"dev": "nodemon --exec \"yarn run start\" | pino-pretty -c -S -m message -i \"pid,hostname,name,authn,authz,address,clientPort,clientIP,elapsed_ms\"",
9596
"ft_awssdk": "cd tests/functional/aws-node-sdk && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json test/ --exit",
9697
"ft_awssdk_aws": "cd tests/functional/aws-node-sdk && AWS_ON_AIR=true mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json test/ --exit",
9798
"ft_awssdk_buckets": "cd tests/functional/aws-node-sdk && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json test/bucket --exit",

0 commit comments

Comments
 (0)