
TSaekao243924 (Community Member) asked a question.
I am using Azure DevOps and am doing a SAST and SCA scan on a public GitHub repo. Both of these are successful! However, I am trying to take it a step further and would like to generate an SBOM based on the SCA Agent-Based Scan result for each time I run the pipeline.
I am aware that I need to obtain the workspace GUID, and the project GUID to obtain the SBOM. I am trying to use this API to obtain that info, and adding it into the SCA task.
curl -X 'GET' \
'https://api.veracode.com/srcclr/v3/workspaces?filter%5Bworkspace%5D=WS-30268' \
-H 'accept: application/json'
I got this syntax from the Veracode REST API SwaggerHub documentation, but that call doesn't return anything. I am trying to obtain the workspace GUID and project GUID for the projects in WS-30268 so that I can obtain the SBOM.
Here is my current snippet from the yaml file for the SCA Task. Am I using the REST API call correctly to obtain the workspace info?
- task: CmdLine@2
displayName: SCA Scan
enabled: true
inputs:
script: |
export SCM_URI='https://$(Application_Profile_name)'
export SRCCLR_API_TOKEN=$(SRCCLR_API_TOKEN)
export scaDownloadUrl=https://download.srcclr.com/ci.sh
export SCM_REF_TYPE=branch
# make sure the branch name is set appropriately for the below scm_ref
export SCM_REF=main
export SCM_REV=1.0
curl -sSL $scaDownloadUrl | env DEBUG=1 bash -s scan --scm-uri $SCM_URI --scm-rev $SCM_REV --scm-ref $SCM_REF --scm-ref-type $SCM_REF_TYPE
curl -u 'GET' \
'https://api.veracode.com/srcclr/v3/workspaces?filter%5Bworkspace%5D=WS-30268' \
-H 'accept: application/json'
.png)
Hello @TSaekao243924 (Community Member)
You should use the API REST with HTTPie command line and veracode_hmac to auth and protect you comunication.
So you need install both:
-pip install httpie
-pip install veracode-api-signing
After that you need use the commands below
Use this command to return the list of GUIDs for your workspaces:
http --auth-type=veracode_hmac "https://api.veracode.com/srcclr/v3/workspaces"
Use this command to return the list of project GUIDs for the workspace:
http --auth-type=veracode_hmac "https://api.veracode.com/srcclr/v3/workspaces/{workspaceGuid}/projects?type=agent"
Use this command to return the SBOM containing the SCA agent-based scan results for your project:
http --auth-type=veracode_hmac "https://api.veracode.com/srcclr/sbom/v1/targets/{projectGuid}/cyclonedx?type=agent"
Link to documentation: Generate a Software Bill of Materials (SBOM) for Agent-Based Projects with the REST API | Veracode Docs
You can run in your desktop before to test and validate, and then implement in your Azure DevOps Pipelines