Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "enhancement",
"description": "Removed the `AWSSDKWarning` emitted during SigV4 payload signing. It fired on every signed request regardless of body size, adding noise on the default code path (and, under warnings-as-errors, could turn signing into a raised exception)."
}
15 changes: 1 addition & 14 deletions packages/aws-sdk-signers/src/aws_sdk_signers/signers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import datetime
import hmac
import io
import warnings
from binascii import hexlify
from collections.abc import AsyncIterable, Iterable
from copy import deepcopy
Expand All @@ -16,7 +15,7 @@

from ._http import AWSRequest, Field, URI
from ._io import AsyncBytesReader
from .exceptions import AWSSDKWarning, MissingExpectedParameterException
from .exceptions import MissingExpectedParameterException
from .interfaces.identity import AWSCredentialsIdentity as _AWSCredentialsIdentity
from .interfaces.io import AsyncSeekable, ConditionallySeekable, Seekable

Expand Down Expand Up @@ -400,12 +399,6 @@ def _compute_payload_hash(
"of type Iterable[bytes]."
)

warnings.warn(
"Payload signing is enabled. This may result in "
"decreased performance for large request bodies.",
AWSSDKWarning,
)

checksum = sha256()
if self._seekable(body):
position = body.tell()
Expand Down Expand Up @@ -791,12 +784,6 @@ async def _compute_payload_hash(
"SigV4Signer for sync AWSRequests or ensure your body is "
"of type AsyncIterable[bytes]."
)
warnings.warn(
"Payload signing is enabled. This may result in "
"decreased performance for large request bodies.",
AWSSDKWarning,
)

checksum = sha256()
if self._seekable(body):
position = body.tell()
Expand Down
37 changes: 16 additions & 21 deletions packages/aws-sdk-signers/tests/unit/auth/test_sigv4.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
Fields,
URI,
)
from aws_sdk_signers.exceptions import AWSSDKWarning
from aws_sdk_signers.signers import (
SIGV4_TIMESTAMP_FORMAT,
AsyncSigV4Signer,
Expand Down Expand Up @@ -103,21 +102,19 @@ def _test_signature_version_4_sync(test_case_name: str, signer: SigV4Signer) ->
signing_props = SigV4SigningProperties(
region=REGION, service=SERVICE, date=DATE_STR
)
with pytest.warns(AWSSDKWarning):
actual_canonical_request = signer.canonical_request(
signing_properties=signing_props, request=request
)
actual_canonical_request = signer.canonical_request(
signing_properties=signing_props, request=request
)
assert test_case.canonical_request == actual_canonical_request
actual_string_to_sign = signer.string_to_sign(
canonical_request=actual_canonical_request, signing_properties=signing_props
)
assert test_case.string_to_sign == actual_string_to_sign
with pytest.warns(AWSSDKWarning):
signed_request = signer.sign(
properties=signing_props,
request=request,
identity=test_case.credentials,
)
signed_request = signer.sign(
properties=signing_props,
request=request,
identity=test_case.credentials,
)
assert (
signed_request.fields["Authorization"].as_string()
== test_case.authorization_header
Expand All @@ -142,21 +139,19 @@ async def _test_signature_version_4_async(
service=SERVICE,
date=DATE_STR,
)
with pytest.warns(AWSSDKWarning):
actual_canonical_request = await signer.canonical_request(
signing_properties=signing_props, request=request
)
actual_canonical_request = await signer.canonical_request(
signing_properties=signing_props, request=request
)
assert test_case.canonical_request == actual_canonical_request
actual_string_to_sign = await signer.string_to_sign(
canonical_request=actual_canonical_request, signing_properties=signing_props
)
assert test_case.string_to_sign == actual_string_to_sign
with pytest.warns(AWSSDKWarning):
signed_request = await signer.sign(
properties=signing_props,
request=request,
identity=test_case.credentials,
)
signed_request = await signer.sign(
properties=signing_props,
request=request,
identity=test_case.credentials,
)
assert (
signed_request.fields["Authorization"].as_string()
== test_case.authorization_header
Expand Down
Loading