Skip to content

Commit

Permalink
Add support for SBOM for SCA Agent (fixes #28)
Browse files Browse the repository at this point in the history
  • Loading branch information
tjarrettveracode committed May 17, 2022
1 parent 6ba1559 commit d93a37d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ _Note_: You can also access this method from the `APICredentials` object.
''Note'': You can also access these methods from the `SBOM` object.

- `get_sbom(app_guid)`: generate an SBOM in CycloneDX format for the application represented by `app_guid`. Get the `app_guid` from the Applications API.
- `get_sbom_project(project_guid)`: generate an SBOM in CycloneDX format for the SCA Agent project represented by `project_guid`. Get the `project_guid` from the SCA Agent API (e.g. `get_projects(workspace_guid)`).

#### Dynamic Analysis

Expand Down
3 changes: 3 additions & 0 deletions veracode_api_py/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,9 @@ def get_component_activity(self,component_id):
def get_sbom(self,app_guid: UUID):
return SBOM().get(app_guid)

def get_sbom_project(self,project_guid: UUID):
return SBOM().get_for_project(project_guid)

#dynamic APIs

def get_analyses(self):
Expand Down
8 changes: 7 additions & 1 deletion veracode_api_py/sca.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,10 @@ class SBOM():
entity_base_uri = "srcclr/sbom/v1/targets"

def get(self,app_guid: UUID):
return APIHelper()._rest_request(self.entity_base_uri+"/{}/cyclonedx".format(app_guid),"GET",params={"type":"application"})
return self._get_sbom(guid=app_guid,sbom_type='application')

def get_for_project(self,project_guid: UUID):
return self._get_sbom(guid=project_guid,sbom_type='agent')

def _get_sbom(self,guid: UUID,sbom_type):
return APIHelper()._rest_request(self.entity_base_uri+"/{}/cyclonedx".format(guid),"GET",params={"type":sbom_type})

0 comments on commit d93a37d

Please sign in to comment.