-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
DynamoDB does not work with pre-signed URLs #94
Comments
Amazon DynamoDB itself works with the signing mechanism provided (we have integration tests for this case). My guess is DynamoDB Local does not (yet) support query string signing in V4, so I would recommend opening a thread on the DynamoDB Forums to point this out.
Signature version 4 supports signing in the query string, also known as "GET request signing". The following is the official documentation, which explains how to build these signatures: http://docs.aws.amazon.com/general/latest/gr/sigv4_signing.html Note that the example uses IAM, not S3. |
Ok, that makes sense. I started https://forums.aws.amazon.com/thread.jspa?threadID=171238. I don't expect a fast turnaround time for DynamoDB Local supporting query string authentication, and it's critical to my development workflow, so I may add a new function to v4.go called something like |
I wouldn't recommend overriding v4.go, as that would require a fork. You can do this without forking the SDK, simply register your own signer: db := dynamodb.New(nil)
db.Handlers.Sign.Clear()
db.Handlers.Sign.PushBack(myv4signer.SignWithHeader)
// make request
r, e := db.ListTables(nil)
// ... Where If you end up just rewriting the query string params, you can even drop the db := dynamodb.New(nil)
db.Handlers.Sign.PushBack(myv4signer.RewriteSignedURLToHeader) |
I planned on doing something like: db := dynamodb.New(nil)
db.Handlers.Sign.Clear()
db.Handlers.Sign.PushBack(v4.SignWithHeader) So the functions in v4.go could be shared. But just adding an additional handler which sets the header based on the query string sounds better. That approach would definitely let me implement it outside of the library code, but I would argue there is still some value in putting in the library as others will likely have the same use case. Maybe in a separate debug package? |
I opened up PR #99 which adds a signer which works as discussed, and I confirmed it works with DynamoDB Local. This doesn't need to live in the core library, but I think it will be useful to anyone using DynamoDB Local (or the equivalents for other services). Happy to move it elsewhere if there is another package structure which makes more sense. |
I think if we were to support it within the library it would be part of That said, we are looking into how to best sign requests, so it may be that we have some kind of switch for header/query string signing. I'll leave the PR open for now as we plan the best way forward, but I would recommend using your plugin as a separate package in your own usage for now, rather than trying to maintain a fork. |
Closing this since we backed out the presigned URL strategy in develop and requests should now be signed in "header mode" unless |
Thanks |
Is this issue really solved?
This runs against a local DynamoDB. I assumed that authentication now should use header based authentication again. |
Especially because aws/aws-sdk-go#94 was fixed, which prevents talking to DynamoDB local.
@bracki it should be resolved. Are you sure you've updated your dependency? |
Sorry my mistake. GOPATH/Godeps confusion à la carte. -- Jan
|
Fixes the SDK's handling of a Pagination NextToken's value being an empty string compared to a nil value. The SDK was expecting NextToken's to always be unset (nil) and treating any non-nil value as a valid value. This was not the case in MediaLive's List APIs. As those APIs return a empty string value instead of null or not setting the field at all. This issue exists in both the v1 and v2 SDKs. Fix aws#84
Release v2.0.0-preview.2 (2018-01-15) === ### Services * Synced the V2 SDK with latests AWS service API definitions. ### SDK Bugs * `service/s3/s3manager`: Fix Upload Manger's UploadInput fields ([aws#89](aws/aws-sdk-go-v2#89)) * Fixes [aws#88](aws/aws-sdk-go-v2#88) * `aws`: Fix Pagination handling of empty string NextToken ([aws#94](aws/aws-sdk-go-v2#94)) * Fixes [aws#84](aws/aws-sdk-go-v2#84)
The develop branch was modified to use pre-signed URLs rather than the
Authorization
header. With this format, I'm unable to authenticate with DynamoDB (I've actually only tried DynamoDB Local):I checked AdRoll/goamz and the JS SDK, and both use the
Authentication
header rather than pre-signed URLs with DynamoDB. In particular, goamz only generates pre-signed URLs when theX-Amz-Expires
header is set, and only the S3 signer leverages this.My understanding of AWS auth is limited, but it seems that the pre-signing logic should only apply to S3, and other services should revert to using the
Authentication
header.The text was updated successfully, but these errors were encountered: