Actions for running CodeQL analysis
Перейти к файлу
Aditya Sharad 4c94e29f1b
Increase the default amount of RAM reserved for the OS
Mitigation for OOM errors (137/SIGKILL) seen by users when we overcommit the available memory.
For Unix, reserve 1GB.
For Windows, reserve 1.5GB, as the OS needs more memory and estimates inaccurately.
2021-02-16 15:10:19 -08:00
.github Use an asymmetric Git log when updating the release branch. 2021-02-01 18:03:39 +00:00
.vscode Add support for debugging from VSCode 2020-07-14 09:49:21 +01:00
analyze Fix typos in Action config files 2020-11-20 11:11:17 +01:00
autobuild rename the action entrypoint files 2020-08-24 15:15:26 +01:00
init include missing changes 2021-01-12 12:09:22 +00:00
lib Increase the default amount of RAM reserved for the OS 2021-02-16 15:10:19 -08:00
node_modules update node_modules 2020-12-14 10:25:05 +00:00
python-setup Python setup: Fix URL for Python 2.7 pip install 2021-01-28 16:52:16 -08:00
queries Add a query to detect binary planting vulnerabilities. 2020-11-20 11:34:33 +00:00
runner Bump ini from 1.3.5 to 1.3.8 in /runner 2020-12-13 05:06:37 +00:00
src Increase the default amount of RAM reserved for the OS 2021-02-16 15:10:19 -08:00
tests/multi-language-repo Lock bundler version to 2.2.9. 2021-02-15 19:50:32 +00:00
upload-sarif Update upload-sarif/action.yml 2021-01-19 17:17:45 +00:00
.editorconfig Add a `.editorconfig` with our chosen formatting options. 2020-06-23 14:38:30 +01:00
.eslintignore Adding ESLint config and required dev dependencies 2020-09-14 10:32:24 +01:00
.eslintrc.json Update ESLint configuration 2021-01-15 18:20:07 +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 Fix invalid API call when running locally 2020-11-04 09:58:09 +00:00
LICENSE Initial commit (from f5274cbdce4ae7c9e4b937dcdf95ac70ae436d5f) 2020-04-28 17:23:37 +02:00
README.md include missing changes 2021-01-12 12:09:22 +00:00
package-lock.json Fix deduplication of bundle download sources. 2021-01-26 16:56:43 +00:00
package.json Fix deduplication of bundle download sources. 2021-01-26 16:56:43 +00:00
tsconfig.json Store the default CodeQL bundle version in a JSON file. 2020-08-10 13:41:45 +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:
    #        ┌───────────── minute (0 - 59)
    #        │  ┌───────────── hour (0 - 23)
    #        │  │ ┌───────────── day of the month (1 - 31)
    #        │  │ │ ┌───────────── month (1 - 12 or JAN-DEC)
    #        │  │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
    #        │  │ │ │ │
    #        │  │ │ │ │
    #        │  │ │ │ │
    #        *  * * * *
    - cron: '30 1 * * 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

      # 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 can be located in a different repository. This is useful if you want to share the same configuration across multiple repositories. If the configuration file is in a private repository you can also specify an external-repository-token option. This should be a personal access token that has read access to any repositories containing referenced config files and queries.

- uses: github/codeql-action/init@v1
  with:
    config-file: owner/repo/codeql-config.yml@branch
    external-repository-token: ${{ secrets.EXTERNAL_REPOSITORY_TOKEN }}

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.