Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signature mismatch with s3 path style requests for signature v4 when using endpoint host like a http://<host:port/some_path> #1366

Open
artashesbalabekyan opened this issue Feb 27, 2024 · 3 comments

Comments

@artashesbalabekyan
Copy link

For example I want use a http://localhost:8080/s3 as an endpoint. And in this case s3cmd calculates the v4 signature wrong.

It should use the hostname http://localhost:8080 not the http://localhost:8080/s3 for signature calculation.

Any ideas about it? How it can be solved?

@artashesbalabekyan
Copy link
Author

DEBUG: Canonical Request:
GET
/bucket_name/
delimiter=%2F
host:localhost:8080/s3
x-amz-content-sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
x-amz-date:20240227T185517Z

As you see host is localhost:8080/s3. But it should be localhost:8080. Because in http, a host can't be like localhost:8080/s3

@fviard
Copy link
Contributor

fviard commented Feb 28, 2024

Which s3 compatible service or software stack are you using?

Because it is a case where it is complicated to know what should be the correct behavior:

  • On AWS s3, there couldn't be a "sub-path" before the bucket. So there spec does not cover such a case.
  • In theory you can't have /s3/bucket_name, because otherwise it is "s3" that will be the bucket name.
  • If we were to ignore what i can call the "service path" (ie "/s3"), the signature would be kind of broken, because the same signature will work with all "services paths".

@fviard
Copy link
Contributor

fviard commented Apr 13, 2024

@artashesbalabekyan Would you be able to give more details about the service that you are using to be encountering this situation?
Otherwise i will have to close this issue.

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

No branches or pull requests

2 participants