Skip to content

Fix FilePut hashing for short reads - #49

Open
dajiaohuang wants to merge 1 commit into
rhnvrm:masterfrom
dajiaohuang:fix/fileput-body-hash
Open

dajiaohuang wants to merge 1 commit into
rhnvrm:masterfrom
dajiaohuang:fix/fileput-body-hash

Conversation

@dajiaohuang

Copy link
Copy Markdown

Summary

FilePut now hashes the complete seekable body with io.Copy, so a legal short read cannot leave zero-padded bytes in the SigV4 payload hash. It rewinds the body before sending and avoids allocating a second buffer sized to the entire file. A local HTTP regression test checks both the transmitted body and hash header.

Fixes #47.

Verification

  • go test -run '^TestFilePutHashesCompleteBodyWithShortReads$' ./... — passed.
  • git diff --check — passed.
  • The repository workflow's full MinIO-backed test command was not run locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FilePut: SignatureDoesNotMatch for files larger than 1 GiB

1 participant