Skip to content

Commit 9a4850a

Browse files
committed
Remove more pretty_bad_protocol monkeypatching
This is no longer needed since we don't pass SecureTemporaryFile to pretty_bad_protocol anymore, it goes to Sequoia instead.
1 parent 0ac5847 commit 9a4850a

2 files changed

Lines changed: 0 additions & 12 deletions

File tree

securedrop/secure_tempfile.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from cryptography.hazmat.primitives.ciphers import Cipher
99
from cryptography.hazmat.primitives.ciphers.algorithms import AES
1010
from cryptography.hazmat.primitives.ciphers.modes import CTR
11-
from pretty_bad_protocol._util import _STREAMLIKE_TYPES
1211

1312

1413
class SecureTemporaryFile(_TemporaryFileWrapper):
@@ -134,9 +133,3 @@ def close(self) -> None:
134133
# Since tempfile._TemporaryFileWrapper.close() does other cleanup,
135134
# (i.e. deleting the temp file on disk), we need to call it also.
136135
super().close()
137-
138-
139-
# python-gnupg will not recognize our SecureTemporaryFile as a stream-like type
140-
# and will attempt to call encode on it, thinking it's a string-like type. To
141-
# avoid this we append it the list of stream-like types.
142-
_STREAMLIKE_TYPES.append(_TemporaryFileWrapper)

securedrop/tests/test_secure_tempfile.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import os
22

33
import pytest
4-
from pretty_bad_protocol._util import _is_stream
54
from secure_tempfile import SecureTemporaryFile
65

76
MESSAGE = "410,757,864,530"
@@ -78,10 +77,6 @@ def test_file_is_removed_from_disk():
7877
assert not os.path.exists(f.filepath)
7978

8079

81-
def test_SecureTemporaryFile_is_a_STREAMLIKE_TYPE():
82-
assert _is_stream(SecureTemporaryFile("/tmp"))
83-
84-
8580
def test_buffered_read():
8681
f = SecureTemporaryFile("/tmp")
8782
msg = MESSAGE * 1000

0 commit comments

Comments
 (0)