mirror of
https://github.com/pgsty/minio.git
synced 2026-09-05 18:16:16 +03:00
fix: authenticate SSE-C keys on zero-byte reads
Unseal supplied SSE-C and copy-source keys after range and request preconditions when a zero-byte read cannot build a decryptor. Preserve internal no-decryption, replication, restore, and absent-header reads. Signed-off-by: Feng Ruohang <rh@vonng.com>
This commit is contained in:
+12
-2
@@ -266,9 +266,19 @@ func (er erasureObjects) GetObjectNInfo(ctx context.Context, bucket, object stri
|
||||
ObjInfo: objInfo,
|
||||
}, err
|
||||
}
|
||||
|
||||
// Zero byte objects don't even need to further initialize pipes etc.
|
||||
return NewGetObjectReaderFromReader(bytes.NewReader(nil), objInfo, opts)
|
||||
gr, err = NewGetObjectReaderFromReader(bytes.NewReader(nil), objInfo, opts)
|
||||
if err != nil {
|
||||
return gr, err
|
||||
}
|
||||
// With no data, the reader above cannot authenticate an SSE-C key the
|
||||
// way NewGetObjectReader does. Check it after the preconditions so zero
|
||||
// and non-zero reads preserve the same error ordering.
|
||||
if err := checkSSECReadKey(h, objInfo, opts); err != nil {
|
||||
gr.Close()
|
||||
return nil, err
|
||||
}
|
||||
return gr, nil
|
||||
}
|
||||
|
||||
if objInfo.IsRemote() {
|
||||
|
||||
Reference in New Issue
Block a user