fix: reject start-after in ListObjects V1

listobjects v1 now returns InvalidArgument when the start-after query parameter is present, matching s3, which only accepts it with list-type=2. previously the parameter was silently ignored.

Fixes #2004
This commit is contained in:
dualfroz committed 2026-10-07 19:38:54 +02:00
1 parent 09e1b65724
commit b3bf48bdcb
6 files changed
+67 -3

No files matched your search

+29
View File
@@ -17,6 +17,8 @@ package integration
import (
"context"
"fmt"
"net/http"
"time"
"github.com/aws/aws-sdk-go-v2/service/s3"
"github.com/aws/aws-sdk-go-v2/service/s3/types"
@@ -338,6 +340,33 @@ func ListObjects_marker_not_from_obj_list(s *S3Conf) error {
})
}
// ListObjects_start_after_not_supported sends start-after without
// list-type=2. S3 rejects it with InvalidArgument instead of ignoring it.
func ListObjects_start_after_not_supported(s *S3Conf) error {
testName := "ListObjects_start_after_not_supported"
return actionHandler(s, testName, func(s3client *s3.Client, bucket string) error {
_, err := putObjects(s3client, []string{"bar", "foo"}, bucket)
if err != nil {
return err
}
// ListObjectsInput has no StartAfter field, so send the query directly
req, err := createSignedReq(http.MethodGet, s.endpoint,
fmt.Sprintf("%v?start-after=bar", bucket),
s.awsID, s.awsSecret, "s3", s.awsRegion, "", nil, time.Now(), nil)
if err != nil {
return err
}
resp, err := s.httpClient.Do(req)
if err != nil {
return err
}
return checkHTTPResponseApiErr(resp, s3err.GetInvalidArgumentErr(s3err.InvalidArgStartAfter, ""))
})
}
func ListObjects_with_checksum(s *S3Conf) error {
testName := "ListObjects_with_checksum"
return actionHandler(s, testName, func(s3client *s3.Client, bucket string) error {