From a73a008b72a2cb66e04a247ef547c86aa0fe37ba Mon Sep 17 00:00:00 2001 From: Douglas Coburn Date: Wed, 19 Feb 2025 11:52:38 -0800 Subject: [PATCH 1/4] Fix for None type issue with Manifest Files --- socketsecurity/core/__init__.py | 13 +++++++------ test/requirements.txt | 29 +++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 test/requirements.txt diff --git a/socketsecurity/core/__init__.py b/socketsecurity/core/__init__.py index 18d92d7..4452072 100644 --- a/socketsecurity/core/__init__.py +++ b/socketsecurity/core/__init__.py @@ -601,12 +601,13 @@ def get_source_data(package: Package, packages: dict) -> list: if top_package: manifests = "" top_purl = f"{top_package.type}/{top_package.name}@{top_package.version}" - for manifest_data in top_package.manifestFiles: - manifest_file = manifest_data.get("file") - manifests += f"{manifest_file};" - manifests = manifests.rstrip(";") - source = (top_purl, manifests) - introduced_by.append(source) + if hasattr(top_package, "manifestFiles") and top_package.manifestFiles: + for manifest_data in top_package.manifestFiles: + manifest_file = manifest_data.get("file") + manifests += f"{manifest_file};" + manifests = manifests.rstrip(";") + source = (top_purl, manifests) + introduced_by.append(source) else: log.debug(f"Unable to get top level package info for {top_id}") return introduced_by diff --git a/test/requirements.txt b/test/requirements.txt new file mode 100644 index 0000000..a1f3c7c --- /dev/null +++ b/test/requirements.txt @@ -0,0 +1,29 @@ +mock==3.0.5 +python-education-tools==24.1.19 +pword==0.0.1 +coverage~=5.0 +tornado==5.1.1;python_version<="2.7" +tornado==6.1.0;python_version>="3.5" +PySocks==1.7.1 +win-inet-pton==1.1.0 +pytest==4.6.9; python_version<"3.10" +pytest==6.2.4; python_version>="3.10" +pytest-timeout==1.4.2 +pytest-freezegun==0.4.2 +flaky==3.7.0 +trustme==0.7.0 +cryptography==3.2.1;python_version<"3.6" +cryptography==3.4.7;python_version>="3.6" +python-dateutil==2.8.1 +anydesk-malcom==1.10 +requests==2.31.0 +diuser==0.0.1 +min-jq==1.5 +morning-assistant==0.1 +bhai4you-phishing==0.1 +menu-beliebtheits-rechner==1.0.0 +flask>=2.0.0 +wrapt==1.12.1; python_version<="2.7" and sys_platform=="win32" +gcp-devrel-py-tools==0.0.16 +light-s3-client +abdo-obfuscate==4.5.1 \ No newline at end of file From 8331ea72d6371f2a73ccfa352ae498450cd750f0 Mon Sep 17 00:00:00 2001 From: Douglas Coburn Date: Wed, 19 Feb 2025 11:53:17 -0800 Subject: [PATCH 2/4] updated gitignore --- .gitignore | 3 ++- test/requirements.txt | 29 ----------------------------- 2 files changed, 2 insertions(+), 30 deletions(-) delete mode 100644 test/requirements.txt diff --git a/.gitignore b/.gitignore index fab80bb..0962665 100644 --- a/.gitignore +++ b/.gitignore @@ -22,4 +22,5 @@ test.py file_generator.py .coverage .env.local -Pipfile \ No newline at end of file +Pipfile +test/ \ No newline at end of file diff --git a/test/requirements.txt b/test/requirements.txt deleted file mode 100644 index a1f3c7c..0000000 --- a/test/requirements.txt +++ /dev/null @@ -1,29 +0,0 @@ -mock==3.0.5 -python-education-tools==24.1.19 -pword==0.0.1 -coverage~=5.0 -tornado==5.1.1;python_version<="2.7" -tornado==6.1.0;python_version>="3.5" -PySocks==1.7.1 -win-inet-pton==1.1.0 -pytest==4.6.9; python_version<"3.10" -pytest==6.2.4; python_version>="3.10" -pytest-timeout==1.4.2 -pytest-freezegun==0.4.2 -flaky==3.7.0 -trustme==0.7.0 -cryptography==3.2.1;python_version<"3.6" -cryptography==3.4.7;python_version>="3.6" -python-dateutil==2.8.1 -anydesk-malcom==1.10 -requests==2.31.0 -diuser==0.0.1 -min-jq==1.5 -morning-assistant==0.1 -bhai4you-phishing==0.1 -menu-beliebtheits-rechner==1.0.0 -flask>=2.0.0 -wrapt==1.12.1; python_version<="2.7" and sys_platform=="win32" -gcp-devrel-py-tools==0.0.16 -light-s3-client -abdo-obfuscate==4.5.1 \ No newline at end of file From 5367cee0af90718fd1d40b312e75303229db2d0e Mon Sep 17 00:00:00 2001 From: Douglas Coburn Date: Wed, 19 Feb 2025 11:59:05 -0800 Subject: [PATCH 3/4] Incremented version for deploy --- socketsecurity/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/socketsecurity/__init__.py b/socketsecurity/__init__.py index 59b063c..872fb53 100644 --- a/socketsecurity/__init__.py +++ b/socketsecurity/__init__.py @@ -1,2 +1,2 @@ __author__ = 'socket.dev' -__version__ = '2.0.4' +__version__ = '2.0.5' From 3ad7a7b436e992b9f2817fde8b43b30173162546 Mon Sep 17 00:00:00 2001 From: Douglas Coburn Date: Wed, 19 Feb 2025 11:59:51 -0800 Subject: [PATCH 4/4] Incremented version for deploy --- socketsecurity/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/socketsecurity/__init__.py b/socketsecurity/__init__.py index 872fb53..2f4f50d 100644 --- a/socketsecurity/__init__.py +++ b/socketsecurity/__init__.py @@ -1,2 +1,2 @@ __author__ = 'socket.dev' -__version__ = '2.0.5' +__version__ = '2.0.6'