Skip to content

Commit

Permalink
CLDSRV-447:ARSN version bump
Browse files Browse the repository at this point in the history
fixes after reviews
  • Loading branch information
benzekrimaha committed Sep 26, 2023
1 parent 4195b6a commit 4795859
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
2 changes: 1 addition & 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#73c6f41fa3bf52947e2f9a33ac2cb40233309ab5",
"arsenal": "git+https://github.com/scality/arsenal#7.10.48",
"async": "~2.5.0",
"aws-sdk": "2.905.0",
"azure-storage": "^2.1.0",
Expand Down
21 changes: 19 additions & 2 deletions tests/functional/aws-node-sdk/test/bucket/putBucketPolicy.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ function getPolicyParamsWithId(paramToChange, policyId) {
};
}

function generateRandomString(length) {
// All allowed characters matching the regex in arsenal
const allowedCharacters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+=,.@ -/';
const allowedCharactersLength = allowedCharacters.length;

return [...Array(length)]
.map(() => allowedCharacters[~~(Math.random() * allowedCharactersLength)])
.join('');
}

// Check for the expected error response code and status code.
function assertError(err, expectedErr, cb) {
if (expectedErr === null) {
Expand All @@ -61,6 +71,7 @@ function assertError(err, expectedErr, cb) {
cb();
}


describe('aws-sdk test put bucket policy', () => {
let s3;
let otherAccountS3;
Expand Down Expand Up @@ -134,10 +145,16 @@ describe('aws-sdk test put bucket policy', () => {
assertError(err, null, done));
});

it('should allow bucket policy with pincipal arn less than 2048', done => {
const params = getPolicyParams({ key: 'Principal', value: { AWS: 'arn:aws:iam::767707094035:user/user2/TENANT_USER/null/5417be27-8709-48bd-adfb-865ebc58b9f0/1a464be02ea631bdaf2a9ee884434233374a457460e925bf10d9e4665f8fa796/c1d83067-a3f3-41a4-bd45-d6bf47270bd0' } }); // eslint-disable-line max-len
it('should allow bucket policy with pincipal arn less than 2048 characters', done => {
const params = getPolicyParams({ key: 'Principal', value: { AWS: `arn:aws:iam::767707094035:user/${generateRandomString(150)}` } }); // eslint-disable-line max-len
s3.putBucketPolicy(params, err =>
assertError(err, null, done));
});

it('should not allow bucket policy with pincipal arn more than 2048 characters', done => {
const params = getPolicyParams({ key: 'Principal', value: { AWS: `arn:aws:iam::767707094035:user/${generateRandomString(2020)}` } }); // eslint-disable-line max-len
s3.putBucketPolicy(params, err =>
assertError(err, 'MalformedPolicy', done));
});
});
});
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -488,9 +488,9 @@ arraybuffer.slice@~0.0.7:
optionalDependencies:
ioctl "^2.0.2"

"arsenal@git+https://github.com/scality/arsenal#73c6f41fa3bf52947e2f9a33ac2cb40233309ab5":
version "7.10.47"
resolved "git+https://github.com/scality/arsenal#73c6f41fa3bf52947e2f9a33ac2cb40233309ab5"
"arsenal@git+https://github.com/scality/arsenal#7.10.48":
version "7.10.48"
resolved "git+https://github.com/scality/arsenal#f49cea3914390880008e3d41cedb1a02f9d99f39"
dependencies:
"@types/async" "^3.2.12"
"@types/utf8" "^3.0.1"
Expand Down

0 comments on commit 4795859

Please sign in to comment.