mgomes / api_auth

HMAC authentication for Rails and HTTP Clients
MIT License
480 stars 147 forks source link

Change Content MD5 to X-Authorization-Content-SHA256 #188

Closed fwininger closed 4 years ago

fwininger commented 4 years ago

related to #176

fwininger commented 4 years ago

@mgomes can you review this please ?

mgomes commented 4 years ago

@fwininger this is looking good. We'll probably need to cut a version 3.0 version of the gem when this lands.

I was looking through the AWS docs to see if there is a convention for the header name but I couldn't find any. Just curious, what made you go with X-Authorization-Content-SHA256?

fwininger commented 4 years ago

@mgomes for X-Authorization-Content-SHA256 you ! See https://github.com/mgomes/api_auth/issues/176#issuecomment-525309683

AWS use x-amz-content-sha256

https://docs.aws.amazon.com/AmazonS3/latest/API/bucket-policy-s3-sigv4-conditions.html

mgomes commented 4 years ago

🤦 sorry about that.

fwininger commented 4 years ago

@fwininger this is looking good. We'll probably need to cut a version 3.0 version of the gem when this lands.

I was looking through the AWS docs to see if there is a convention for the header name but I couldn't find any. Just curious, what made you go with X-Authorization-Content-SHA256?

I'm agree with the version 3.0. Before we release the next major version, I would like to implement some change to be more 2020 compliant. When this MR is correct, I change the Readme to use SHA-256 by default, with introduction to be backward compatible with SHA-1. I update all reference, for example FIPS-180...

fwininger commented 4 years ago

I would like also implement a option to force X-Authorization-Content-SHA256 when the body length is not 0.

fwininger commented 4 years ago

@mgomes have you time to review this PR ?

fwininger commented 4 years ago

@mgomes @kjg have you time to review this PR ? I have a regulatory audit next month and we have an offense to the previous audit with the usage of MD5.

fwininger commented 4 years ago

@mgomes Yes I would like to clean the Readme, but I prefer to do this after this PR is merged.

I will appreciate to become a member of this repo, I can manage the PR review and fix bugs, but I will appreciate if you can continue to manage the release part.

tycooon commented 3 years ago

It looks like this update is not documented in the CHANGELOG and is not backwards compatible. @mgomes maybe it's time to bump the major version to 3.0 and maybe also add some docs for upgrade process?

CamilleDrapier commented 3 years ago

Thanks for implementing more robust security.

On top of having a changelog entry, it would have been nice to have a least one version that supports both md5 (with a deprecation message logged?) and sha-256, to make clients transition easier. :bow:

rapito commented 3 years ago

Kudos for increasing the security here!

It looks like this update is not documented in the CHANGELOG and is not backwards compatible. @mgomes maybe it's time to bump the major version to 3.0 and maybe also add some docs for upgrade process?

I came here because of this. SemVer updated to the next non major version and things started breaking... Also, this not only affects people using this gem but anyone who consumes our API. :(

Thanks for implementing more robust security.

On top of having a changelog entry, it would have been nice to have a least one version that supports both md5 (with a deprecation message logged?) and sha-256, to make clients transition easier. 🙇

I agree with @CamilleDrapier here, is there any way a newer version can be published with backwards compatibility and move this change up to 3.0?

Also, @fwininger would it be possible to document these changes on the changelog as part of this PR (even if commited retroactively, since this is already merged in and released)?

CamilleDrapier commented 3 years ago

By the way, I have ended up writing a monkeypatch for handling both of these (assuming a Rails application), it comes of course without guarantee of work nor support, nor anything :innocent: :