Skip to content

Commit 6d04080

Browse files
committed
fix
1 parent 41a2fff commit 6d04080

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

.github/workflows/check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ jobs:
9393
run: |
9494
banner="$(python -m credsweeper --banner | grep CredSweeper | head -1)"
9595
echo "banner = '${banner}'"
96-
if [ "CredSweeper 1.15.3 crc32:0d332b1f" != "${banner}" ]; then
96+
if [ "CredSweeper 1.15.3 crc32:4dac77cb" != "${banner}" ]; then
9797
echo "Update the check for '${banner}'"
9898
exit 1
9999
fi

credsweeper/utils/pem_key_detector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def detect_pem_key(cls, config: Config, target: AnalysisTarget) -> List[LineData
9090
return line_data
9191
logger.debug("Filtered with non asn1 '%s'", key_data)
9292
return []
93-
# PEM_END_PATTERN not in subline
93+
# else - PEM_END_PATTERN not in subline
9494
sanitized_line = cls.sanitize_line(subline)
9595
# PEM key line should not contain spaces or . (and especially not ...)
9696
for i in sanitized_line:

credsweeper/utils/util.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,8 @@ def get_asn1_size(data: Union[bytes, bytearray]) -> int:
263263
if data.endswith(b"\x00\x00"):
264264
# assume, all data are ASN1 of various size
265265
return len(data)
266-
# skip the case where the ASN1 size is smaller than the actual data
267-
return 0
268-
if 0x80 < length:
266+
# else - skip the case where the ASN1 size is smaller than the actual data
267+
elif 0x80 < length:
269268
byte_len = 0x7F & length
270269
len_limit = 2 + byte_len
271270
if 4 >= byte_len and len(data) >= len_limit:
@@ -275,12 +274,12 @@ def get_asn1_size(data: Union[bytes, bytearray]) -> int:
275274
length |= data[i]
276275
if len(data) >= length + len_limit:
277276
return length + len_limit
278-
else:
279-
# unsupported huge size
280-
return 0
281-
# length is less than 0x80
282-
if len(data) >= length + 2:
283-
return length + 2
277+
# else - unsupported huge size
278+
else:
279+
# length is less than 0x80
280+
if len(data) >= length + 2:
281+
return length + 2
282+
# fallback - unsupported
284283
return 0
285284

286285
@staticmethod

0 commit comments

Comments
 (0)