mirror of
https://github.com/minio/minio.git
synced 2025-11-10 22:10:12 -05:00
do not save plain-text ETag when encryption is requested (#17427)
fixes an issue under bucket replication could cause ETags for replicated SSE-S3 single part PUT objects, to fail as we would attempt a decryption while listing, or stat() operation.
This commit is contained in:
@@ -37,6 +37,7 @@ import (
|
||||
"github.com/minio/minio/internal/bucket/lifecycle"
|
||||
"github.com/minio/minio/internal/bucket/object/lock"
|
||||
"github.com/minio/minio/internal/bucket/replication"
|
||||
"github.com/minio/minio/internal/crypto"
|
||||
"github.com/minio/minio/internal/event"
|
||||
"github.com/minio/minio/internal/hash"
|
||||
xhttp "github.com/minio/minio/internal/http"
|
||||
@@ -1263,8 +1264,16 @@ func (er erasureObjects) putObject(ctx context.Context, bucket string, object st
|
||||
}
|
||||
|
||||
userDefined["etag"] = r.MD5CurrentHexString()
|
||||
kind, _ := crypto.IsEncrypted(userDefined)
|
||||
if opts.PreserveETag != "" {
|
||||
userDefined["etag"] = opts.PreserveETag
|
||||
if !opts.ReplicationRequest {
|
||||
userDefined["etag"] = opts.PreserveETag
|
||||
} else if kind != crypto.S3 {
|
||||
// if we have a replication request
|
||||
// and SSE-S3 is specified do not preserve
|
||||
// the incoming etag.
|
||||
userDefined["etag"] = opts.PreserveETag
|
||||
}
|
||||
}
|
||||
|
||||
// Guess content-type from the extension if possible.
|
||||
|
||||
Reference in New Issue
Block a user