mirror of
https://github.com/versity/versitygw.git
synced 2026-09-20 23:14:49 +00:00
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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user