diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 8115435f6..80b7fc304 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,7 +2,7 @@ Changelog ********* -1.x.x -- 201x-xx-xx +1.4.0 -- 2019-05-23 =================== Minor @@ -11,6 +11,19 @@ Minor * Remove dependence on all ``source_stream`` APIs except for ``read()``. `#103 `_ +Potentially Backwards Incompatible +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +* Encryption streams no longer close the ``source_stream`` when they themselves close. + If you are using context managers for all of your stream handling, + this change will not affect you. + However, if you have been relying on the ``StreamDecryptor`` + or ``StreamEncryptor`` to close your ``source_stream`` for you, + you will now need to close those streams yourself. +* ``StreamDecryptor.body_start`` and ``StreamDecryptor.body_end``, + deprecated in a prior release, + have now been removed. + Maintenance ----------- diff --git a/src/aws_encryption_sdk/identifiers.py b/src/aws_encryption_sdk/identifiers.py index 35a29d74d..1bd9bb1f1 100644 --- a/src/aws_encryption_sdk/identifiers.py +++ b/src/aws_encryption_sdk/identifiers.py @@ -27,7 +27,7 @@ # We only actually need these imports when running the mypy checks pass -__version__ = "1.3.8" +__version__ = "1.4.0" USER_AGENT_SUFFIX = "AwsEncryptionSdkPython/{}".format(__version__) diff --git a/src/aws_encryption_sdk/streaming_client.py b/src/aws_encryption_sdk/streaming_client.py index 2132ea177..90dc9d25c 100644 --- a/src/aws_encryption_sdk/streaming_client.py +++ b/src/aws_encryption_sdk/streaming_client.py @@ -781,18 +781,6 @@ def _read_header(self): validate_header(header=header, header_auth=header_auth, raw_header=raw_header, data_key=self._derived_data_key) return header, header_auth - @property - def body_start(self): - """Log deprecation warning when body_start is accessed.""" - _LOGGER.warning("StreamDecryptor.body_start is deprecated and will be removed in 1.4.0") - return self._body_start - - @property - def body_end(self): - """Log deprecation warning when body_end is accessed.""" - _LOGGER.warning("StreamDecryptor.body_end is deprecated and will be removed in 1.4.0") - return self._body_end - def _prep_non_framed(self): """Prepare the opening data for a non-framed message.""" self._unframed_body_iv, self.body_length = deserialize_non_framed_values( diff --git a/test/functional/test_f_aws_encryption_sdk_client.py b/test/functional/test_f_aws_encryption_sdk_client.py index 3686ccead..f7ffa6dd6 100644 --- a/test/functional/test_f_aws_encryption_sdk_client.py +++ b/test/functional/test_f_aws_encryption_sdk_client.py @@ -810,6 +810,17 @@ def test_decrypt_minimal_source_stream_api(frame_length, wrapping_class): assert plaintext == decrypted +def _assert_deprecated_but_not_yet_removed(logcap, instance, attribute_name, error_message, no_later_than): + assert hasattr(instance, attribute_name) + assert error_message in logcap.text + assert aws_encryption_sdk.__version__ < no_later_than + + +def _assert_decrypted_and_removed(instance, attribute_name, removed_in): + assert not hasattr(instance, attribute_name) + assert aws_encryption_sdk.__version__ >= removed_in + + @pytest.mark.parametrize("attribute, no_later_than", (("body_start", "1.4.0"), ("body_end", "1.4.0"))) def test_decryptor_deprecated_attributes(caplog, attribute, no_later_than): caplog.set_level(logging.WARNING) @@ -820,9 +831,19 @@ def test_decryptor_deprecated_attributes(caplog, attribute, no_later_than): decrypted = decryptor.read() assert decrypted == plaintext - assert hasattr(decryptor, attribute) - watch_string = "StreamDecryptor.{name} is deprecated and will be removed in {version}".format( - name=attribute, version=no_later_than - ) - assert watch_string in caplog.text - assert aws_encryption_sdk.__version__ < no_later_than + if aws_encryption_sdk.__version__ < no_later_than: + _assert_deprecated_but_not_yet_removed( + logcap=caplog, + instance=decryptor, + attribute_name=attribute, + error_message="StreamDecryptor.{name} is deprecated and will be removed in {version}".format( + name=attribute, version=no_later_than + ), + no_later_than=no_later_than + ) + else: + _assert_decrypted_and_removed( + instance=decryptor, + attribute_name=attribute, + removed_in=no_later_than + ) diff --git a/test/unit/test_streaming_client_stream_decryptor.py b/test/unit/test_streaming_client_stream_decryptor.py index 362c97f66..6a3ccb56d 100644 --- a/test/unit/test_streaming_client_stream_decryptor.py +++ b/test/unit/test_streaming_client_stream_decryptor.py @@ -238,8 +238,8 @@ def test_prep_non_framed(self): stream=test_decryptor.source_stream, header=self.mock_header, verifier=sentinel.verifier ) assert test_decryptor.body_length == len(VALUES["data_128"]) - assert test_decryptor.body_start == self.mock_header.algorithm.iv_len + 8 - assert test_decryptor.body_end == self.mock_header.algorithm.iv_len + 8 + len(VALUES["data_128"]) + assert test_decryptor._body_start == self.mock_header.algorithm.iv_len + 8 + assert test_decryptor._body_end == self.mock_header.algorithm.iv_len + 8 + len(VALUES["data_128"]) def test_read_bytes_from_non_framed(self): ct_stream = io.BytesIO(VALUES["data_128"])