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:

  • openvas
  • owasp_zap
  • dep_check
  • nuclei
  • gitleaks

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 additional toolData object to be included alongside externalData. This object will contain the projectUrl field (the repo URL, including its credentials if required), projectName (the repository's name) and projectBranch (the branch to clone, optional if using curl).

  • Nuclei (nuclei) accepts an additional toolData object to be included alongside externalData. This object may contain the templates field which is a string including the templates to use by Nuclei. This field is concatenated to a string including the -nts flag 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 }}

Last Updated: