You can configure your TeamCity CI/CD pipeline to automatically run a Bright scan with every new build. Once a build is made to the pipeline, Bright initiates security tests and provides all the information that developers need to fix the detected vulnerabilities, without having to leave their development environment.
Although it is possible to configure a CI/CD pipeline with the Bright REST API, it is recommended to use the Bright CLI for an easier, more robust configuration of your pipeline.

Prerequisites

  • You have a valid Bright API key (env.BrightToken) with the following scopes: scans, files:write, org:read, and projects:read. You can create an organization API key or a personal API key. You can also watch our video about creating API keys.
  • Register the Repeater in the Bright app and copy the generated REPEATER_ID. See Managing Repeaters for more information.
  • Install and configure the TeamCity CI/CD server and agent.

📘

Note

The Linux Docker deployment of TeamCity is currently not supported — https://youtrack.jetbrains.com/issue/TW-74746.

Step-by-Step Guide

  1. Open the TeamCity Administration panel.
  2. From the left menu, select Projects, and then click + Create project.
18941894
  1. In the Name field, enter a name for your project (for example, Bright Scan), and then click Create.
18941894
  1. In the upper-right corner of the created project page, click Project Home.
17261726
  1. Click Create Build Configuration, and then select Manually.
  2. In the Name field, enter a name for your build configuration (for example, BrightBuild), and then click Create.
16861686
  1. The New VCS Root form opens. Click Skip to proceed to the next step.
18951895
  1. From the left menu, select Parameters, and then click + Add new parameter.
  2. Create the endBrightToken (API key) environment variable:
    a) In the Name field, enter endBrightToken.
    b) In the Value filed, enter the value of the token (API key) you have created in the Bright app (see Prerequisites).
    c) Click Save.
18851885
  1. Create the REPEATER_ID environment variable:
    a) In the Name field, enter REPEATER_ID.
    b) In the Value filed, enter the ID of the Repeater you have created in the Bright app (see Prerequisites).
    c) Click Save.
  2. From the left menu, select Build Steps.
  3. On the New Build Step page, do the following:
    a) Set Runner Type to Node.js.
    b) Set Run step within Docker container to node: 14.17.1.
    c) Set Shell script to the following:
npm install @neuralegion/nexploit-cli
cd node_modules/.bin
./nexploit-cli --version
echo "Starting Repeater"
./nexploit-cli repeater --id %env.REPEATER_ID% --token %env.BrightToken% &
sleep 10
echo "Starting NeuraLegion Scan"
SCAN_ID=$(./nexploit-cli scan:run --token %env.BrightToken% --repeater %env.REPEATER_ID% --name "new scan" --crawler Broken Crystals  --smart)
echo "Scan was started with ID NeuraLegion 
sleep 10
echo "Waiting for issues..."
./nexploit-cli scan:polling --interval 30s --timeout 30m --breakpoint any --token %env.BrightToken% $SCAN_ID
18961896
 13. Click **Save**. 
  1. On the top right, click Run to run the build.
18871887
  1. To check that your build has started, click Agents, and then click Running.
18431843
  1. To check the build logs, open the Build Log tab.
    You can see that the Repeater and scan have started, the polling state is also active. You can also monitor the scan progress in the Bright app.
18851885

Did this page help you?