mirror of
https://github.com/pgsty/minio.git
synced 2026-11-01 05:12:07 +03:00
fix: reject composite CRC64NVME trailers
Apply the full-object-only rule to declared streaming checksum trailers and cover the HTTP mutation path. Signed-off-by: Feng Ruohang <rh@vonng.com>
This commit is contained in:
@@ -150,6 +150,16 @@ func TestChecksumAddToHeader(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestCRC64NVMECompositeTrailerIsInvalid(t *testing.T) {
|
||||
h := http.Header{}
|
||||
h.Set(xhttp.AmzTrailer, ChecksumCRC64NVME.Key())
|
||||
h.Set(xhttp.AmzChecksumType, xhttp.AmzChecksumTypeComposite)
|
||||
_, err := GetContentChecksum(h)
|
||||
if !errors.Is(err, ErrInvalidChecksum) {
|
||||
t.Fatalf("CRC64NVME/COMPOSITE trailer error = %v, want ErrInvalidChecksum", err)
|
||||
}
|
||||
}
|
||||
|
||||
// TestChecksumSerializeDeserialize checks AppendTo can be reversed by ChecksumFromBytes
|
||||
func TestChecksumSerializeDeserialize(t *testing.T) {
|
||||
myData := []byte("this-is-a-checksum-data-test")
|
||||
|
||||
Reference in New Issue
Block a user