Giter VIP home page Giter VIP logo

Comments (1)

mildbyte avatar mildbyte commented on May 29, 2024

This looks like a disparity between object_store and the official Minio SDK. object_store uses these inputs to build a signature:


string_to_sign = "AWS4-HMAC-SHA256\n20220915T105705Z\n20220915//s3/aws4_request\nb1f63c698039ba6772a850c3f0df8dc7e4f544854197ff42ff46f8f0c45e9e0d"

scope = "20220915//s3/aws4_request"

hashed_canonical_request = "b1f63c698039ba6772a850c3f0df8dc7e4f544854197ff42ff46f8f0c45e9e0d"

canonical_request = "POST\n/seafowl/bc444215ffac9df867e0b9a26184e67df061dd50a1fd2de3d3f3e335f1f85de3.parquet\nuploads\nhost:localhost:9000\nx-amz-content-sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\nx-amz-date:20220915T105705Z\n\nhost;x-amz-content-sha256;x-amz-date\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"

signed_headers = "host;x-amz-content-sha256;x-amz-date"

canonical_headers = "host:localhost:9000\nx-amz-content-sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\nx-amz-date:20220915T105705Z\n"

header_digest = http::header::value::HeaderValue {inner: bytes::bytes::Bytes {ptr: 0x7fffec05c4d0 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\031\f\375\020eĻŠ\027q\306\f\000", len: 64, data: core::sync::atomic::AtomicPtr<()> {p: core::cell::UnsafeCell<*mut ()> {value: 0x7fffec05c4d1}}, vtable: 0x55555bfc2fe0 <bytes::bytes::PROMOTABLE_EVEN_VTABLE>}, is_sensitive: false}

digest = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"

date_val = http::header::value::HeaderValue {inner: bytes::bytes::Bytes {ptr: 0x7fffec47d5b0 "20220915T105705Z:9000\177\000", len: 16, data: core::sync::atomic::AtomicPtr<()> {p: core::cell::UnsafeCell<*mut ()> {value: 0x7fffec47d5b1}}, vtable: 0x55555bfc2fe0 <bytes::bytes::PROMOTABLE_EVEN_VTABLE>}, is_sensitive: false}

date_str = "20220915T105705Z"

host_val = http::header::value::HeaderValue {inner: bytes::bytes::Bytes {ptr: 0x7fffec47d590 "localhost:9000\000", len: 14, data: core::sync::atomic::AtomicPtr<()> {p: core::cell::UnsafeCell<*mut ()> {value: 0x7fffec47d591}}, vtable: 0x55555bfc2fe0 <bytes::bytes::PROMOTABLE_EVEN_VTABLE>}, is_sensitive: false}

This is the main part:

canonical_request = "POST\n/seafowl/bc444215ffac9df867e0b9a26184e67df061dd50a1fd2de3d3f3e335f1f85de3.parquet\nuploads\nhost:localhost:9000\nx-amz-content-sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\nx-amz-date:20220915T105705Z\n\nhost;x-amz-content-sha256;x-amz-date\ne3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

(note the query string is uploads)

When using the official Minio SDK to perform a multipart upload:

from io import BytesIO

import minio
from minio.helpers import MIN_PART_SIZE

client = minio.Minio("localhost:9000", "minioadmin", "minioadmin", secure=False)

data = BytesIO(b"test" * 10000000)
client.put_object(
    bucket_name="seafowl",
    object_name="test_multipart",
    data=data,
    part_size=MIN_PART_SIZE,
    length=40000000,
)

we get these inputs (note that this is a different file, I was just looking for discrepancies between what goes into the signature):

image

There are two differences here:

  • the region isn't empty (us-east-1) in minio-py whereas it is in the object_store (because we make it empty)
  • the URL to initiate a multipart upload has a ?uploads= query param in minio-py instead of ?uploads (object_store)

Setting the region to us-east in object_store doesn't fix this, but changing object_store to use ?uploads= instead of ?uploads does. I haven't looked at the Minio signature verification code itself to see if we should keep the URL the same and change the object_store signing code instead.

from seafowl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.