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

Content-Length is excluded from signed header in presigned_url method #2098

Closed
okriuchykhin opened this issue Jul 29, 2019 · 2 comments · Fixed by #2110
Closed

Content-Length is excluded from signed header in presigned_url method #2098

okriuchykhin opened this issue Jul 29, 2019 · 2 comments · Fixed by #2110
Labels
feature-request A feature should be added or improved.

Comments

@okriuchykhin
Copy link

okriuchykhin commented Jul 29, 2019

Issue description

Hi,
in aws-sdk-s3/lib/aws-sdk-s3/presigner.rb#build_signer, 'content-length' is included in unsigned_headers with remark 'due to a ELB bug'. Looks like that code is at least 3 years old.
Is it still true that Content-Length should be excluded from signed header?

I would like to use Content-Length header for restricting client's uploads, which use presigned URLs.

I removed 'content-length' from unsigned_headers with code below and uploads seemed to be working without any issues.

Gem name

aws-sdk-s3 1.46.0

Version of Ruby, OS environment

N/A

Code snippets / steps to reproduce

module S3SignerModifier
    def build_signer(cfg)
      signer = super(cfg)
      signer.unsigned_headers.delete('content-length')
      signer
    end
  end

  Aws::S3::Presigner.class_eval do
    prepend S3SignerModifier
  end
@cjyclaire
Copy link
Contributor

Thanks for the feedback! Unfortunately, it still stays the same for some scenarios that we cannot move it out from blacklist, but we have been considering providing a whitelist option for those :unsigned_headers.

Having to patch over signer is definitely not an idea solution, does above whitelist option sounds good to you if available?

@cjyclaire cjyclaire added the feature-request A feature should be added or improved. label Jul 29, 2019
@okriuchykhin
Copy link
Author

Yes, I think adding whitelist option will be perfectly fine for my use case. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants