generated from oracle/template-repo
-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Labels
bugSomething isn't workingSomething isn't workingmalware analysisThe issues related to malware analysisThe issues related to malware analysistriageThe issue needs to be triaged.The issue needs to be triaged.
Description
Description
The unit tests for pypi_sourcecode_analyzer.py
when no network connection is available will cause them to fail. The underlying reason for this is due to the network connections that are made by the subprocess Semgrep.
Steps to Reproduce
- Step 1: Run
pytest tests/malware_analyzer/pypi/test_pypi_sourcecode_analyzer.py
with no network connection.
Expected Behavior
All tests should pass.
Actual Behavior
The following three tests fail:
tests/malware_analyzer/pypi/test_pypi_sourcecode_analyzer.py::test_custom_rules FAILED
tests/malware_analyzer/pypi/test_pypi_sourcecode_analyzer.py::test_disabling_rulesets[test_disable_custom_ruleset] FAILED
tests/malware_analyzer/pypi/test_pypi_sourcecode_analyzer.py::test_disabling_rules FAILED
Debug Information
The following errors are raised and cause the tests to fail:
_________________________________________________________________________________________________ test_custom_rules _________________________________________________________________________________________________
Traceback (most recent call last):
File "/home/carl_flottmann/macaron/src/macaron/malware_analyzer/pypi_heuristics/sourcecode/pypi_sourcecode_analyzer.py", line 116, in _load_defaults
process = subprocess.run(semgrep_commands, check=True, capture_output=True) # nosec B603
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 571, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['semgrep', 'scan', '--validate', '--oss-only', '--config', '/home/carl_flottmann/macaron/tests/malware_analyzer/pypi/resources/custom_sample.yaml']' returned non-zero exit status 2.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/_pytest/runner.py", line 344, in from_call
result: TResult | None = func()
^^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/_pytest/runner.py", line 246, in <lambda>
lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_hooks.py", line 512, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_manager.py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 167, in _multicall
raise exception
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 139, in _multicall
teardown.throw(exception)
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/_pytest/logging.py", line 850, in pytest_runtest_call
yield
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 139, in _multicall
teardown.throw(exception)
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 53, in run_old_style_hookwrapper
return result.get_result()
^^^^^^^^^^^^^^^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_result.py", line 103, in get_result
raise exc.with_traceback(tb)
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 38, in run_old_style_hookwrapper
res = yield
^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 139, in _multicall
teardown.throw(exception)
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/_pytest/capture.py", line 900, in pytest_runtest_call
return (yield)
^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 139, in _multicall
teardown.throw(exception)
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 53, in run_old_style_hookwrapper
return result.get_result()
^^^^^^^^^^^^^^^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_result.py", line 103, in get_result
raise exc.with_traceback(tb)
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 38, in run_old_style_hookwrapper
res = yield
^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 139, in _multicall
teardown.throw(exception)
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/_pytest/skipping.py", line 263, in pytest_runtest_call
return (yield)
^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 121, in _multicall
res = hook_impl.function(*args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/_pytest/runner.py", line 178, in pytest_runtest_call
item.runtest()
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/_pytest/python.py", line 1670, in runtest
self.ihook.pytest_pyfunc_call(pyfuncitem=self)
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_hooks.py", line 512, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_manager.py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 167, in _multicall
raise exception
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 121, in _multicall
res = hook_impl.function(*args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/_pytest/python.py", line 156, in pytest_pyfunc_call
result = testfunction(**testargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/unittest/mock.py", line 1378, in patched
return func(*newargs, **newkeywargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/carl_flottmann/macaron/tests/malware_analyzer/pypi/test_pypi_sourcecode_analyzer.py", line 163, in test_custom_rules
analyzer = PyPISourcecodeAnalyzer(resources_path=RESOURCES_PATH)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/carl_flottmann/macaron/src/macaron/malware_analyzer/pypi_heuristics/sourcecode/pypi_sourcecode_analyzer.py", line 62, in __init__
self.default_rule_path, self.custom_rule_path, self.disabled_rule_ids = self._load_defaults(resources_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/carl_flottmann/macaron/src/macaron/malware_analyzer/pypi_heuristics/sourcecode/pypi_sourcecode_analyzer.py", line 123, in _load_defaults
raise ConfigurationError(error_msg) from semgrep_error
macaron.errors.ConfigurationError: Unable to run semgrep validation on /home/carl_flottmann/macaron/tests/malware_analyzer/pypi/resources/custom_sample.yaml with arguments ['semgrep', 'scan', '--validate', '--oss-only', '--config', '/home/carl_flottmann/macaron/tests/malware_analyzer/pypi/resources/custom_sample.yaml']: Command '['semgrep', 'scan', '--validate', '--oss-only', '--config', '/home/carl_flottmann/macaron/tests/malware_analyzer/pypi/resources/custom_sample.yaml']' returned non-zero exit status 2..
_______________________________________________________________________________ test_disabling_rulesets[test_disable_custom_ruleset] ________________________________________________________________________________
Traceback (most recent call last):
File "/home/carl_flottmann/macaron/src/macaron/malware_analyzer/pypi_heuristics/sourcecode/pypi_sourcecode_analyzer.py", line 116, in _load_defaults
process = subprocess.run(semgrep_commands, check=True, capture_output=True) # nosec B603
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 571, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['semgrep', 'scan', '--validate', '--oss-only', '--config', '/home/carl_flottmann/macaron/tests/malware_analyzer/pypi/resources']' returned non-zero exit status 2.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/_pytest/runner.py", line 344, in from_call
result: TResult | None = func()
^^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/_pytest/runner.py", line 246, in <lambda>
lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_hooks.py", line 512, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_manager.py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 167, in _multicall
raise exception
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 139, in _multicall
teardown.throw(exception)
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/_pytest/logging.py", line 850, in pytest_runtest_call
yield
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 139, in _multicall
teardown.throw(exception)
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 53, in run_old_style_hookwrapper
return result.get_result()
^^^^^^^^^^^^^^^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_result.py", line 103, in get_result
raise exc.with_traceback(tb)
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 38, in run_old_style_hookwrapper
res = yield
^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 139, in _multicall
teardown.throw(exception)
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/_pytest/capture.py", line 900, in pytest_runtest_call
return (yield)
^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 139, in _multicall
teardown.throw(exception)
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 53, in run_old_style_hookwrapper
return result.get_result()
^^^^^^^^^^^^^^^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_result.py", line 103, in get_result
raise exc.with_traceback(tb)
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 38, in run_old_style_hookwrapper
res = yield
^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 139, in _multicall
teardown.throw(exception)
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/_pytest/skipping.py", line 263, in pytest_runtest_call
return (yield)
^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 121, in _multicall
res = hook_impl.function(*args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/_pytest/runner.py", line 178, in pytest_runtest_call
item.runtest()
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/_pytest/python.py", line 1670, in runtest
self.ihook.pytest_pyfunc_call(pyfuncitem=self)
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_hooks.py", line 512, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_manager.py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 167, in _multicall
raise exception
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 121, in _multicall
res = hook_impl.function(*args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/_pytest/python.py", line 156, in pytest_pyfunc_call
result = testfunction(**testargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/unittest/mock.py", line 1378, in patched
return func(*newargs, **newkeywargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/carl_flottmann/macaron/tests/malware_analyzer/pypi/test_pypi_sourcecode_analyzer.py", line 222, in test_disabling_rulesets
analyzer = PyPISourcecodeAnalyzer(resources_path=RESOURCES_PATH)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/carl_flottmann/macaron/src/macaron/malware_analyzer/pypi_heuristics/sourcecode/pypi_sourcecode_analyzer.py", line 62, in __init__
self.default_rule_path, self.custom_rule_path, self.disabled_rule_ids = self._load_defaults(resources_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/carl_flottmann/macaron/src/macaron/malware_analyzer/pypi_heuristics/sourcecode/pypi_sourcecode_analyzer.py", line 123, in _load_defaults
raise ConfigurationError(error_msg) from semgrep_error
macaron.errors.ConfigurationError: Unable to run semgrep validation on /home/carl_flottmann/macaron/tests/malware_analyzer/pypi/resources with arguments ['semgrep', 'scan', '--validate', '--oss-only', '--config', '/home/carl_flottmann/macaron/tests/malware_analyzer/pypi/resources']: Command '['semgrep', 'scan', '--validate', '--oss-only', '--config', '/home/carl_flottmann/macaron/tests/malware_analyzer/pypi/resources']' returned non-zero exit status 2..
_______________________________________________________________________________________________ test_disabling_rules ________________________________________________________________________________________________
Traceback (most recent call last):
File "/home/carl_flottmann/macaron/src/macaron/malware_analyzer/pypi_heuristics/sourcecode/pypi_sourcecode_analyzer.py", line 116, in _load_defaults
process = subprocess.run(semgrep_commands, check=True, capture_output=True) # nosec B603
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/subprocess.py", line 571, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['semgrep', 'scan', '--validate', '--oss-only', '--config', '/home/carl_flottmann/macaron/tests/malware_analyzer/pypi/resources/custom_sample.yaml']' returned non-zero exit status 2.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/_pytest/runner.py", line 344, in from_call
result: TResult | None = func()
^^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/_pytest/runner.py", line 246, in <lambda>
lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_hooks.py", line 512, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_manager.py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 167, in _multicall
raise exception
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 139, in _multicall
teardown.throw(exception)
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/_pytest/logging.py", line 850, in pytest_runtest_call
yield
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 139, in _multicall
teardown.throw(exception)
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 53, in run_old_style_hookwrapper
return result.get_result()
^^^^^^^^^^^^^^^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_result.py", line 103, in get_result
raise exc.with_traceback(tb)
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 38, in run_old_style_hookwrapper
res = yield
^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 139, in _multicall
teardown.throw(exception)
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/_pytest/capture.py", line 900, in pytest_runtest_call
return (yield)
^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 139, in _multicall
teardown.throw(exception)
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 53, in run_old_style_hookwrapper
return result.get_result()
^^^^^^^^^^^^^^^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_result.py", line 103, in get_result
raise exc.with_traceback(tb)
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 38, in run_old_style_hookwrapper
res = yield
^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 139, in _multicall
teardown.throw(exception)
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/_pytest/skipping.py", line 263, in pytest_runtest_call
return (yield)
^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 121, in _multicall
res = hook_impl.function(*args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/_pytest/runner.py", line 178, in pytest_runtest_call
item.runtest()
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/_pytest/python.py", line 1670, in runtest
self.ihook.pytest_pyfunc_call(pyfuncitem=self)
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_hooks.py", line 512, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_manager.py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 167, in _multicall
raise exception
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 121, in _multicall
res = hook_impl.function(*args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/carl_flottmann/macaron/.venv/lib/python3.11/site-packages/_pytest/python.py", line 156, in pytest_pyfunc_call
result = testfunction(**testargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/unittest/mock.py", line 1378, in patched
return func(*newargs, **newkeywargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/carl_flottmann/macaron/tests/malware_analyzer/pypi/test_pypi_sourcecode_analyzer.py", line 278, in test_disabling_rules
analyzer = PyPISourcecodeAnalyzer(resources_path=RESOURCES_PATH)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/carl_flottmann/macaron/src/macaron/malware_analyzer/pypi_heuristics/sourcecode/pypi_sourcecode_analyzer.py", line 62, in __init__
self.default_rule_path, self.custom_rule_path, self.disabled_rule_ids = self._load_defaults(resources_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/carl_flottmann/macaron/src/macaron/malware_analyzer/pypi_heuristics/sourcecode/pypi_sourcecode_analyzer.py", line 123, in _load_defaults
raise ConfigurationError(error_msg) from semgrep_error
macaron.errors.ConfigurationError: Unable to run semgrep validation on /home/carl_flottmann/macaron/tests/malware_analyzer/pypi/resources/custom_sample.yaml with arguments ['semgrep', 'scan', '--validate', '--oss-only', '--config', '/home/carl_flottmann/macaron/tests/malware_analyzer/pypi/resources/custom_sample.yaml']: Command '['semgrep', 'scan', '--validate', '--oss-only', '--config', '/home/carl_flottmann/macaron/tests/malware_analyzer/pypi/resources/custom_sample.yaml']' returned non-zero exit status 2..
============================================================================================== short test summary info ==============================================================================================
FAILED tests/malware_analyzer/pypi/test_pypi_sourcecode_analyzer.py::test_custom_rules - macaron.errors.ConfigurationError: Unable to run semgrep validation on /home/carl_flottmann/macaron/tests/malware_analyzer/pypi/resources/custom_sample.yaml with arguments ['semgrep', 'scan', '--validate', '--oss-only', '--config', '/home/carl_flottmann/macaron/tests/malware_analyzer/pypi/resources/custom_sample.yaml']: Command '['semgrep', 'scan', '--validate', '--oss-only', '--config', '/home/carl_flottmann/macaron/tests/malware_analyzer/pypi/resources/custom_sample.yaml']' returned non-zero exit status 2..
FAILED tests/malware_analyzer/pypi/test_pypi_sourcecode_analyzer.py::test_disabling_rulesets[test_disable_custom_ruleset] - macaron.errors.ConfigurationError: Unable to run semgrep validation on /home/carl_flottmann/macaron/tests/malware_analyzer/pypi/resources with arguments ['semgrep', 'scan', '--validate', '--oss-only', '--config', '/home/carl_flottmann/macaron/tests/malware_analyzer/pypi/resources']: Command '['semgrep', 'scan', '--validate', '--oss-only', '--config', '/home/carl_flottmann/macaron/tests/malware_analyzer/pypi/resources']' returned non-zero exit status 2..
FAILED tests/malware_analyzer/pypi/test_pypi_sourcecode_analyzer.py::test_disabling_rules - macaron.errors.ConfigurationError: Unable to run semgrep validation on /home/carl_flottmann/macaron/tests/malware_analyzer/pypi/resources/custom_sample.yaml with arguments ['semgrep', 'scan', '--validate', '--oss-only', '--config', '/home/carl_flottmann/macaron/tests/malware_analyzer/pypi/resources/custom_sample.yaml']: Command '['semgrep', 'scan', '--validate', '--oss-only', '--config', '/home/carl_flottmann/macaron/tests/malware_analyzer/pypi/resources/custom_sample.yaml']' returned non-zero exit status 2..
===================================================================================== 3 failed, 10 passed in 634.53s (0:10:34) ======================================================================================
Environment Information
Operating System: 24.04.1 LTS (Noble Numbat) on WSL version 2.5.9.0
CPU architecture information: x86-64
Bash Version: 5.2.21(1)-release (x86_64-pc-linux-gnu)
Python virtual environment, version: 3.11.10
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingmalware analysisThe issues related to malware analysisThe issues related to malware analysistriageThe issue needs to be triaged.The issue needs to be triaged.