Skip to content

Commit 00b98b2

Browse files
Fixes #95 - customer managed encryption key support
1 parent 6e30047 commit 00b98b2

File tree

6 files changed

+18
-11
lines changed

6 files changed

+18
-11
lines changed

docs/api.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ As an alternative to importing individual objects into your library, you can acc
8585
- `get_apps(policy_check_after(opt))` : get a list of Veracode applications (JSON format). If provided, returns only applications that have a policy check date on or after `policy_check_after` (format is `yyyy-mm-dd`).
8686
- `get_app(guid(opt),legacy_id(opt))`: get information for a single Veracode application using either the `guid` or the `legacy_id` (integer).
8787
- `get_app_by_name(name)`: get list of applications whose names contain the search string `name`.
88-
- `create_app(app_name, business_criticality, business_unit(opt), teams(opt), policy_guid(opt), custom_fields(opt array), bus_owner_name(opt), bus_owner_email(opt),git_repo_url(opt))`: create an application profile.
88+
- `create_app(app_name, business_criticality, business_unit(opt), teams(opt), policy_guid(opt), custom_fields(opt array), bus_owner_name(opt), bus_owner_email(opt),git_repo_url(opt),custom_kms_alias(opt))`: create an application profile.
8989
- `business_criticality`: one of "VERY HIGH", "HIGH", "MEDIUM", "LOW", "VERY LOW"
9090
- `business_unit`: the GUID of the business unit to which the application should be assigned
9191
- `teams`: a list of the GUIDs of the teams to which the application should be assigned
@@ -94,6 +94,7 @@ As an alternative to importing individual objects into your library, you can acc
9494
- `bus_owner_name`: the name of the business owner of the application
9595
- `bus_owner_email`: the email address of the business owner of the application
9696
- `git_repo_url`: the URL to the git repository containing the code for the application
97+
- `custom_kms_alias`: the alias for the Customer Managed Encryption Key (CMK), which will be used to encrypt/decrypt customer provided data. Note: The Customer Managed Encrytion Key feature must be activated and configured for your organization before attempting to set this value.
9798
- `update_app(guid, app_name, business_criticality, business_unit(opt), teams(opt), policy_guid(opt), custom_fields(opt array), bus_owner_name(opt), bus_owner_email(opt),git_repo_url(opt))`: update an application profile. Note that partial updates are NOT supported, so you need to provide all values including those that aren't changing.
9899
- `delete_app(guid)`: delete the application identified by `guid`. This is not a reversible action.
99100
- `get_custom_fields()`: get a list of app profile custom fields available for your organization.

docs/applications.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ The following methods call Veracode REST APIs and return JSON.
77
- `Applications().get_all(policy_check_after(opt))` : get a list of Veracode applications (JSON format). If provided, returns only applications that have a policy check date on or after `policy_check_after` (format is `yyyy-mm-dd`).
88
- `Applications().get(guid(opt),legacy_id(opt))`: get information for a single Veracode application using either the `guid` or the `legacy_id` (integer).
99
- `Applications().get_by_name(name)`: get list of applications whose names contain the search string `name`.
10-
- `Applications().create(app_name, business_criticality, business_unit(opt), teams(opt), policy_guid(opt), custom_fields(opt array), bus_owner_name(opt), bus_owner_email(opt),git_repo_url(opt))`: create an application profile.
10+
- `Applications().create(app_name, business_criticality, business_unit(opt), teams(opt), policy_guid(opt), custom_fields(opt array), bus_owner_name(opt), bus_owner_email(opt),git_repo_url(opt),custom_kms_alias(opt))`: create an application profile.
1111
- `business_criticality`: one of "VERY HIGH", "HIGH", "MEDIUM", "LOW", "VERY LOW"
1212
- `business_unit`: the GUID of the business unit to which the application should be assigned
1313
- `teams`: a list of the GUIDs of the teams to which the application should be assigned
@@ -16,6 +16,7 @@ The following methods call Veracode REST APIs and return JSON.
1616
- `bus_owner_name`: the name of the business owner of the application
1717
- `bus_owner_email`: the email address of the business owner of the application
1818
- `git_repo_url`: the URL to the git repository containing the code for the application
19+
- `custom_kms_alias`: the alias for the Customer Managed Encryption Key (CMK), which will be used to encrypt/decrypt customer provided data. Note: The Customer Managed Encrytion Key feature must be activated and configured for your organization before attempting to set this value.
1920
- `Applications().update(guid, app_name, business_criticality, business_unit(opt), teams(opt), policy_guid(opt), custom_fields(opt array), bus_owner_name(opt), bus_owner_email(opt),git_repo_url(opt))`: update an application profile. Note that partial updates are NOT supported, so you need to provide all values including those that aren't changing.
2021
- `Applications().delete(guid)`: delete the application identified by `guid`. This is not a reversible action.
2122

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.53'
3+
version = '0.9.57'
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_0953.tar.gz"
25+
"Download" = "https://github.com/veracode/veracode-api-py/archive/v_0957.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.53',
10+
version = '0.9.57',
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_0953.tar.gz',
18+
download_url = 'https://github.com/veracode/veracode-api-py/archive/v_0957.tar.gz',
1919
keywords = ['veracode', 'veracode-api'],
2020
install_requires=[
2121
'veracode-api-signing'

veracode_api_py/api.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,12 @@ def get_app_by_name(self, appname):
113113

114114
def create_app(self, app_name, business_criticality, business_unit: UUID = None, teams=[],
115115
policy_guid = None, custom_fields=[],bus_owner_name = None, bus_owner_email = None,
116-
git_repo_url = None):
116+
git_repo_url = None, custom_kms_alias = None):
117117
return Applications().create(app_name=app_name, business_criticality=business_criticality,
118118
business_unit=business_unit, teams=teams, policy_guid=policy_guid,
119119
custom_fields=custom_fields, bus_owner_name=bus_owner_name,
120-
bus_owner_email=bus_owner_email, git_repo_url=git_repo_url)
120+
bus_owner_email=bus_owner_email, git_repo_url=git_repo_url,
121+
custom_kms_alias=custom_kms_alias)
121122

122123
def update_app(self, guid: UUID, app_name, business_criticality, business_unit: UUID = None, teams=[],
123124
policy_guid = None, custom_fields=[], bus_owner_name=None, bus_owner_email=None,

veracode_api_py/applications.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ def get_by_name (self,appname: str):
3434
return APIHelper()._rest_paged_request(uri="appsec/v1/applications",method="GET",element="applications",params=params)
3535

3636
def create(self,app_name:str ,business_criticality, business_unit: UUID=None, teams=[], policy_guid:UUID=None,
37-
custom_fields=[], bus_owner_name=None, bus_owner_email=None, git_repo_url=None):
37+
custom_fields=[], bus_owner_name=None, bus_owner_email=None, git_repo_url=None, custom_kms_alias: str=None):
3838
return self._create_or_update("CREATE",app_name=app_name,business_criticality=business_criticality,
3939
business_unit=business_unit,teams=teams, policy_guid=policy_guid,
4040
custom_fields=custom_fields, bus_owner_name=bus_owner_name,
41-
bus_owner_email=bus_owner_email, git_repo_url=git_repo_url)
41+
bus_owner_email=bus_owner_email, git_repo_url=git_repo_url, custom_kms_alias=custom_kms_alias)
4242

4343
def update(self,guid: UUID,app_name:str ,business_criticality, business_unit: UUID=None,
4444
teams=[], policy_guid:UUID=None, custom_fields=[],
@@ -55,7 +55,7 @@ def delete(self,guid: UUID):
5555

5656
def _create_or_update(self,method,app_name: str,business_criticality, business_unit: UUID=None,
5757
teams=[],guid=None,policy_guid:UUID=None, custom_fields=[],
58-
bus_owner_name=None,bus_owner_email=None,git_repo_url=None):
58+
bus_owner_name=None,bus_owner_email=None,git_repo_url=None,custom_kms_alias:str=None):
5959
if method == 'CREATE':
6060
uri = 'appsec/v1/applications'
6161
httpmethod = 'POST'
@@ -95,6 +95,10 @@ def _create_or_update(self,method,app_name: str,business_criticality, business_u
9595
gru = { 'git_repo_url': git_repo_url}
9696
app_def.update(gru)
9797

98+
if (custom_kms_alias != None) & (method=='CREATE'):
99+
# custom_kms_alias currently only supported at creation
100+
app_def.update({"custom_kms_alias": custom_kms_alias})
101+
98102
payload = json.dumps({"profile": app_def})
99103
return APIHelper()._rest_request(uri,httpmethod,body=payload)
100104

0 commit comments

Comments
 (0)