Actions for running CodeQL analysis
Перейти к файлу
Chris Raynor 6567bffcb9
Merge pull request #183 from github/dependabot/npm_and_yarn/node-fetch-2.6.1
Bump node-fetch from 2.6.0 to 2.6.1
2020-09-13 11:22:52 +01:00
.github Update integration-testing.yml 2020-09-09 17:31:20 +01:00
.vscode Add support for debugging from VSCode 2020-07-14 09:49:21 +01:00
analyze add optional workflow input to specify whether snippets are added to sarif output 2020-09-10 18:26:58 +01:00
autobuild rename the action entrypoint files 2020-08-24 15:15:26 +01:00
init Allow "additive" queries in workflow by prefixing with "+" 2020-08-28 16:45:57 +01:00
lib add optional workflow input to specify whether snippets are added to sarif output 2020-09-10 18:26:58 +01:00
node_modules Vendoring node_modules 2020-09-13 10:27:23 +01:00
queries whitelist @actions/exec/lib/toolrunner 2020-09-01 14:44:38 +01:00
runner Convert rest of the actions 2020-08-26 16:20:36 +01:00
src add optional workflow input to specify whether snippets are added to sarif output 2020-09-10 18:26:58 +01:00
tests/multi-language-repo add more integration tests for the runner 2020-09-08 18:32:52 +01:00
upload-sarif rename the action entrypoint files 2020-08-24 15:15:26 +01:00
.editorconfig Add a `.editorconfig` with our chosen formatting options. 2020-06-23 14:38:30 +01:00
.gitattributes Initial commit (from f5274cbdce4ae7c9e4b937dcdf95ac70ae436d5f) 2020-04-28 17:23:37 +02:00
.gitignore rename CLI to runner 2020-08-25 17:44:30 +01:00
CODE_OF_CONDUCT.md Initial commit (from f5274cbdce4ae7c9e4b937dcdf95ac70ae436d5f) 2020-04-28 17:23:37 +02:00
CONTRIBUTING.md rename CLI to runner 2020-08-25 17:44:30 +01:00
LICENSE Initial commit (from f5274cbdce4ae7c9e4b937dcdf95ac70ae436d5f) 2020-04-28 17:23:37 +02:00
README.md Fix "Using a custom configuration" link in README 2020-09-10 20:58:39 +03:00
package-lock.json Bump node-fetch from 2.6.0 to 2.6.1 2020-09-12 20:20:25 +00:00
package.json remove build-cli from top-level package.json 2020-08-25 11:45:01 +01:00
tsconfig.json Store the default CodeQL bundle version in a JSON file. 2020-08-10 13:41:45 +01:00
tslint.json Update TSLint configuration to detect bad indentation. 2020-06-23 14:44:36 +01:00

README.md

CodeQL Action

This action runs GitHub's industry-leading static analysis engine, CodeQL, against a repository's source code to find security vulnerabilities. It then automatically uploads the results to GitHub so they can be displayed in the repository's security tab. CodeQL runs an extensible set of queries, which have been developed by the community and the GitHub Security Lab to find common vulnerabilities in your code.

License

This project is released under the MIT License.

The underlying CodeQL CLI, used in this action, is licensed under the GitHub CodeQL Terms and Conditions. As such, this action may be used on open source projects hosted on GitHub, and on private repositories that are owned by an organisation with GitHub Advanced Security enabled.

Usage

This is a short walkthrough, but for more information read configuring code scanning.

To get code scanning results from CodeQL analysis on your repo you can use the following workflow as a template:


name: "Code Scanning - Action"

on:
  push:
  pull_request:
  schedule:
    - cron: '0 0 * * 0'

jobs:
  CodeQL-Build:
    # CodeQL runs on ubuntu-latest, windows-latest, and macos-latest
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v2
        with:
          # Must fetch at least the immediate parents so that if this is
          # a pull request then we can checkout the head of the pull request.
          # Only include this option if you are running this workflow on pull requests.
          fetch-depth: 2

      # If this run was triggered by a pull request event then checkout
      # the head of the pull request instead of the merge commit.
      # Only include this step if you are running this workflow on pull requests.
      - run: git checkout HEAD^2
        if: ${{ github.event_name == 'pull_request' }}

      # Initializes the CodeQL tools for scanning.
      - name: Initialize CodeQL
        uses: github/codeql-action/init@v1
        # Override language selection by uncommenting this and choosing your languages
        # with:
        #   languages: go, javascript, csharp, python, cpp, java

      # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
      # If this step fails, then you should remove it and run the build manually (see below).
      - name: Autobuild
        uses: github/codeql-action/autobuild@v1

      #  Command-line programs to run using the OS shell.
      # 📚 https://git.io/JvXDl

      # ✏️ If the Autobuild fails above, remove it and uncomment the following
      #    three lines and modify them (or add more) to build your code if your
      #    project uses a compiled language

      #- run: |
      #   make bootstrap
      #   make release

      - name: Perform CodeQL Analysis
        uses: github/codeql-action/analyze@v1

If you prefer to integrate this within an existing CI workflow, it should end up looking something like this:

- name: Initialize CodeQL
  uses: github/codeql-action/init@v1
  with:
    languages: go, javascript

# Here is where you build your code
- run: |
  make bootstrap
  make release  

- name: Perform CodeQL Analysis
  uses: github/codeql-action/analyze@v1

Configuration file

Use the config-file parameter of the init action to enable the configuration file. The value of config-file is the path to the configuration file you want to use. This example loads the configuration file ./.github/codeql/codeql-config.yml.

- uses: github/codeql-action/init@v1
  with:
    config-file: ./.github/codeql/codeql-config.yml

The configuration file must be located within the local repository. For information on how to write a configuration file, see "Using a custom configuration file."

If you only want to customise the queries used, you can specify them in your workflow instead of creating a config file, using the queries property of the init action:

- uses: github/codeql-action/init@v1
  with:
    queries: <local-or-remote-query>,<another-query>

By default, this will override any queries specified in a config file. If you wish to use both sets of queries, prefix the list of queries in the workflow with +:

- uses: github/codeql-action/init@v1
  with:
    queries: +<local-or-remote-query>,<another-query>

Troubleshooting

Read about troubleshooting code scanning.