fix: return not implemented in object actions, if acl header is present

Fixes #1767
Fixes #1773

As object ACLs are not supported in the gateway, any attempt to set an ACL during object creation must return a NotImplemented error. A check has now been added to `PutObject`, `CopyObject`, and `CreateMultipartUpload` to detect any ACL-related headers and return a NotImplemented error accordingly.
This commit is contained in:
niksis02
2026-01-23 17:03:03 +04:00
parent 45b6a4a74e
commit 8569b158f0
8 changed files with 171 additions and 4 deletions
+22
View File
@@ -948,3 +948,25 @@ func NewTLSListener(network string, address string, getCertificateFunc func(*tls
}
return tls.NewListener(ln, config), nil
}
// ValidateNoACLHeaders checks whether any ACL-related request headers are set.
// since ACL operations are not supported on objects, the presence of any ACL headers
// results in a NotImplemented error. It returns nil only when all ACL headers
// are absent.
func ValidateNoACLHeaders(ctx *fiber.Ctx) error {
for _, header := range []string{
"x-amz-acl",
"x-amz-grant-full-control",
"x-amz-grant-read",
"x-amz-grant-read-acp",
"x-amz-grant-write-acp",
} {
value := ctx.Request().Header.Peek(header)
if len(value) != 0 {
debuglogger.Logf("an unsupported object acl header present: %s:%s", header, value)
return s3err.GetAPIError(s3err.ErrNotImplemented)
}
}
return nil
}