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

Fully implement AWS4 signing support #118

Closed
wants to merge 9 commits into from

Conversation

stevenh
Copy link
Contributor

@stevenh stevenh commented Apr 15, 2016

This fully implements AWS4 signing support, which was only partially added by 5d9165.

This adds the Sign field to Region, which can be used to sign a request with default sign method for that region.

In addition we have a single method that implements signing of requests for each supported signing method:

  • SignV2
  • SignV4
  • SignRoute53

Fix V4Signer adding headers to the request after calculating the canonicalHeaders, due to this change all the tests have had to be updated with corrected checksums and headers.

Unfortunately it was not possible to make this change 100% backwards compatible.

The following changes are API incompatible and hence may require users to update their code:

  • Removes Signature constants, as they are not used any more
  • Removes ServiceInfo type, as its not used any more
  • Removes Signer interface, as its not compatible with all signing methods.
  • Changes the type of Region.RDSEndpoint from ServiceInfo -> string
  • Renames Region.CloudWatchServicepoint -> CloudWatchEndpoint and changes its type from ServiceInfo -> string.
  • Changes NewService from (auth Auth, serviceInfo ServiceInfo) -> (auth Auth, endpoint string, region Region).
  • Changes NewV2Signer from (auth Auth, service ServiceInfo) -> (auth Auth, endpoint string)
  • Changes NewCloudWatch from (auth aws.Auth, region aws.ServiceInfo) -> NewCloudWatch(auth aws.Auth, region aws.Region)
  • Changes CanonicalRequest return from string to string, error

Also switch to using http status code constants while I'm here to ease comprehension.

While s3 states it supports AWS Signature Version 2 this is not the case as it requires custom changes such as Expires parameter, so the previous change which uses the common AWS Signature Version 2 caused failures.

Follow the official AWS SDK in using only Signature Version 4, which is now supported everywhere, to avoid using the old custom s3 Signature Version 2 implementation.

Also expose the option to enable debugging by switching const debug to var Debug.

This fully implemeents AWS4 signing support, which was only partially added by 5d9165.

This adds the Sign field to Region, which can be used to sign a request with default sign method for that region.

In addition we have a single method that implements signing of requests for each supported signing method:
* SignV2
* SignV4
* SignRoute53

Fix V4Signer adding headers to the request after calculating the canonicalHeaders, due to this change all the tests have had to be updated with corrected checksums and headers.

Unfortunately it was not possible to make this change 100% backwards compatible.

The following changes are API incompatible and hence may require users to update their code:
* Removes Signature constants, as they are not used any more
* Removes ServiceInfo type, as its not used any more
* Removes Signer interface, as its not compatible with all signing methods.
* Changes the type of Region.RDSEndpoint from ServiceInfo -> string
* Renames Region.CloudWatchServicepoint -> CloudWatchEndpoint and changes its type from ServiceInfo -> string.
* Changes NewService from (auth Auth, serviceInfo ServiceInfo) -> (auth Auth, endpoint string, region Region).
* Changes NewV2Signer from (auth Auth, service ServiceInfo) -> (auth Auth, endpoint string)
* Changes NewCloudWatch from (auth aws.Auth, region aws.ServiceInfo) -> NewCloudWatch(auth aws.Auth, region aws.Region)
* Changes CanonicalRequest return from string to string, error

Also switch to using http status code constants while I'm here to ease comprehension.
Fully implement AWS4 signing support
While s3 states it supports AWS Signature Version 2 this is not the case as it requires custom changes such as Expires parameter, so the previous change which uses the common AWS Signature Version 2 caused failures.

Follow the official AWS SDK in using only Signature Version 4, which is now supported everywhere, to avoid using the old custom s3 Signature Version 2 implementation.

Also expose the option to enable debugging by switching const debug to var Debug.
Switch s3 to use only AWS Signature Version 4
The sort for the query is defined as being on the keys and not keys
+ values.

Switch from the custom code to the built in Query().Encode() which
does the right thing once passed through a replace of + with %20.
@stevenh stevenh mentioned this pull request Aug 23, 2016
The merge with upsteam brought in an additional region which needed
adapting to our format.
@stevenh
Copy link
Contributor Author

stevenh commented Jun 7, 2017

Closing due to lack of feedback, which has forced us to switch to an alternative implementation

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

Successfully merging this pull request may close these issues.

None yet

1 participant