GitHub Actions
Overview
A test can be performed externally by authenticating a StrikeOne Admin account from GitHub Actions and then calling the test orchestrator endpoint with the appropiate parameters. The following example job lets users execute tests from GitHub Actions.
Remote Test Execution
Overview
In order to execute a test, you will need to have an authorization token. Users can generate API Tokens from the Integrations menu in the StrikeOne settings. The authorization token will allow users to perform any subsequent calls to other endpoints.
After obtaining our authorization token, the test orchestrator must be called. This POST request requires a body with an externalData object containing the fields testName, parsedDomainId, parsedScanId and tool. Both parsed IDs can be obtained directly by going to the Domains or the Scans tab of an asset and copying it from any table element.
The following values are valid for the tool field:
openvasowasp_zapdep_checknucleigitleaks
IMPORTANT
Some tools require or accept extra arguments for their execution. The list is as follows:
OWASP Dependency Check (
dep_check) and GitLeaks (gitleaks) require an additionaltoolDataobject to be included alongsideexternalData. This object will contain theprojectUrlfield (the repo URL, including its credentials if required),projectName(the repository's name) andprojectBranch(the branch to clone, optional if using curl).Nuclei (
nuclei) accepts an additionaltoolDataobject to be included alongsideexternalData. This object may contain thetemplatesfield which is a string including the templates to use by Nuclei. This field is concatenated to a string including the-ntsflag to be later used when running Nuclei.
If the test was successfully created, /api/vm/tests/external/execute will return a 200 code.
Requirements
The workflow example uses HTTP Request Action.
Job Example
execute_so_test:
name: Execute StrikeOne Test
runs-on: self-hosted
steps:
- name: StrikeOne Test Execution
id: strikeone_test_execution
uses: fjogeleit/http-request-action@v1
with:
url: "https://assessment.strikeone.io/api/vm/tests/external/execute"
method: "POST"
customHeaders: '{"Content-Type": "application/json"}'
bearerToken: ${{ secrets.SO_API_TOKEN }}
data: '{"externalData": { "parsedDomainId": "192079240", "parsedScanId": "192079369", "tool": "owasp_zap", "testName": "GitHub Actions Test" } }'
- name: Show Response
run: |
echo ${{ steps.strikeone_test_execution.outputs.response }}
