generated from oracle/template-repo
-
Notifications
You must be signed in to change notification settings - Fork 29
feat: enable repo finder to support more languages via Open Source Insights #388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
b30ef37
feat: enable repo finder to support more languages via Open Source In…
benmss 39c1279
chore: enabled all supported languages in repo finder
benmss ede5b58
chore: add configuration option for deps.dev and update docs
benmss 1a171ff
chore: addressed PR feedback
benmss 6ab78f5
chore: add integration test for repo finder
benmss 36f22c5
chore: addressed review feedback
benmss 7e725c2
chore: addressed PR feedback; rebased and refactored
benmss e56ed6c
chore: updated parser name
benmss d274dd0
chore: minor fix
benmss 0a7096f
chore: extended docstring of repo finder
benmss 0a8b665
chore: Addressed PR feedback.
benmss 7745019
chore: moved repo finder integration test to new file
benmss 60a5cc7
chore: try to derive the SBOM component type
benmss 64a7472
chore: Add PURL to DependencyInfo; Try to retrieve PURL from SBOM for…
benmss 556514e
chore: renaming of deps.dev files
benmss 3ad9c4a
chore: added integration tests for more languages
benmss abcd9a0
chore: restored removed test
benmss 011da8b
chore: repo finder interface refactoring
benmss 3ab5664
chore: updated repo finder return values
benmss 83be471
chore: correctly added repo finder integration tests; fixed duplicate…
benmss 8eae174
chore: removed repo finder test in docker integration tests
benmss 8bce886
chore: moved URL validation to within Repo Finders
benmss 4c8cba6
chore: moved url validator to repo finder
benmss f0ee636
chore: added repo validator
benmss 50137f7
chore: updated docs
benmss 9d4f657
chore: rebase and integrate with config purl change
benmss b369fe6
chore: addressed review feedback
benmss 11ab3aa
chore: addressed review feedback
benmss 5b600bf
chore: rebase and make use of updated send_get_http_raw
benmss bca62d5
chore: enable repo finder for sboms
benmss 056b3f3
chore: updated docs
benmss File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
50 changes: 50 additions & 0 deletions
50
docs/source/pages/developers_guide/apidoc/macaron.repo_finder.rst
This file contains hidden or 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,50 @@ | ||
macaron.repo\_finder package | ||
============================ | ||
|
||
.. automodule:: macaron.repo_finder | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
Submodules | ||
---------- | ||
|
||
macaron.repo\_finder.repo\_finder module | ||
---------------------------------------- | ||
|
||
.. automodule:: macaron.repo_finder.repo_finder | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
macaron.repo\_finder.repo\_finder\_base module | ||
---------------------------------------------- | ||
|
||
.. automodule:: macaron.repo_finder.repo_finder_base | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
macaron.repo\_finder.repo\_finder\_deps\_dev module | ||
--------------------------------------------------- | ||
|
||
.. automodule:: macaron.repo_finder.repo_finder_deps_dev | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
macaron.repo\_finder.repo\_finder\_java module | ||
---------------------------------------------- | ||
|
||
.. automodule:: macaron.repo_finder.repo_finder_java | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
macaron.repo\_finder.repo\_validator module | ||
------------------------------------------- | ||
|
||
.. automodule:: macaron.repo_finder.repo_validator | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
This file contains hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -104,7 +104,7 @@ To simplify the examples, we use the same configurations as above if needed (e.g | |
|
||
The list bellow shows examples for the corresponding PURL strings for different git repositories: | ||
|
||
.. list-table:: Example of PURL strings for git repositories. | ||
.. list-table:: Examples of PURL strings for git repositories. | ||
:widths: 50 50 | ||
:header-rows: 1 | ||
|
||
|
@@ -133,6 +133,39 @@ You can also provide the PURL string together with the repository path. In this | |
|
||
.. note:: When providing the PURL and the repository path, both the branch name and commit digest must be provided as well. | ||
|
||
'''''''''''''''''''''''''''''''''''''' | ||
Providing an artifact as a PURL string | ||
'''''''''''''''''''''''''''''''''''''' | ||
|
||
The PURL format supports artifacts as well as repositories, and Macaron supports (some of) these too. | ||
|
||
.. code-block:: | ||
|
||
pkg:<package_type>/<artifact_details> | ||
|
||
Where ``artifact_details`` varies based on the provided ``package_type``. Examples for those currently supported by Macaron are as follows: | ||
|
||
.. list-table:: Examples of PURL strings for artifacts. | ||
:widths: 50 50 | ||
:header-rows: 1 | ||
|
||
* - Package Type | ||
- PURL String | ||
* - Maven (Java) | ||
- ``pkg:maven/org.apache.xmlgraphics/[email protected]`` | ||
* - PyPi (Python) | ||
- ``pkg:pypi/[email protected]`` | ||
* - Cargo (Rust) | ||
- ``pkg:cargo/[email protected]`` | ||
* - NuGet (.Net) | ||
- ``pkg:nuget/[email protected]`` | ||
* - NPM (NodeJS) | ||
- ``pkg:npm/%40angular/[email protected]`` | ||
|
||
For more detailed information on converting a given artifact into a PURL, see `PURL Specification <https://github.com/package-url/purl-spec/blob/master/PURL-SPECIFICATION.rst>`_ and `PURL Types <https://github.com/package-url/purl-spec/blob/master/PURL-TYPES.rst>`_ | ||
|
||
.. note:: If a repository is not also provided, Macaron will try to discover it based on the artifact purl. For this to work, ``find_repos`` in the configuration file **must be enabled**\. See `Analyzing more dependencies <#more-deps>`_ for more information about the configuration options of the Repository Finding feature. | ||
|
||
------------------------------------------------- | ||
Verifying provenance expectations in CUE language | ||
------------------------------------------------- | ||
|
@@ -191,6 +224,8 @@ With the example above, the generated output reports can be seen here: | |
- `micronaut-core.html <../_static/examples/micronaut-projects/micronaut-core/analyze_with_sbom/micronaut-core.html>`__ | ||
- `micronaut-core.json <../_static/examples/micronaut-projects/micronaut-core/analyze_with_sbom/micronaut-core.json>`__ | ||
|
||
.. _more-deps: | ||
|
||
''''''''''''''''''''''''''' | ||
Analyzing more dependencies | ||
''''''''''''''''''''''''''' | ||
|
@@ -203,30 +238,38 @@ This feature is enabled by default. To disable, or configure its behaviour in ot | |
|
||
See :ref:`dump-defaults <action_dump_defaults>`, the CLI command to dump the default configurations in ``defaults.ini``. After making changes, see :ref:`analyze <analyze-action-cli>` CLI command for the option to pass the modified ``defaults.ini`` file. | ||
|
||
Within the configuration file under the ``repofinder.java`` header, five options exist: ``find_repos``, ``artifact_repositories``, ``repo_pom_paths``, ``find_parents``, ``artifact_ignore_list``. These options behave as follows: | ||
Within the configuration file under the ``repofinder.java`` header, three options exist: ``artifact_repositories``, ``repo_pom_paths``, ``find_parents``. These options behave as follows: | ||
|
||
- ``find_repos`` (Values: True or False) - Enables or disables the Repository Finding feature. | ||
- ``artifact_repositories`` (Values: List of URLs) - Determines the remote artifact repositories to attempt to retrieve dependency information from. | ||
- ``repo_pom_paths`` (Values: List of POM tags) - Determines where to search for repository information in the POM files. E.g. scm.url. | ||
- ``find_parents`` (Values: True or False) - When enabled, the Repository Finding feature will also search for repository URLs in parents POM files of the current dependency. | ||
- ``artifact_ignore_list`` (Values: List of GAs) - The Repository Finding feature will skip any artifact in this list. Format is "GroupId":"ArtifactId". E.g. org.apache.maven:maven | ||
|
||
Under the related header ``repofinder``, two more options exist: ``find_repos``, and ``use_open_source_insights``: | ||
nathanwn marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- ``find_repos`` (Values: True or False) - Enables or disables the Repository Finding feature. | ||
- ``use_open_source_insights`` (Values: True or False) - Enables or disables use of Google's Open Source Insights API. | ||
|
||
.. note:: Finding repositories requires at least one remote call, adding some additional overhead to an analysis run. | ||
|
||
.. note:: Google's Open Source Insights API is currently used to find repositories for: Python, Rust, .Net, NodeJS | ||
|
||
An example configuration file for utilising this feature: | ||
|
||
.. code-block:: ini | ||
|
||
[repofinder.java] | ||
[repofinder] | ||
find_repos = True | ||
use_open_source_insights = True | ||
|
||
[repofinder.java] | ||
artifact_repositories = https://repo.maven.apache.org/maven2 | ||
repo_pom_paths = | ||
scm.url | ||
scm.connection | ||
scm.developerConnection | ||
find_parents = True | ||
artifact_ignore_list = | ||
org.apache.maven:maven | ||
|
||
|
||
|
||
------------------------------------- | ||
Analyzing a locally cloned repository | ||
|
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.