File tree 1 file changed +12
-0
lines changed
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -114,6 +114,18 @@ def sha256_streaming(io: IO[bytes]) -> bytes:
114
114
should be supplied for optimal performance.
115
115
"""
116
116
117
+ # NOTE: This function performs a SHA256 digest over a stream.
118
+ # The stream's size is not checked, meaning that the stream's source
119
+ # is implicitly trusted: if an attacker is able to truncate the stream's
120
+ # source prematurely, then they could conceivably produce a digest
121
+ # for a partial stream. This in turn could conceivably result
122
+ # in a valid signature for an unintended (truncated) input.
123
+ #
124
+ # This is currently outside of sigstore-python's threat model: we
125
+ # assume that the stream is trusted.
126
+ #
127
+ # See: https://github.com/sigstore/sigstore-python/pull/329#discussion_r1041215972
128
+
117
129
sha256 = hashlib .sha256 ()
118
130
# Per coreutils' ioblksize.h: 128KB performs optimally across a range
119
131
# of systems in terms of minimizing syscall overhead.
You can’t perform that action at this time.
0 commit comments