Using the ShiftLeft app for GitHub

The following instructions will walk you through using the ShiftLeft app available from the GitHub Marketplace to automate code analysis using ShiftLeft CORE's NextGen Static Analysis (NG SAST).

GitHub Marketplace

Step 1: Set up your ShiftLeft account

After you click set up a plan on GitHub, you'll be shown details on what you can do with your new ShiftLeft account. Click Install it for free to proceed, and you'll be prompted to review your order.

Review usage details

The app is free to use, but GitHub asks that you proceed through the checkout process regardless. Click Complete order and begin installation.

Review your order

Next, you'll be asked to authorize ShiftLeft to access your account. Click Authorize ShiftLeftSecurity to proceed.

Authorize ShiftLeft

You'll be redirected to the ShiftLeft Dashboard to finish configuring your account (if you don't already have one) and create a new organization. Follow the on-screen prompts to provide ShiftLeft with a name for your organization.

Step 2: Provide access to your GitHub repositories

ShiftLeft will ask if you'd like to grant access to just your public repositories or both your public and private repositories.

You'll then need to provide ShiftLeft with the requested permissions, which are necessary to perform actions on your behalf. ShiftLeft needs to interact with the following (any additional permissions requested are inferred by GitHub and cannot be removed):

  • public_repo or repo: needed to push branches, open pull requests to add GitHub Actions workflow files, and add a ShiftLeft access token as a repository secret
  • user:email: used to identify you
  • read:org: used to correctly list the repos associated with the orgs of which you're a member
  • workflow: needed to add GitHub Action workflow files and execute Actions

See Scopes for OAuth Apps for additional information on the scopes requested by ShiftLeft.

Step 3: Choose the repository to analyze

At this point, you can choose to:

  1. Try out the ShiftLeft workflow using the demo repo in the language of your choice
  2. Select one of your repositories for code analysis.
Repo choices

ShiftLeft will create a GitHub Action on your behalf as part of the workflow. Depending on your usage level, you may incur charges for your use of GitHub Actions. You will be fully responsible for such costs.

To try out the ShiftLeft workflow using the demo repo, click the box corresponding to the language of your choice. This will result in ShiftLeft analyzing a repo in the chosen language.

Choose the demo repo to analyze

Click Next in the top left to proceed.

You'll be redirected to the Demo Workflow Setup screen, showing ShiftLeft's progress in setting up your sample app.

When done, you'll be able to see the steps ShiftLeft took. Click View the Pull Request to see the build rules file that illustrates how NG SAST can be used with GitHub Actions to secure every pull request in your organization. Click See Demo App to proceed.

Setting up the demo app

This redirects you to the Applications View, which shows a complete list of all apps associated with your ShiftLeft account. It may take some time for ShiftLeft to analyze the demo repo and return the results.

Applications with completed scans

When you no longer see any status bars indicating that a scan is in progress, click anywhere on the application row to launch the app-specific summary page.

Application summary

Step 4: Merge the GitHub pull request (Optional)

As part of the workflow setup process, ShiftLeft created an open Pull Request (PR) in your repository (regardless of whether you used a demo repository or your repository). The PR adds a YAML file (found under /.github/workflows/shiftleft.yml) to your repo that uses GitHub Actions to execute NG SAST on all future PRs opened.

GitHub PR

If you used a demo repo, you do not have to merge the PR created by ShiftLeft unless you want to modify the behavior defined in the YAML file.

Similarly, if you provided a repository you own for analysis, you must merge the PR if you would like to continue having ShiftLeft analyze your repo. You can also modify the YAML file to further customize the GitHub Action's behavior.