Skip to content

Commit 31039b4

Browse files
authored
Merge pull request #315 from tlsfuzzer/codeql
Add CodeQL fixes
2 parents cd5ac4f + 439e452 commit 31039b4

File tree

8 files changed

+66
-324
lines changed

8 files changed

+66
-324
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
[![Documentation Status](https://readthedocs.org/projects/ecdsa/badge/?version=latest)](https://ecdsa.readthedocs.io/en/latest/?badge=latest)
55
[![Coverage Status](https://coveralls.io/repos/github/tlsfuzzer/python-ecdsa/badge.svg?branch=master)](https://coveralls.io/github/tlsfuzzer/python-ecdsa?branch=master)
66
![condition coverage](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/tomato42/9b6ca1f3410207fbeca785a178781651/raw/python-ecdsa-condition-coverage.json)
7-
[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/tlsfuzzer/python-ecdsa.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/tlsfuzzer/python-ecdsa/context:python)
8-
[![Total alerts](https://img.shields.io/lgtm/alerts/g/tlsfuzzer/python-ecdsa.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/tlsfuzzer/python-ecdsa/alerts/)
7+
[![CodeQL](https://github.com/tlsfuzzer/python-ecdsa/actions/workflows/codeql.yml/badge.svg)](https://github.com/tlsfuzzer/python-ecdsa/actions/workflows/codeql.yml)
98
[![Latest Version](https://img.shields.io/pypi/v/ecdsa.svg?style=flat)](https://pypi.python.org/pypi/ecdsa/)
109
![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg?style=flat)
1110

docs/source/conf.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,3 @@
6868
"undoc-members": True,
6969
"inherited-members": True,
7070
}
71-
72-
intersphinx_mapping = {"https://docs.python.org/": None}

src/ecdsa/_rwlock.py

Lines changed: 0 additions & 86 deletions
This file was deleted.

src/ecdsa/test_eddsa.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,7 @@ def test_equal_public_points(self):
500500
key2 = PublicKey(generator_ed25519, b"\x01" * 32)
501501

502502
self.assertEqual(key1, key2)
503+
# verify that `__ne__` works as expected
503504
self.assertFalse(key1 != key2)
504505

505506
def test_unequal_public_points(self):
@@ -519,20 +520,23 @@ def test_unequal_publickey_curves(self):
519520
key2 = PublicKey(generator_ed448, b"\x03" * 56 + b"\x00")
520521

521522
self.assertNotEqual(key1, key2)
523+
# verify that `__ne__` works as expected
522524
self.assertTrue(key1 != key2)
523525

524526
def test_equal_private_keys(self):
525527
key1 = PrivateKey(generator_ed25519, b"\x01" * 32)
526528
key2 = PrivateKey(generator_ed25519, b"\x01" * 32)
527529

528530
self.assertEqual(key1, key2)
531+
# verify that `__ne__` works as expected
529532
self.assertFalse(key1 != key2)
530533

531534
def test_unequal_private_keys(self):
532535
key1 = PrivateKey(generator_ed25519, b"\x01" * 32)
533536
key2 = PrivateKey(generator_ed25519, b"\x02" * 32)
534537

535538
self.assertNotEqual(key1, key2)
539+
# verify that `__ne__` works as expected
536540
self.assertTrue(key1 != key2)
537541

538542
def test_unequal_privatekey_to_string(self):

src/ecdsa/test_keys.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -769,8 +769,8 @@ def test_deterministic_sign_that_rises_S_zero_error(self):
769769
verifiers = []
770770
for modifier, fun in [
771771
("bytes", lambda x: x),
772-
("bytes memoryview", lambda x: buffer(x)),
773-
("bytearray", lambda x: bytearray(x)),
772+
("bytes memoryview", buffer),
773+
("bytearray", bytearray),
774774
("bytearray memoryview", lambda x: buffer(bytearray(x))),
775775
("array.array of bytes", lambda x: array.array("B", x)),
776776
("array.array of bytes memoryview", lambda x: buffer(array.array("B", x))),

src/ecdsa/test_malformed_sigs.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ def st_fuzzed_sig(draw, keys_and_sigs):
111111
note("Remove bytes: {0}".format(to_remove))
112112

113113
# decide which bytes of the original signature should be changed
114+
xors = None
114115
if sig: # pragma: no branch
115116
xors = draw(
116117
st.dictionaries(
@@ -288,15 +289,13 @@ def st_der():
288289
| st_der_octet_string(max_size=1024**2)
289290
| st_der_null()
290291
| st_der_oid(),
291-
lambda children: st.builds(
292-
lambda x: encode_octet_string(x), st.one_of(children)
293-
)
292+
lambda children: st.builds(encode_octet_string, st.one_of(children))
294293
| st.builds(lambda x: encode_bitstring(x, 0), st.one_of(children))
295294
| st.builds(
296295
lambda x: encode_sequence(*x), st.lists(children, max_size=200)
297296
)
298297
| st.builds(
299-
lambda tag, x: encode_constructed(tag, x),
298+
encode_constructed,
300299
st.integers(min_value=0, max_value=0x3F),
301300
st.one_of(children),
302301
),

0 commit comments

Comments
 (0)