-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added restriction to limit the ID length to 255 characters in bucket lifecycle rules #8628
base: master
Are you sure you want to change the base?
Conversation
Hey @achouhan09
|
Hi @romayalon Added issue link and tests. Thanks |
@@ -7,6 +7,7 @@ const dbg = require('../../../util/debug_module')(__filename); | |||
const S3Error = require('../s3_errors').S3Error; | |||
|
|||
const true_regex = /true/i; | |||
const max_length_rule_id = 255; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer using capital letters (so it is easier to know when reading the statement that it is a const without jumping to the declaration).
const max_length_rule_id = 255; | |
const MAX_LENGTH_RULE_ID = 255; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, Thanks
src/test/lifecycle/common.js
Outdated
@@ -3,6 +3,7 @@ | |||
|
|||
const assert = require('assert'); | |||
|
|||
const max_length_rule_id = 255; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you declare the max in a place where we can import it and reuse it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use config.js
here. Updated, Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure config.js
is the right place, as it should not be configured.
I can suggest existing s3_utils
(or if you want I think we can create s3_constants
under src/endpoint/s3/
).
Could you test it in AWS and attach the results here? |
|
…lifecycle rules Signed-off-by: Aayush Chouhan <[email protected]>
Signed-off-by: Aayush Chouhan <[email protected]>
Signed-off-by: Aayush Chouhan <[email protected]>
Signed-off-by: Aayush Chouhan <[email protected]>
replied to comment |
For NooBaa, we will only get
|
Signed-off-by: Aayush Chouhan <[email protected]>
@shirady updated the error msg. Thanks |
current_rule.id = rule.ID[0]; | ||
if (rule.ID[0].length > config.MAX_RULE_ID_LENGTH) { | ||
dbg.error('Rule should not have ID length exceed allowed limit of ', config.MAX_RULE_ID_LENGTH, ' characters', rule); | ||
throw new S3Error({ ...S3Error.InvalidArgument, message: 'ID length should not exceed allowed limit of 255' }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throw new S3Error({ ...S3Error.InvalidArgument, message: 'ID length should not exceed allowed limit of 255' }); | |
throw new S3Error({ ...S3Error.InvalidArgument, message: `ID length should not exceed allowed limit of ${config.MAX_RULE_ID_LENGTH}` }); |
Explain the changes
Issues: Fixed #xxx / Gap #xxx
Testing Instructions: