diff --git a/botocore/auth.py b/botocore/auth.py index 194535f2aa..8b6224b93b 100644 --- a/botocore/auth.py +++ b/botocore/auth.py @@ -330,7 +330,7 @@ def _modify_request_before_signing(self, request): class S3SigV4Auth(SigV4Auth): def _modify_request_before_signing(self, request): - super(S3SigV4Auth, self)._add_headers_before_signing(request) + super(S3SigV4Auth, self)._modify_request_before_signing(request) request.headers['X-Amz-Content-SHA256'] = self.payload(request) def _normalize_url_path(self, path): diff --git a/tests/unit/auth/test_signers.py b/tests/unit/auth/test_signers.py index 8e4b3edf5a..66ee636645 100644 --- a/tests/unit/auth/test_signers.py +++ b/tests/unit/auth/test_signers.py @@ -124,6 +124,19 @@ def test_signature_with_date_headers(self): 'Signature=M245fo86nVKI8rLpH4HgWs841sBTUKuwciiTpjMDgPs=')) +class TestS3SigV4Auth(unittest.TestCase): + def test_signature_is_not_normalized(self): + request = AWSRequest() + request.url = 'https://s3.amazonaws.com/bucket/foo/./bar/../bar' + request.method = 'GET' + credentials = botocore.credentials.Credentials('access_key', + 'secret_key') + auth = botocore.auth.S3SigV4Auth(credentials, 's3', 'us-east-1') + auth.add_auth(request) + self.assertTrue( + request.headers['Authorization'].startswith('AWS4-HMAC-SHA256')) + + class TestSigV4Presign(unittest.TestCase): maxDiff = None