generated from oracle/template-repo
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: improve the malicious metadata check (#797)
This PR refactors and improves the _detect_malicious_metadata_check: * Moves the check under src/macaron/slsa_analyzer/checks/ * Refactors the implementation of the check to avoid storing the metadata in the PyPIRegistry object and uses the * AssetLocator representation instead. * Uses DB JSON type to store the serialized metadata info instead of dumping it as a string value. * Adds a new unit test for the check and improves the other relevant tests. * Adds the check to the django integration test case and its dependencies. * Ensures that the source code retrieved by the PyPIRegistry API is the version that matches the artifact PURL. * Removes the heuristics that introduce too many FPs. Signed-off-by: behnazh-w <[email protected]>
- Loading branch information
Showing
44 changed files
with
2,334 additions
and
607 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
...s/developers_guide/apidoc/macaron.malware_analyzer.pypi_heuristics.metadata.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
macaron.malware\_analyzer.pypi\_heuristics.metadata package | ||
=========================================================== | ||
|
||
.. automodule:: macaron.malware_analyzer.pypi_heuristics.metadata | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
Submodules | ||
---------- | ||
|
||
macaron.malware\_analyzer.pypi\_heuristics.metadata.closer\_release\_join\_date module | ||
-------------------------------------------------------------------------------------- | ||
|
||
.. automodule:: macaron.malware_analyzer.pypi_heuristics.metadata.closer_release_join_date | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
macaron.malware\_analyzer.pypi\_heuristics.metadata.empty\_project\_link module | ||
------------------------------------------------------------------------------- | ||
|
||
.. automodule:: macaron.malware_analyzer.pypi_heuristics.metadata.empty_project_link | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
macaron.malware\_analyzer.pypi\_heuristics.metadata.high\_release\_frequency module | ||
----------------------------------------------------------------------------------- | ||
|
||
.. automodule:: macaron.malware_analyzer.pypi_heuristics.metadata.high_release_frequency | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
macaron.malware\_analyzer.pypi\_heuristics.metadata.one\_release module | ||
----------------------------------------------------------------------- | ||
|
||
.. automodule:: macaron.malware_analyzer.pypi_heuristics.metadata.one_release | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
macaron.malware\_analyzer.pypi\_heuristics.metadata.unchanged\_release module | ||
----------------------------------------------------------------------------- | ||
|
||
.. automodule:: macaron.malware_analyzer.pypi_heuristics.metadata.unchanged_release | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
macaron.malware\_analyzer.pypi\_heuristics.metadata.unreachable\_project\_links module | ||
-------------------------------------------------------------------------------------- | ||
|
||
.. automodule:: macaron.malware_analyzer.pypi_heuristics.metadata.unreachable_project_links | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
35 changes: 35 additions & 0 deletions
35
...urce/pages/developers_guide/apidoc/macaron.malware_analyzer.pypi_heuristics.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
macaron.malware\_analyzer.pypi\_heuristics package | ||
================================================== | ||
|
||
.. automodule:: macaron.malware_analyzer.pypi_heuristics | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
Subpackages | ||
----------- | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
|
||
macaron.malware_analyzer.pypi_heuristics.metadata | ||
macaron.malware_analyzer.pypi_heuristics.sourcecode | ||
|
||
Submodules | ||
---------- | ||
|
||
macaron.malware\_analyzer.pypi\_heuristics.base\_analyzer module | ||
---------------------------------------------------------------- | ||
|
||
.. automodule:: macaron.malware_analyzer.pypi_heuristics.base_analyzer | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
macaron.malware\_analyzer.pypi\_heuristics.heuristics module | ||
------------------------------------------------------------ | ||
|
||
.. automodule:: macaron.malware_analyzer.pypi_heuristics.heuristics | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
18 changes: 18 additions & 0 deletions
18
...developers_guide/apidoc/macaron.malware_analyzer.pypi_heuristics.sourcecode.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
macaron.malware\_analyzer.pypi\_heuristics.sourcecode package | ||
============================================================= | ||
|
||
.. automodule:: macaron.malware_analyzer.pypi_heuristics.sourcecode | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
Submodules | ||
---------- | ||
|
||
macaron.malware\_analyzer.pypi\_heuristics.sourcecode.suspicious\_setup module | ||
------------------------------------------------------------------------------ | ||
|
||
.. automodule:: macaron.malware_analyzer.pypi_heuristics.sourcecode.suspicious_setup | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
26 changes: 26 additions & 0 deletions
26
docs/source/pages/developers_guide/apidoc/macaron.malware_analyzer.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
macaron.malware\_analyzer package | ||
================================= | ||
|
||
.. automodule:: macaron.malware_analyzer | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
Subpackages | ||
----------- | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
|
||
macaron.malware_analyzer.pypi_heuristics | ||
|
||
Submodules | ||
---------- | ||
|
||
macaron.malware\_analyzer.datetime\_parser module | ||
------------------------------------------------- | ||
|
||
.. automodule:: macaron.malware_analyzer.datetime_parser | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.