How to filter an applications vulnerabilities associated with a specific URL using the API

  • Updated

Objective

It is possible to filter vulnerabilities for an application based on a URL within the Contrast UI:

App_Vuln_URL_filter_UI.png

How can I filter an applications vulnerabilities associated with a specific URL using the API?

 

Process

The API call to filter on urls expects a base64 encoded string.  See the below example cURL call:

curl -X GET -HAccept:application/json -k -HAuthorization:{AUTH} -HAPI-Key:{API_KEY} \
-HContent-Type:application/json 'https://{CONTRAST_URL}/Contrast/api/ng/{ORG_ID}/orgtraces/filter?expand=application%2Cbugtracker%2Cviolations%2Csession_metadata&quickFilter=OPEN&modules={APP_ID}&urls={BASE64_URL}&offset=0&limit=25&sort=-severity'

If you have many vulnerabilities, be aware of the offset and limit filters .


The base64 encoded string can be obtained from a terminal window, using:

echo `echo URL | base64`
The double echo and the ` ` just means it includes a new line character so it's neater in the terminal.

 

The output can then be plugged in to the urls filter.  It is possible to supply comma separated base64 string to urls to filter on multiple URLS.

If required, the base64 string can be decoded using:

echo `echo ENCODED_URL | base64 --decode`

Eg/

echo `echo L0hhY21lQm9va3MvYXV0aG9yaXpl | base64 --decode`

Which decodes to /HacmeBooks/authorize

Another option is to use a site such as https://www.base64decode.org/ , but this is not recommended for sensitive strings.

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request