From b25a947806b8b815039a2f7b960dd5d5ebf8b415 Mon Sep 17 00:00:00 2001 From: Chelsea Boling Date: Wed, 17 Feb 2021 14:29:46 -0800 Subject: [PATCH 1/9] Create codeql-analysis.yml --- .github/workflows/codeql-analysis.yml | 67 +++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/codeql-analysis.yml diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000..ac12684 --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,67 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ master ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ master ] + schedule: + - cron: '42 20 * * 5' + +jobs: + analyze: + name: Analyze + runs-on: windows-latest + + strategy: + fail-fast: false + matrix: + language: [ 'cpp', 'python' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] + # Learn more: + # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main + + # 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 From 71e2ef91b0c4bc4366f9c339705f8bd8a174761c Mon Sep 17 00:00:00 2001 From: Chelsea Boling Date: Wed, 17 Feb 2021 14:32:57 -0800 Subject: [PATCH 2/9] Update codeql-analysis.yml --- .github/workflows/codeql-analysis.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index ac12684..dd58456 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -49,8 +49,8 @@ jobs: # 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 +# - name: Autobuild +# uses: github/codeql-action/autobuild@v1 # â„šī¸ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -59,9 +59,8 @@ jobs: # and modify them (or add more) to build your code if your project # uses a compiled language - #- run: | - # make bootstrap - # make release + - run: | + python3 ./setup.py install - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v1 From 47b77ee7b03a05125765a0673e0a78569b0348ba Mon Sep 17 00:00:00 2001 From: Chelsea Boling Date: Wed, 17 Feb 2021 14:38:22 -0800 Subject: [PATCH 3/9] Update codeql-analysis.yml --- .github/workflows/codeql-analysis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index dd58456..1958878 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -60,6 +60,7 @@ jobs: # uses a compiled language - run: | + pip install pybind11 python3 ./setup.py install - name: Perform CodeQL Analysis From dd91b27f2f35c758a3b5f8e53dd07566696f5fc2 Mon Sep 17 00:00:00 2001 From: Chelsea Boling Date: Tue, 9 Mar 2021 12:32:20 -0800 Subject: [PATCH 4/9] Update codeql-analysis.yml --- .github/workflows/codeql-analysis.yml | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 1958878..3618593 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -18,12 +18,13 @@ on: # The branches below must be a subset of the branches above branches: [ master ] schedule: - - cron: '42 20 * * 5' + - cron: '24 6 * * 5' + workflow_dispatch: jobs: analyze: name: Analyze - runs-on: windows-latest + runs-on: ubuntu-latest strategy: fail-fast: false @@ -36,6 +37,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v2 + with: + submodules: recursive # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL @@ -47,21 +50,8 @@ jobs: # Prefix the list here with "+" to use these queries and those in the config file. # queries: ./path/to/local/query, your-org/your-repo/queries@main - # 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: | - pip install pybind11 + - name: Compile and package + run: | python3 ./setup.py install - - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v1 From 4a9486fa31ba47734066fcb41865cd2350b623a5 Mon Sep 17 00:00:00 2001 From: Chelsea Boling Date: Tue, 9 Mar 2021 12:41:54 -0800 Subject: [PATCH 5/9] Update codeql-analysis.yml --- .github/workflows/codeql-analysis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 3618593..ea68a67 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -52,6 +52,7 @@ jobs: - name: Compile and package run: | + whoami python3 ./setup.py install - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v1 From 68474222a034d19c562d62567cc79071acdb538a Mon Sep 17 00:00:00 2001 From: Chelsea Boling Date: Tue, 9 Mar 2021 12:53:51 -0800 Subject: [PATCH 6/9] Update codeql-analysis.yml --- .github/workflows/codeql-analysis.yml | 61 ++++++++++++++++++++------- 1 file changed, 45 insertions(+), 16 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index ea68a67..cfe18a1 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -29,7 +29,7 @@ jobs: strategy: fail-fast: false matrix: - language: [ 'cpp', 'python' ] + language: [ 'cpp' ] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] # Learn more: # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed @@ -40,19 +40,48 @@ jobs: with: submodules: recursive - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - - - name: Compile and package + # setup dev environment here if necessary + - name: Environment variables + env: + GITHUB_TOKEN: ${{ github.token }} + GITHUB_REF: ${{ github.ref }} + GITHUB_SHA: ${{ github.sha }} + GITHUB_REPO: ${{ github.repository }} + GITHUB_WORKSPACE: ${{ github.workspace }} + run: | + echo $GITHUB_TOKEN + echo $GITHUB_REF + echo $GITHUB_SHA + echo $GITHUB_REPO + echo $GITHUB_WORKSPACE + - name: Setup CodeQL Runner + run: | + pwd + wget -q https://github.com/github/codeql-action/releases/download/codeql-bundle-20201106/codeql-runner-linux + sudo install -o root -g root -m 0755 codeql-runner-linux /usr/local/bin/ + ls -l + echo ${{ github.workspace }} + + - name: Execute CodeQL Runner run: | - whoami - python3 ./setup.py install - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + + latest_SHA_on_ref=$(git rev-parse HEAD) + default_branch=$(git symbolic-ref HEAD) + + sudo codeql-runner-linux init \ + --checkout-path ${{ github.workspace }} \ + --github-url https://github.com \ + --repository ${{ github.repository }} \ + --github-auth ${{ github.token }} \ + --languages ${{ matrix.language }} \ + --source-root=${{ github.workspace }} \ + + sudo python3 ./setup.py install + + sudo codeql-runner-linux analyze \ + --checkout-path ${{ github.workspace }} \ + --github-url https://github.com \ + --repository cmboling/${{ github.repository }} \ + --github-auth ${{ github.token }} \ + --commit $latest_SHA_on_ref \ + --ref $default_branch From 72a5d5fbb8b6853ea28f3c7458b0e3475d0d95f0 Mon Sep 17 00:00:00 2001 From: Chelsea Boling Date: Tue, 9 Mar 2021 12:55:28 -0800 Subject: [PATCH 7/9] Update codeql-analysis.yml --- .github/workflows/codeql-analysis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index cfe18a1..069dee9 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -81,7 +81,7 @@ jobs: sudo codeql-runner-linux analyze \ --checkout-path ${{ github.workspace }} \ --github-url https://github.com \ - --repository cmboling/${{ github.repository }} \ + --repository ${{ github.repository }} \ --github-auth ${{ github.token }} \ --commit $latest_SHA_on_ref \ --ref $default_branch From 5d99df02229f6a0a0dd76d56b41f092dad69fb41 Mon Sep 17 00:00:00 2001 From: Chelsea Boling Date: Tue, 9 Mar 2021 13:05:31 -0800 Subject: [PATCH 8/9] Update codeql-analysis.yml --- .github/workflows/codeql-analysis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 069dee9..27fdecf 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -75,6 +75,8 @@ jobs: --github-auth ${{ github.token }} \ --languages ${{ matrix.language }} \ --source-root=${{ github.workspace }} \ + + source /home/runner/work/python_cpp_example/python_cpp_example/codeql-runner/codeql-env.sh sudo python3 ./setup.py install From 136a5e91dddffef769c61bf932b45a0a719321d1 Mon Sep 17 00:00:00 2001 From: Chelsea Boling Date: Tue, 9 Mar 2021 13:14:57 -0800 Subject: [PATCH 9/9] Update codeql-analysis.yml --- .github/workflows/codeql-analysis.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 27fdecf..b028ca5 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -87,3 +87,10 @@ jobs: --github-auth ${{ github.token }} \ --commit $latest_SHA_on_ref \ --ref $default_branch + + - name: Upload extractor specific logs + if: ${{ always() }} + uses: actions/upload-artifact@v2 + with: + name: extractor-logs-${{ matrix.language }}-db + path: ${{ github.workspace }}/codeql-runner/codeql_databases/cpp/log