Giter VIP home page Giter VIP logo

codeql-community-packs's Introduction

CodeQL Community Packs

GitHub GitHub Actions GitHub Issues GitHub Stars Licence

Collection of community-driven CodeQL query, library and extension packs

Getting started

Default query suites

Using a githubsecuritylab/codeql-LANG-queries query pack will reference the default suite for that pack (e.g. python.qls for python). However, you may use a different suite such as python-audit.qls by referencing the query pack with the following syntax: githubsecuritylab/codeql-python-queries:suites/python-audit.qls. The examples below work for both syntaxes.

Using a community pack from the CodeQL Action

Important

For language aliases in strategy.matrix.language, use cpp instead of c-cpp, java instead of java-kotlin and javascript instead of javascript-typescript.

- name: Initialize CodeQL
  uses: github/codeql-action/init@v2
  with:
    languages: ${{ matrix.language }}
    packs: githubsecuritylab/codeql-${{ matrix.language }}-queries

Using community packs with provided configuration file

This repository has a number of provided configuration files you can use or copy from the community packs.

- name: Initialize CodeQL
  uses: github/codeql-action/init@v2
  with:
    languages: ${{ matrix.language }}
    config-file: GitHubSecurityLab/CodeQL-Community-Packs/configs/default.yml@main

Using a community pack from the CLI configuration file

$ cat codeql-config.yml | grep -A 1 'packs:'
packs:
  - githubsecuritylab/codeql-python-queries

Using a community pack from the CodeQL CLI

codeql database analyze db/ --download githubsecuritylab/codeql-python-queries --format=sarif-latest --output=results.sarif

License

This project is licensed under the terms of the MIT open source license. Please refer to MIT for the full terms.

Support

Please create GitHub issues for any feature requests, bugs, or documentation problems.

codeql-community-packs's People

Contributors

felickz avatar geekmasher avatar geoffw0 avatar jorgectf avatar pwntester avatar tspascoal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

codeql-community-packs's Issues

When using a workflow created by default CodeQL is used, starter java and javascript packs are not found

The languages as automatically filled in by the codeql starter workflow, now uses java-kotlin and javascript-typescript instead of java and javascript like it used to so

(workflow snippet of a repo that has both java and javascript languages)

 strategy:
      fail-fast: false
      matrix:
        language: [ 'java-kotlin', 'javascript-typescript' ]
        # CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ]
        # Use only 'java-kotlin' to analyze code written in Java, Kotlin or both
        # Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
        # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

So when adding a pack with

packs: githubsecuritylab/codeql-${{ matrix.language }}-queries

the workflow fails since it can't find the packs

rror: Encountered a fatal error while running "/opt/hostedtoolcache/CodeQL/2.15.2/x64/codeql/codeql database init --db-cluster /home/runner/work/_temp/codeql_databases --source-root=/home/runner/work/tspascoal-repro-pack/tspascoal-repro-pack --extractor-include-aliases --language=javascript --codescanning-config=/home/runner/work/_temp/user-config.yaml --calculate-language-specific-baseline --sublanguage-file-coverage". Exit code was 2 and error was: A fatal error occurred: 'githubsecuritylab/codeql-javascript-typescript-queries' not found in the registry 'https://ghcr.io/v2/'. See the logs for more details.

Can we publish the packs with both the old as well as the new language name so it supports both old and new workflow files?

Haven't checked if c-cpp also changed or it has been like that all along

Unable to use codeql-cpp-queries from the CLI

I am trying to analyze a database using the codeql-cpp-queries pack; however, I get the error below.

codeql database analyze db/ \
  --download githubsecuritylab/codeql-cpp-queries \
  --format=sarif-latest --output=results.sarif
{                                                    
  "packs" : [                                        
    {                                                
      "name" : "githubsecuritylab/codeql-cpp-queries",
      "version" : "0.0.2",
      "library" : false,
      "result" : "INSTALLED"
    }
  ],
  "packDir" : "/home/user/.codeql/packages"
}
Running queries.
A fatal error occurred: Compiled CodeQL packs cannot reference another pack from one of its query suites. 'githubsecuritylab/[email protected]' references 'github-queries-ruby'.

I have found this issue already, but I think it is only somewhat related, as we have two different packs here, i.e., codeql-cpp-queries and github-queries-ruby. How can I fix this error so that I can run the GitHubSecurityLab packs?

CodeQL Version

The CodeQL CLI resides at /opt/codeql/codeql, and the CodeQL repository was downloaded to /opt/codeql/codeql-repo as per the advanced setup guide.

codeql --version
CodeQL command-line toolchain release 2.15.1.
Copyright (C) 2019-2023 GitHub, Inc.
Unpacked in: /opt/codeql/codeql

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.