Is part-number-marker = 0 valid in list-parts request #207

Closed
opened 2023-09-15 06:44:36 +00:00 by alexvanin · 1 comment
Owner

Some S3 API clients set "0" values in part-number-marker parameter of list-parts request.
FrostFS S3 Gateway denies "0" value.

	if queryValues.Get("part-number-marker") != "" {
		if partNumberMarker, err = strconv.Atoi(queryValues.Get("part-number-marker")); err != nil || partNumberMarker <= 0 {
			h.logAndSendError(w, "invalid PartNumberMarker", reqInfo, err, additional...)
			return
		}
	}

Meanwhile minio allows (1,2 it.

	if values.Get("part-number-marker") != "" {
		if partNumberMarker, err = strconv.Atoi(values.Get("part-number-marker")); err != nil {
			errCode = ErrInvalidPartNumberMarker
			return
		}
	}
	if partNumberMarker < 0 {
		partNumberMarker = 0
	}

Describe the solution you'd like

Check out AWS S3 docs once again and AWS S3 API whether "0" value is allowed or not.
If it is allowed, then fix condition in FrostFS S3 Gateway.
If it is not allowed, then add a "kludge" flag and make condition based on a flag value.

Describe alternatives you've considered

None.

## Is your feature request related to a problem? Please describe. Some S3 API clients set "0" values in `part-number-marker` parameter of [list-parts](https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListParts.html#API_ListParts_RequestSyntax) request. FrostFS S3 Gateway [denies](https://git.frostfs.info/TrueCloudLab/frostfs-s3-gw/src/commit/41a128b1aa7916d8956f064c6173f3bc79d93284/api/handler/multipart_upload.go#L603) "0" value. ```go if queryValues.Get("part-number-marker") != "" { if partNumberMarker, err = strconv.Atoi(queryValues.Get("part-number-marker")); err != nil || partNumberMarker <= 0 { h.logAndSendError(w, "invalid PartNumberMarker", reqInfo, err, additional...) return } } ``` Meanwhile minio allows ([1](https://github.com/minio/minio/blob/7b926873977b1f0e206325310f66f521da4fc964/cmd/erasure-multipart.go#L837),[2](https://github.com/minio/minio/blob/7b926873977b1f0e206325310f66f521da4fc964/cmd/api-resources.go#L143-L144) it. ```go if values.Get("part-number-marker") != "" { if partNumberMarker, err = strconv.Atoi(values.Get("part-number-marker")); err != nil { errCode = ErrInvalidPartNumberMarker return } } ``` ```go if partNumberMarker < 0 { partNumberMarker = 0 } ``` ## Describe the solution you'd like Check out AWS S3 docs once again and AWS S3 API whether "0" value is allowed or not. If it is allowed, then fix condition in FrostFS S3 Gateway. If it is not allowed, then add a "kludge" flag and make condition based on a flag value. ## Describe alternatives you've considered None.
alexvanin added this to the v0.29.0 milestone 2023-09-15 06:44:36 +00:00
alexvanin added the
good first issue
label 2023-09-15 06:44:36 +00:00
mbiryukova was assigned by alexvanin 2023-09-15 08:23:43 +00:00
Member

"0" value is allowed.
Also if part-number-marker isn't less than the largest loaded part number, no parts should be returned. In current implementation it returns parts starting from the first one.

"0" value is allowed. Also if `part-number-marker` isn't less than the largest loaded part number, no parts should be returned. In current implementation it returns parts starting from the first one.
alexvanin modified the milestone from v0.29.0 to v0.28.0 2023-09-18 09:53:43 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-s3-gw#207
No description provided.