Skip to content

Seems cli does not verify the checksum when downloading an object #6710

@buptwxd2

Description

@buptwxd2

Confirm by changing [ ] to [x] below:

Issue is about usage on:

  • Service API : I want to do X using Y service, what should I do?
  • CLI : passing arguments or cli configurations.
  • Other/Not sure.

Platform/OS/Hardware/Device
What are you running the cli on?

Describe the question
According to "AWS S3 CLI FAQ"(https://docs.aws.amazon.com/cli/latest/topic/s3-faq.html#cli-aws-help-s3-faq), the aws cli tool will try to erify the checksum of downloads when possible.
However, i tried to corrupt an object and used the aws cli to download the corrupted object, it succeeded without detecting the mismatch.

Steps

  1. preapre a local file, size:4MB witih all zero

  2. upload the fille to s3 using aws cli
    aws s3api put-object --bucket xd-bk-1 --key test --body 4M_zero
    root@vm102 ~/x/test# aws s3api head-object --bucket xd-bk-1 --key test
    {
    "AcceptRanges": "bytes",
    "LastModified": "2022-02-11T07:14:36+00:00",
    "ContentLength": 4194304,
    "ETag": ""b5cfa9d6c8febd618f91ac2843d50a1c"",
    "ContentType": "binary/octet-stream",
    "Metadata": {},
    "StorageClass": "STANDARD"
    }

  3. corrupt the object

  4. Download the object
    root@vm102 ~/x/test# aws s3api get-object --bucket xd-bk-1 --key test d_test
    {
    "AcceptRanges": "bytes",
    "LastModified": "2022-02-11T07:14:36+00:00",
    "ContentLength": 4194304,
    "ETag": ""b5cfa9d6c8febd618f91ac2843d50a1c"",
    "ContentType": "binary/octet-stream",
    "Metadata": {},
    "StorageClass": "STANDARD"
    }
    root@vm102 ~/x/test# md5sum d_test
    6c8b11cda139dbb04a83190975220d98 d_test

As a comparison, the s3cmd tool detected the mistach as below
root@vm102 ~/x/test [64]# s3cmd get s3://xd-bk-1/test dtest
download: 's3://xd-bk-1/test' -> 'dtest' [1 of 1]
4194304 of 4194304 100% in 0s 168.38 MB/s done
WARNING: MD5 signatures do not match: computed=6c8b11cda139dbb04a83190975220d98, received=b5cfa9d6c8febd618f91ac2843d50a1c

Logs/output
Get full traceback and error logs by adding --debug to the command.

Metadata

Metadata

Assignees

Labels

feature-requestA feature should be added or improved.p2This is a standard priority issues3

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions