Skip to content

Commit

Permalink
Added restriction to limit the ID length to 255 characters in bucket …
Browse files Browse the repository at this point in the history
…lifecycle rules

Signed-off-by: Aayush Chouhan <[email protected]>
  • Loading branch information
achouhan09 committed Jan 2, 2025
1 parent 6a079ed commit 0fd422f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/endpoint/s3/ops/s3_put_bucket_lifecycle.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@ async function put_bucket_lifecycle(req) {
};

if (rule.ID?.length === 1) {
current_rule.id = rule.ID[0];
if (rule.ID[0].length > 255) {
dbg.error('Rule should not have ID length exceeding 255 characters', rule);
throw new S3Error(S3Error.InvalidArgument);
} else {
current_rule.id = rule.ID[0];
}
} else {
// Generate a random ID if missing
current_rule.id = uuid();
Expand Down

0 comments on commit 0fd422f

Please sign in to comment.