Skip to content

Commit 55485a1

Browse files
authored
Merge pull request #97 from RIPE-NCC/fix_sec_issues
Fix sec issues
2 parents 30616d3 + 1c70963 commit 55485a1

6 files changed

Lines changed: 12 additions & 12 deletions

File tree

.github/workflows/python-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
path: dist/
6363
- name: Push to pypi
6464
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
65-
uses: pypa/gh-action-pypi-publish@release/v1.13
65+
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # release/v1.13
6666
with:
6767
user: __token__
6868
password: ${{ secrets.PYPI_API_TOKEN }}

docs/conf.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@
1212
# All configuration values have a default; values that are commented out
1313
# serve to show the default.
1414

15+
import re
1516
import sys
1617
import os
1718

18-
__version__ = None
19-
exec(open("../ripe/atlas/sagan/version.py").read())
19+
with open("../ripe/atlas/sagan/version.py") as f:
20+
__version__ = re.search(r'^__version__\s*=\s*["\']([^"\']+)["\']', f.read(), re.M).group(1)
2021

2122
# If extensions (or modules to document with autodoc) are in another directory,
2223
# add these directories to sys.path here. If the directory is relative to the

ripe/atlas/sagan/ssl.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ def __init__(self, data, **kwargs):
6565
cert = x509.load_pem_x509_certificate(data.encode("ascii"), openssl.backend)
6666

6767
if cert:
68-
self.checksum_md5 = self._colonify(cert.fingerprint(hashes.MD5()))
69-
self.checksum_sha1 = self._colonify(cert.fingerprint(hashes.SHA1()))
68+
self.checksum_md5 = self._colonify(cert.fingerprint(hashes.MD5())) # nosec B303 - reporting cert fingerprint only, not used for security
69+
self.checksum_sha1 = self._colonify(cert.fingerprint(hashes.SHA1())) # nosec B303 - reporting cert fingerprint only, not used for security
7070
self.checksum_sha256 = self._colonify(cert.fingerprint(hashes.SHA256()))
7171

7272
self.valid_from = pytz.utc.localize(cert.not_valid_before)

ripe/atlas/sagan/traceroute.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,8 @@ def ip_path(self):
217217

218218
def _parse_hops(self, parse_all_hops=True, **kwargs):
219219

220-
try:
221-
hops = self.raw_data["result"]
222-
assert(isinstance(hops, list))
223-
except (KeyError, AssertionError):
220+
hops = self.raw_data.get("result")
221+
if not isinstance(hops, list):
224222
self._handle_malformation("Legacy formats not supported")
225223
return
226224

ripe/atlas/sagan/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# You should have received a copy of the GNU General Public License
1414
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1515

16-
__version__ = "2.0.0"
16+
__version__ = "2.0.1"

setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import os
2+
import re
23
from os.path import abspath, dirname, join
34
from setuptools import setup
45

5-
__version__ = None
6-
exec(open("ripe/atlas/sagan/version.py").read())
6+
with open("ripe/atlas/sagan/version.py") as f:
7+
__version__ = re.search(r'^__version__\s*=\s*["\']([^"\']+)["\']', f.read(), re.M).group(1)
78

89
name = "ripe.atlas.sagan"
910
install_requires = [

0 commit comments

Comments
 (0)