Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
check-circle

GitHub Action

SecurityCodeScan

v1.2

SecurityCodeScan

check-circle

SecurityCodeScan

Security Code Scan action to upload code scanning results

Installation

Copy and paste the following snippet into your .yml file.

              

- name: SecurityCodeScan

uses: security-code-scan/[email protected]

Learn more about this action in security-code-scan/security-code-scan-results-action

Choose a version

Security-Code-Scan Action

This action is designed to run as part of a workflow that builds SecurityCodeScan, SecurityCodeScan.VS2017 or SecurityCodeScan.VS2019 referencing projects.

It produces a GitHub compatible SARIF file for uploading to the repository 'Code scanning alerts'.

Usage

See action.yml

Input Parameters

sarif_directory: (optional) The output directory where SARIF files should be collected.

Workflow Examples

The recommended way to add this action to your workflow, is with a subsequent action that uploads the prepared SARIF files to the repository 'Code scanning alerts'. The analyzed projects must be already referencing SecurityCodeScan, SecurityCodeScan.VS2017 or SecurityCodeScan.VS2019 Nuget package.
For example:

on:
  push:

jobs:
  SCS:
    runs-on: ubuntu-latest
    steps:     
      - uses: actions/checkout@v2

      - name: Build
        run: |
          dotnet build /p:ErrorLog=analysis.sarif
        
      - name: Convert sarif for uploading to GitHub
        uses: security-code-scan/[email protected]
        
      - name: Upload sarif	
        uses: github/codeql-action/upload-sarif@v1

Another option is to add the nuget package to specific projects from the script:

on:
  push:

jobs:
  SCS:
    runs-on: ubuntu-latest
    steps:     
      - uses: actions/checkout@v2

      - name: Build
        run: |
          dotnet add src/SourcesFolderName/ProjectName.csproj package SecurityCodeScan.VS2019
          dotnet add src/SourcesFolderName2/ProjectName2.csproj package SecurityCodeScan.VS2019
          dotnet build /p:ErrorLog=analysis.sarif
        
      - name: Convert sarif for uploading to GitHub
        uses: security-code-scan/[email protected]
        
      - name: Upload sarif	
        uses: github/codeql-action/upload-sarif@v1

For .NET 4.x example see FullDotNetWebApp demo repository.