This is an python client for the CodeDx API. See the CodeDx API Guide for reference.
Install the library using pip3
pip3 install git+https://github.com/broadinstitute/dsp-appsec-codedx-api-client-python.git
You can then make API calls using the library. See below for an example.
from codedx_api import CodeDxAPI
cdx = CodeDxAPI.CodeDx([YOUR-CODEDX-URL], [CODEDX-API-KEY])
cdx.create_project('WebGoat')
The methods return data according to the schema seen in the CodeDx API Guide. For example, the create_projects
call returns:
{
"id": 1,
"name": "WebGoat"
}
The docker image includes the preinstalled library and includes example scripts for common tasks.
First, make sure you have permissions to access the project on GCR and that you can push and pull images.
docker pull gcr.io/dsp-appsec-dev/codedx-api-wrapper:latest
docker run -it --name codedx-tasks gcr.io/dsp-appsec-dev/codedx-api-wrapper:latest
>>> from codedx_api import CodeDxAPI
>>> cdx = CodeDxAPI.CodeDx([YOUR-CODEDX-URL], [CODEDX-API-KEY])
>>> cdx.get_projects()
{YOUR-PROJECTS-JSON}
docker run --name create-project gcr.io/dsp-appsec-dev/codedx-api-wrapper:latest create_project.py [API-KEY] [YOUR-PROJECT-NAME]
docker run -v $(pwd):/app/scripts/reports --name upload-report gcr.io/dsp-appsec-dev/codedx-api-wrapper:latest upload_analysis.py [API-KEY] [PROJECT] [PATH-TO-REPORT]
Please contact [email protected]
with any questions.