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

SDKs enpdoint prefix customization results in invalid request signatures. #863

Closed
3 tasks done
jasdel opened this issue Oct 29, 2020 · 1 comment · Fixed by #882
Closed
3 tasks done

SDKs enpdoint prefix customization results in invalid request signatures. #863

jasdel opened this issue Oct 29, 2020 · 1 comment · Fixed by #882
Labels
bug This issue is a bug.

Comments

@jasdel
Copy link
Contributor

jasdel commented Oct 29, 2020

Confirm by changing [ ] to [x] below to ensure that it's a bug:

Describe the bug
When an API operation call is made with an operation that has an endpoint prefix, the request signature that is computed does not include that prefix. This results in an invalid signature

Version of AWS SDK for Go?
v0.28.0

Version of Go (go version)?
go1.15.1

To Reproduce (observed behavior)

_, err = client.ListJobs(context.Background(), &s3control.ListJobsInput{
	AccountId: &accountId,
}, func(o *s3control.Options) {
	o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error {
		log.Println(stack.String())
		return nil
	})
})
if err != nil {
	log.Fatalf("request failed, %v", err)
}

Expected behavior
Successful request

Wire output

2020/10/29 08:25:24 Request
GET /v20180820/jobs HTTP/0.0
Host: <accId>.s3-control.us-west-2.amazonaws.com
Amz-Sdk-Invocation-Id: da0f3f72-f342-473e-8ca8-6bab68bf090e
Amz-Sdk-Request: attempt=1; max=3
Authorization: <auth>
 25
User-Agent: aws-sdk-go-v2/0.28.0 GOOS/darwin GOARCH/amd64 GO/go1.15.1 s3control
X-Amz-Account-Id: <accId>
X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
X-Amz-Date: 20201029T152524Z

2020/10/29 08:25:24 Response
HTTP/1.1 403 Forbidden
Transfer-Encoding: chunked
Content-Type: application/xml
Date: Thu, 29 Oct 2020 15:25:24 GMT
Server: AmazonS3
X-Amz-Id-2: Jm3tTRaXSHjE7u4r5Thd8DTqm8Aq6wlqd44EhMgWKsMEaQE8zBp+1k9Mqv9daT/70mPhoCrMq2c=
X-Amz-Request-Id: 81C695261D5B0C66

c11
<?xml version="1.0" encoding="UTF-8"?>
<ErrorResponse><Error><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message><AWSAccessKeyId><akid></AWSAccessKeyId><StringToSign>AWS4-HMAC-SHA256
20201029T152524Z
20201029/us-west-2/s3/aws4_request
32a63abb2ff103d88958e1aca44c388d163690cd97f44503b0040e615a1b8e94</StringToSign><SignatureProvided>53f5294d133c99926fded951c097729e1e89084041f20ac43bf1967253c99b64</SignatureProvided><StringToSignBytes>41 57 53 34 2d 48 4d 41 43 2d 53 48 41 32 35 36 0a 32 30 32 30 31 30 32 39 54 31 35 32 35 32 34 5a 0a 32 30 32 30 31 30 32 39 2f 75 73 2d 77 65 73 74 2d 32 2f 73 33 2f 61 77 73 34 5f 72 65 71 75 65 73 74 0a 33 32 61 36 33 61 62 62 32 66 66 31 30 33 64 38 38 39 35 38 65 31 61 63 61 34 34 63 33 38 38 64 31 36 33 36 39 30 63 64 39 37 66 34 34 35 30 33 62 30 30 34 30 65 36 31 35 61 31 62 38 65 39 34</StringToSignBytes><CanonicalRequest>GET
/v20180820/jobs

amz-sdk-invocation-id:da0f3f72-f342-473e-8ca8-6bab68bf090e
amz-sdk-request:attempt=1; max=3
host:<accId>.s3-control.us-west-2.amazonaws.com
x-amz-account-id:<accId>
x-amz-content-sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
x-amz-date:20201029T152524Z

amz-sdk-invocation-id;amz-sdk-request;host;x-amz-account-id;x-amz-content-sha256;x-amz-date
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855</CanonicalRequest><CanonicalRequestBytes>47 45 54 0a 2f 76 32 30 31 38 30 38 32 30 2f 6a 6f 62 73 0a 0a 61 6d 7a 2d 73 64 6b 2d 69 6e 76 6f 63 61 74 69 6f 6e 2d 69 64 3a 64 61 30 66 33 66 37 32 2d 66 33 34 32 2d 34 37 33 65 2d 38 63 61 38 2d 36 62 61 62 36 38 62 66 30 39 30 65 0a 61 6d 7a 2d 73 64 6b 2d 72 65 71 75 65 73 74 3a 61 74 74 65 6d 70 74 3d 31 3b 20 6d 61 78 3d 33 0a 68 6f 73 74 3a 37 36 36 39 37 30 30 32 36 39 34 30 2e 73 33 2d 63 6f 6e 74 72 6f 6c 2e 75 73 2d 77 65 73 74 2d 32 2e 61 6d 61 7a 6f 6e 61 77 73 2e 63 6f 6d 0a 78 2d 61 6d 7a 2d 61 63 63 6f 75 6e 74 2d 69 64 3a 37 36 36 39 37 30 30 32 36 39 34 30 0a 78 2d 61 6d 7a 2d 63 6f 6e 74 65 6e 74 2d 73 68 61 32 35 36 3a 65 33 62 30 63 34 34 32 39 38 66 63 31 63 31 34 39 61 66 62 66 34 63 38 39 39 36 66 62 39 32 34 32 37 61 65 34 31 65 34 36 34 39 62 39 33 34 63 61 34 39 35 39 39 31 62 37 38 35 32 62 38 35 35 0a 78 2d 61 6d 7a 2d 64 61 74 65 3a 32 30 32 30 31 30 32 39 54 31 35 32 35 32 34 5a 0a 0a 61 6d 7a 2d 73 64 6b 2d 69 6e 76 6f 63 61 74 69 6f 6e 2d 69 64 3b 61 6d 7a 2d 73 64 6b 2d 72 65 71 75 65 73 74 3b 68 6f 73 74 3b 78 2d 61 6d 7a 2d 61 63 63 6f 75 6e 74 2d 69 64 3b 78 2d 61 6d 7a 2d 63 6f 6e 74 65 6e 74 2d 73 68 61 32 35 36 3b 78 2d 61 6d 7a 2d 64 61 74 65 0a 65 33 62 30 63 34 34 32 39 38 66 63 31 63 31 34 39 61 66 62 66 34 63 38 39 39 36 66 62 39 32 34 32 37 61 65 34 31 65 34 36 34 39 62 39 33 34 63 61 34 39 35 39 39 31 62 37 38 35 32 62 38 35 35</CanonicalRequestBytes></Error><RequestId>81C695261D5B0C66</RequestId><HostId>Jm3tTRaXSHjE7u4r5Thd8DTqm8Aq6wlqd44EhMgWKsMEaQE8zBp+1k9Mqv9daT/70mPhoCrMq2c=</HostId></ErrorResponse>
0

2020/10/29 08:25:24 request failed, operation error S3 Control: ListJobs, https response error StatusCode: 403, RequestID: 81C695261D5B0C66, HostID: Jm3tTRaXSHjE7u4r5Thd8DTqm8Aq6wlqd44EhMgWKsMEaQE8zBp+1k9Mqv9daT/70mPhoCrMq2c=, api error UnknownError: UnknownError
exit status 1
@github-actions
Copy link

github-actions bot commented Nov 9, 2020

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug.
Projects
None yet
1 participant