Skip to content

Commit

Permalink
add support for app projects lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
tjarrettveracode committed Aug 4, 2023
1 parent 4f6086a commit 616802f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/sca.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ _Note_: You can also access these methods from the `Workspaces` class.
- `get_vulnerability(vulnerability_id)`: get the vulnerability identified by `vulnerability_id` (an integer value, visible in the output of `get_issues`).
- `get_license(license_id)`: get the license identified by `license_id` (a string, e.g. "GPL30").
- `get_sca_events(date_gte,event_group,event_type)`: get the audit events for the arguments passed. Be careful with the arguments for this and try to limit by date as it will fetch all pages of data, which might be a lot.
- `get_application_projects(app_guid)`: get the list of linked SCA projects for an application. (This API call is also available on the SCAApplications object as `SCAApplications().get_projects()`).

## Component Activity

Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = 'veracode_api_py'
version = '0.9.42'
version = '0.9.43'
authors = [ {name = "Tim Jarrett", email="tjarrett@veracode.com"} ]
description = 'Python helper library for working with the Veracode APIs. Handles retries, pagination, and other features of the modern Veracode REST APIs.'
readme = 'README.md'
Expand All @@ -22,4 +22,4 @@ dependencies = {file = ["requirements.txt"]}
[project.urls]
"Homepage" = "https://github.com/veracode/veracode-api-py"
"Bug Tracker" = "https://github.com/veracode/veracode-api-py/issues"
"Download" = "https://github.com/veracode/veracode-api-py/archive/v_0942.tar.gz"
"Download" = "https://github.com/veracode/veracode-api-py/archive/v_0943.tar.gz"
5 changes: 4 additions & 1 deletion veracode_api_py/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from .applications import Applications, Sandboxes, CustomFields
from .findings import Findings, SummaryReport
from .policy import Policies
from .sca import ComponentActivity, Workspaces, SBOM
from .sca import ComponentActivity, Workspaces, SBOM, SCAApplications
from .collections import Collections
from .identity import Users, Teams, BusinessUnits, APICredentials, Roles
from .healthcheck import Healthcheck
Expand Down Expand Up @@ -383,6 +383,9 @@ def get_sbom(self, app_guid: UUID,format='cyclonedx',linked=False,vulnerability=

def get_sbom_project(self, project_guid: UUID, format='cyclonedx', vulnerability=True):
return SBOM().get_for_project(project_guid,format=format,vulnerability=vulnerability)

def get_app_projects(self, app_guid: UUID):
return SCAApplications().get_projects(app_guid=app_guid)

# dynamic APIs

Expand Down
6 changes: 6 additions & 0 deletions veracode_api_py/sca.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,9 @@ def _get_sbom(self,guid: UUID,format,sbom_type,linked,vulnerability,dependency):
if format=='spdx': #currently only supported for SPDX SBOMs
params["dependency"] = dependency
return APIHelper()._rest_request(self.entity_base_uri+"/{}/{}".format(guid,format),"GET",params=params)

class SCAApplications():
entity_base_uri = "srcclr/v3/applications"

def get_projects(self, app_guid: UUID):
return APIHelper()._rest_request(self.entity_base_uri+"/{}/projects".format(app_guid),"GET")

0 comments on commit 616802f

Please sign in to comment.