Skip to content

lrecknagel/cql-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

cql-demo

This demo repo shows how to setup CodeQL for a local repository and run queries againt that.

Setup

cd ~/
mkdir cql_home
cd cql_home
git clone git@github.com:github/codeql.git codeql-repo

# Download cql-cli
# https://github.com/github/codeql-cli-binaries/releases
curl https://github.com/github/codeql-cli-binaries/releases/download/v2.4.6/codeql-{ osx64, linux64, win64 }.zip
unzip codeql-{ osx64, linux64, win64 }.zip
mv codeql ~/cql_home

# add to PATH
export PATH="$HOME/cql_home/codeql:$PATH"

# validate via
which codeql # -> $HOME/cql_home/codeql/codeql
codeql resolve languages

Generate CodeQL DB

  • within our repo (cql-demo)
    • codeql database create .cql --language=javascript
  • In VS-Codes CodeQL view: select db from folder
    • select your .cql folder we created

Queries

CLI

# single query & decode
codeql query run --database ./.cql --output ./ql-results.bqrs ./ql-queries/fn_call.ql
codeql bqrs decode --format csv --output ./ql-results.csv ./ql-results.bqrs

# multiple queries (create a .bqrs file for each query)
codeql database run-queries ./.cql ./ql-queries
# decode as needed like above

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published