Skip to content

Commit

Permalink
api: Fix error status on anonymous put object
Browse files Browse the repository at this point in the history
NeoFS is not supporting override ACL rules in container by anonymous. See cd4ddb3#diff-95f9fb7bdd6fbea098329acfc84ab26264360c926d41be2814e38e7a9d5768ffR33

Closes #847.

Signed-off-by: Evgenii Baidakov <[email protected]>
  • Loading branch information
smallhive committed Dec 15, 2023
1 parent 38444c2 commit 1095dba
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions api/handler/put.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,11 @@ func (h *handler) PostObject(w http.ResponseWriter, r *http.Request) {
}

if acl := auth.MultipartFormValue(r, "acl"); acl != "" {
if api.IsAnonymousRequest(r.Context()) {
h.logAndSendError(w, "anonymous can't override ACL rules", reqInfo, s3errors.GetAPIError(s3errors.ErrNotImplemented))
return
}

Check warning on line 460 in api/handler/put.go

View check run for this annotation

Codecov / codecov/patch

api/handler/put.go#L457-L460

Added lines #L457 - L460 were not covered by tests

r.Header.Set(api.AmzACL, acl)
r.Header.Set(api.AmzGrantFullControl, "")
r.Header.Set(api.AmzGrantWrite, "")
Expand Down

0 comments on commit 1095dba

Please sign in to comment.