Skip to content

Commit eb2377c

Browse files
add methods for CWEs and categories
1 parent 783b8ac commit eb2377c

File tree

8 files changed

+50
-9
lines changed

8 files changed

+50
-9
lines changed

.github/workflows/sbom.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ name: SBOM
88

99
on:
1010
workflow_dispatch:
11+
release:
1112

1213
jobs:
1314
sbom:

docs/docs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ See the topics below for more information on how to use this library.
1010
* [Healthcheck and Status](healthcheck.md) - access information about the status of Veracode services.
1111
* [Applications and Sandboxes](applications.md) - create, update, access, and delete application profiles and sandboxes.
1212
* [Policy](policy.md) - create, update, access, and delete policy definitions.
13-
* [Findings and Annotations](findings.md) - retrieve findings and propose, accept, and reject mitigations.
13+
* [Findings, Annotations, Summary Reports, and CWE and Category Metadata](findings.md) - retrieve findings and propose, accept, and reject mitigations. Get summary reports for applications. Get CWE and category metadata.
1414
* [Collections](collections.md) - (EARLY ACCESS) create, update, access, and delete collections.
1515
* [SCA Agent](sca.md) - access information about SCA workspaces, projects, issues, vulnerabilities, libraries, and licenses.
1616
* [Dynamic Analysis](dynamic.md) - configure, schedule and start dynamic analyses (use with the Veracode Dynamic Analysis product).

docs/findings.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Findings, Annotations, and Summary Reports
1+
# Findings, Annotations, Summary Reports, and CWE and Category Metadata
22

33
The following methods call Veracode REST APIs and return JSON.
44

@@ -29,4 +29,11 @@ The following methods call Veracode REST APIs and return JSON.
2929
- `ManualScans().get_findings(scanid,include_artifacts(opt))`: get the manual findings detail for `scanid` (int).
3030
- `include_artifacts`: if `True`, includes screenshots and code samples associated with the findings.
3131

32+
## CWEs and Category Metadata
33+
34+
- `CWEs().get_all()`: get metadata for all CWEs.
35+
- `CWEs().get(cwe_id)`: get metadata for the CWE identified by `cwe_id` (int).
36+
- `CWECategories().get_all()`: get metadata for all CWE categories.
37+
- `CWECategories().get(category_id)`: get metadata for the CWE category identified by `category_id` (int).
38+
3239
[All docs](docs.md)

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = 'veracode_api_py'
3-
version = '0.9.52'
3+
version = '0.9.53'
44
authors = [ {name = "Tim Jarrett", email="[email protected]"} ]
55
description = 'Python helper library for working with the Veracode APIs. Handles retries, pagination, and other features of the modern Veracode REST APIs.'
66
readme = 'README.md'
@@ -22,4 +22,4 @@ dependencies = {file = ["requirements.txt"]}
2222
[project.urls]
2323
"Homepage" = "https://github.com/veracode/veracode-api-py"
2424
"Bug Tracker" = "https://github.com/veracode/veracode-api-py/issues"
25-
"Download" = "https://github.com/veracode/veracode-api-py/archive/v_0952.tar.gz"
25+
"Download" = "https://github.com/veracode/veracode-api-py/archive/v_0953.tar.gz"

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
setup(
88
name = 'veracode_api_py',
99
packages = ['veracode_api_py'],
10-
version = '0.9.52',
10+
version = '0.9.53',
1111
license='MIT',
1212
description = 'Python helper library for working with the Veracode APIs. Handles retries, pagination, and other features of the modern Veracode REST APIs.',
1313
long_description = long_description,
1414
long_description_content_type="text/markdown",
1515
author = 'Tim Jarrett',
1616
author_email = '[email protected]',
1717
url = 'https://github.com/tjarrettveracode',
18-
download_url = 'https://github.com/veracode/veracode-api-py/archive/v_0952.tar.gz',
18+
download_url = 'https://github.com/veracode/veracode-api-py/archive/v_0953.tar.gz',
1919
keywords = ['veracode', 'veracode-api'],
2020
install_requires=[
2121
'veracode-api-signing'

veracode_api_py/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from veracode_api_py.collections import Collections
55
from veracode_api_py.dynamic import Analyses, Scans, CodeGroups, Configuration, ScannerVariables, ScanCapacitySummary, Occurrences, DynUtils
66
from veracode_api_py.exceptions import VeracodeAPIError, VeracodeError
7-
from veracode_api_py.findings import Findings, SummaryReport, ManualScans
7+
from veracode_api_py.findings import Findings, SummaryReport, ManualScans, CWEs, CWECategories
88
from veracode_api_py.healthcheck import Healthcheck
99
from veracode_api_py.identity import Users, Teams, BusinessUnits, APICredentials, Roles
1010
from veracode_api_py.sca import Workspaces, ComponentActivity, SBOM, SCAApplications

veracode_api_py/api.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from .constants import Constants
2121
from .exceptions import VeracodeAPIError
2222
from .applications import Applications, Sandboxes, CustomFields
23-
from .findings import Findings, SummaryReport, ManualScans
23+
from .findings import Findings, SummaryReport, ManualScans, CWEs, CWECategories
2424
from .policy import Policies
2525
from .sca import ComponentActivity, Workspaces, SBOM, SCAApplications
2626
from .collections import Collections
@@ -195,6 +195,20 @@ def get_mpt_scan(self, scanid: int):
195195

196196
def get_mpt_findings(self, scanid: int, include_artifacts=False):
197197
return ManualScans().get_findings(scanid=scanid, include_artifacts=include_artifacts)
198+
199+
## CWEs and category metadata
200+
201+
def get_cwes(self):
202+
return CWEs().get_all()
203+
204+
def get_cwe(self,cwe_id:int):
205+
return CWEs().get(cwe_id=cwe_id)
206+
207+
def get_cwecategories(self):
208+
return CWECategories().get_all()
209+
210+
def get_cwecategory(self,category_id:int):
211+
return CWECategories().get(category_id=category_id)
198212

199213
## Collections APIs
200214

veracode_api_py/findings.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,4 +189,23 @@ def get_findings(self,scanid: int, include_artifacts=False):
189189
params = {}
190190
params['include_artifacts'] = include_artifacts
191191
return APIHelper()._rest_paged_request(uri,"GET","findings",params=params)
192-
192+
193+
class CWEs():
194+
base_uri = 'appsec/v1/cwes'
195+
def get_all(self):
196+
params = {}
197+
return APIHelper()._rest_paged_request(self.base_uri,"GET","cwes", params=params)
198+
199+
def get(self,cwe_id: int):
200+
uri = '{}/{}'.format(self.base_uri, cwe_id)
201+
return APIHelper()._rest_request(uri,"GET")
202+
203+
class CWECategories():
204+
base_uri = 'appsec/v1/categories'
205+
def get_all(self):
206+
params = {}
207+
return APIHelper()._rest_paged_request(self.base_uri,"GET", "categories", params=params)
208+
209+
def get(self,category_id: int):
210+
uri = '{}/{}'.format(self.base_uri, category_id)
211+
return APIHelper()._rest_request(uri,"GET")

0 commit comments

Comments
 (0)