Skip to content

Commit

Permalink
fix: return only inspector links from wheel absence heuristic
Browse files Browse the repository at this point in the history
  • Loading branch information
art1f1c3R committed Dec 5, 2024
1 parent e273391 commit a2fca77
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ def analyze(self, pypi_package_json: PyPIPackageJsonAsset) -> tuple[HeuristicRes
logger.debug(error_msg)
raise HeuristicAnalyzerValueError(error_msg)

file_server_links: list[JsonType] = []
inspector_links: list[JsonType] = []
wheel_present: bool = False

Expand All @@ -91,7 +90,6 @@ def analyze(self, pypi_package_json: PyPIPackageJsonAsset) -> tuple[HeuristicRes
if send_head_http_raw(inspector_link) is None:
inspector_link = None

file_server_links.append(release_metadata["url"])
inspector_links.append(inspector_link)

except KeyError as error:
Expand All @@ -100,8 +98,6 @@ def analyze(self, pypi_package_json: PyPIPackageJsonAsset) -> tuple[HeuristicRes
raise HeuristicAnalyzerValueError(error_msg) from error

detail_info: dict[str, JsonType] = {
"version": version,
"file_server_links": file_server_links,
"inspector_links": inspector_links,
}

Expand Down
6 changes: 0 additions & 6 deletions tests/malware_analyzer/pypi/test_wheel_absence.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ def test_analyze_tar_present(mock_send_head_http_raw: MagicMock, pypi_package_js
mock_send_head_http_raw.return_value = MagicMock() # assume valid URL for testing purposes

expected_detail_info = {
"version": version,
"file_server_links": [url],
"inspector_links": [inspector_link_expected],
}

Expand Down Expand Up @@ -131,8 +129,6 @@ def test_analyze_whl_present(mock_send_head_http_raw: MagicMock, pypi_package_js
mock_send_head_http_raw.return_value = MagicMock() # assume valid URL for testing purposes

expected_detail_info = {
"version": version,
"file_server_links": [url],
"inspector_links": [inspector_link_expected],
}

Expand Down Expand Up @@ -219,8 +215,6 @@ def test_analyze_both_present(mock_send_head_http_raw: MagicMock, pypi_package_j
mock_send_head_http_raw.return_value = MagicMock() # assume valid URL for testing purposes

expected_detail_info = {
"version": version,
"file_server_links": [wheel_url, tar_url],
"inspector_links": [wheel_link_expected, tar_link_expected],
}

Expand Down

0 comments on commit a2fca77

Please sign in to comment.