From c66fa99f7090a662991117b222d529c509974366 Mon Sep 17 00:00:00 2001 From: jonathan343 Date: Mon, 28 Oct 2024 07:34:47 -0400 Subject: [PATCH] Revert "Ignore x-amz-checksum-algorithm when checking for user supplied checksums." This reverts commit 93a47ebafb9e71474c358cf1ffd78e5b8cfb9e08. --- botocore/utils.py | 2 +- tests/unit/test_httpchecksum.py | 22 ---------------------- 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/botocore/utils.py b/botocore/utils.py index dd2369e788..a531972d63 100644 --- a/botocore/utils.py +++ b/botocore/utils.py @@ -185,7 +185,7 @@ # This pattern can be used to detect if a header is a flexible checksum header CHECKSUM_HEADER_PATTERN = re.compile( - r'^x-amz-checksum-(?!algorithm\b)([a-z0-9]*)$', + r'^X-Amz-Checksum-([a-z0-9]*)$', flags=re.IGNORECASE, ) diff --git a/tests/unit/test_httpchecksum.py b/tests/unit/test_httpchecksum.py index d02aa23971..84f1d07998 100644 --- a/tests/unit/test_httpchecksum.py +++ b/tests/unit/test_httpchecksum.py @@ -259,28 +259,6 @@ def test_request_checksum_algorithm_model_new_crc32(self): } self.assertEqual(actual_algorithm, expected_algorithm) - def test_x_amz_checksum_algorithm_header_is_ignored(self): - request = self._build_request(b"") - request["headers"]["x-amz-checksum-algorithm"] = "some_value" - operation_model = self._make_operation_model( - http_checksum={"requestAlgorithmMember": "Algorithm"} - ) - params = {} - - resolve_request_checksum_algorithm(request, operation_model, params) - self.assertIn("checksum", request["context"]) - - def test_non_x_amz_checksum_algorithm_header_is_not_ignored(self): - request = self._build_request(b"") - request["headers"]["x-amz-checksum-someChecksum"] = "some_value" - operation_model = self._make_operation_model( - http_checksum={"requestAlgorithmMember": "Algorithm"} - ) - params = {} - - resolve_request_checksum_algorithm(request, operation_model, params) - self.assertNotIn("checksum", request["context"]) - def test_apply_request_checksum_handles_no_checksum_context(self): request = self._build_request(b"") apply_request_checksum(request)