fix: validate object lock default retention upper limits

Fixes #2187

Enforce maximum default retention periods when parsing PutObjectLockConfiguration requests. Reject Days values greater than 36500 and Years values greater than 100 with InvalidArgument errors.
This commit is contained in:
niksis02
2026-06-16 22:48:51 +04:00
parent 4d391cabc8
commit 67af0afa81
3 changed files with 75 additions and 29 deletions
+10
View File
@@ -43,6 +43,8 @@ const (
InvalidArgPastObjectLockRetainDate
InvalidArgObjectLockRetentionDays
InvalidArgObjectLockRetentionYears
InvalidArgObjectLockRetentionDaysTooLarge
InvalidArgObjectLockRetentionYearsTooLarge
InvalidArgMissingObjectLockRetainDate
InvalidArgMissingObjectLockMode
InvalidArgLegalHoldStatus
@@ -145,6 +147,14 @@ var invalidArgErrResponses = map[InvalidArgErrorCode]InvalidArgumentError{
Description: "Default retention period must be a positive integer value.",
ArgumentName: "Years",
},
InvalidArgObjectLockRetentionDaysTooLarge: {
Description: "Default retention period too large.",
ArgumentName: "Days",
},
InvalidArgObjectLockRetentionYearsTooLarge: {
Description: "Default retention period too large.",
ArgumentName: "Years",
},
InvalidArgLegalHoldStatus: {
Description: "Legal Hold must be either of 'ON' or 'OFF'",
ArgumentName: "x-amz-object-lock-legal-hold",