From a6eda071f80e0c631abff85454be16bab98c4d11 Mon Sep 17 00:00:00 2001 From: Peter Lubell-Doughtie Date: Mon, 6 Feb 2023 13:05:30 -0500 Subject: [PATCH 01/15] Create codeql.yml --- .github/workflows/codeql.yml | 76 ++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000000..0c1bebd177 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,76 @@ +# 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: [ "main", mwcore-dev ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ "main" ] + schedule: + - cron: '40 5 * * 6' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'java', 'javascript' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Use only 'java' to analyze code written in Java, Kotlin or both + # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + 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. + + # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + + # Autobuild attempts to build any compiled languages (C/C++, C#, Go, 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@v2 + + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + category: "/language:${{matrix.language}}" From e68ba8b63832bf611c65323099d0d707bc799147 Mon Sep 17 00:00:00 2001 From: Peter Lubell-Doughtie Date: Fri, 24 Mar 2023 13:01:23 -0400 Subject: [PATCH 02/15] Update .github/workflows/codeql.yml --- .github/workflows/codeql.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 0c1bebd177..fd1f52ccb3 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -32,6 +32,7 @@ jobs: strategy: fail-fast: false matrix: + # 'java' includes Kotlin support language: [ 'java', 'javascript' ] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] # Use only 'java' to analyze code written in Java, Kotlin or both From 53d79315532892e6c9edf562fc51e9aa5a9a003f Mon Sep 17 00:00:00 2001 From: Peter Lubell-Doughtie Date: Fri, 24 Mar 2023 13:09:57 -0400 Subject: [PATCH 03/15] Update codeql.yml --- .github/workflows/codeql.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index fd1f52ccb3..fbdd495d7b 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -13,10 +13,10 @@ name: "CodeQL" on: push: - branches: [ "main", mwcore-dev ] + branches: [ 'main', 'mwcore-dev' ] pull_request: # The branches below must be a subset of the branches above - branches: [ "main" ] + branches: [ 'main' ] schedule: - cron: '40 5 * * 6' @@ -32,8 +32,7 @@ jobs: strategy: fail-fast: false matrix: - # 'java' includes Kotlin support - language: [ 'java', 'javascript' ] + language: [ 'java' ] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] # Use only 'java' to analyze code written in Java, Kotlin or both # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both From e9ba63f88d20bb383fe0445c3acf92f1bbb1ef4b Mon Sep 17 00:00:00 2001 From: Peter Lubell-Doughtie Date: Fri, 24 Mar 2023 14:09:53 -0400 Subject: [PATCH 04/15] Update codeql.yml --- .github/workflows/codeql.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index fbdd495d7b..f0483f107c 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -66,9 +66,9 @@ jobs: # If the Autobuild fails above, remove it and uncomment the following three lines. # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh + - run: | + echo "Run, Build Application using script" + cd android && ./gradlew build - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v2 From 32cf4d292d4d12749674473086ba6faea4b12bcd Mon Sep 17 00:00:00 2001 From: Peter Lubell-Doughtie Date: Fri, 24 Mar 2023 14:10:52 -0400 Subject: [PATCH 05/15] Update codeql.yml --- .github/workflows/codeql.yml | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index f0483f107c..c58e93c74a 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -3,12 +3,6 @@ # # 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: @@ -54,18 +48,9 @@ jobs: # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs # queries: security-extended,security-and-quality - - # Autobuild attempts to build any compiled languages (C/C++, C#, Go, 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@v2 - # ℹī¸ Command-line programs to run using the OS shell. # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - # If the Autobuild fails above, remove it and uncomment the following three lines. - # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - - run: | echo "Run, Build Application using script" cd android && ./gradlew build From 8e70fc76443f5d5dd96ee0df4125f3fa4b31dd34 Mon Sep 17 00:00:00 2001 From: Peter Lubell-Doughtie Date: Mon, 27 Mar 2023 11:03:33 -0400 Subject: [PATCH 06/15] replace cd with working dir --- .github/workflows/codeql.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index c58e93c74a..578eb26405 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -53,7 +53,8 @@ jobs: - run: | echo "Run, Build Application using script" - cd android && ./gradlew build + ./gradlew build + working-directory: android - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v2 From 165f0fe3b64072c2c1de60479b35f6562913a6f3 Mon Sep 17 00:00:00 2001 From: Elly Kitoto Date: Tue, 28 Mar 2023 10:58:11 +0300 Subject: [PATCH 07/15] Run application script for app module Signed-off-by: Elly Kitoto --- .github/workflows/codeql.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 578eb26405..9a9e37f2cd 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -53,7 +53,7 @@ jobs: - run: | echo "Run, Build Application using script" - ./gradlew build + ./gradlew :quest:clean && ./gradlew :quest:build working-directory: android - name: Perform CodeQL Analysis From b704b826845644af113dbd7dec59f995d916ae84 Mon Sep 17 00:00:00 2001 From: Elly Kitoto Date: Tue, 28 Mar 2023 11:06:08 +0300 Subject: [PATCH 08/15] Name workflow step Signed-off-by: Elly Kitoto --- .github/workflows/codeql.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 9a9e37f2cd..d3d1466954 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -51,9 +51,8 @@ jobs: # ℹī¸ Command-line programs to run using the OS shell. # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - - run: | - echo "Run, Build Application using script" - ./gradlew :quest:clean && ./gradlew :quest:build + - name: Build application using script + run: ./gradlew :quest:clean && ./gradlew :quest:build working-directory: android - name: Perform CodeQL Analysis From 97c91c43186c8dd72e464b77aa4e5b0dc319bc66 Mon Sep 17 00:00:00 2001 From: Peter Lubell-Doughtie Date: Wed, 29 Mar 2023 14:18:14 -0400 Subject: [PATCH 09/15] assemble release --- .github/workflows/codeql.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index d3d1466954..1cb7bb4b45 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -52,7 +52,7 @@ jobs: # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - name: Build application using script - run: ./gradlew :quest:clean && ./gradlew :quest:build + run: ./gradlew :quest:clean && ./gradlew :quest:assembleRelease working-directory: android - name: Perform CodeQL Analysis From cb13fe9178c25ea2fb75b1c7af9edd75f38660d7 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Wed, 5 Apr 2023 14:54:18 +0300 Subject: [PATCH 10/15] =?UTF-8?q?Update=20Configuration=20Signed=20Release?= =?UTF-8?q?=20APK=20=F0=9F=94=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/codeql.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 1cb7bb4b45..988be38332 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -33,6 +33,12 @@ jobs: # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support steps: + + - name: Decode & Generate Keystore file + run: echo $ENCODED_KEYSTORE | base64 -di > "${HOME}"/fhircore.keystore.jks + env: + ENCODED_KEYSTORE: ${{ secrets.KEYSTORE_FILE }} + - name: Checkout repository uses: actions/checkout@v3 @@ -51,8 +57,20 @@ jobs: # ℹī¸ Command-line programs to run using the OS shell. # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + - name: Decode & Generate local.properties file + run: echo $LOCAL_PROPERTIES | base64 -di > local.properties + working-directory: android + env: + LOCAL_PROPERTIES: ${{ secrets.LOCAL_PROPERTIES }} + + - name: Decode & Generate keystore.properties file + run: echo $KEYSTORE_PROPERTIES | base64 -di > keystore.properties + working-directory: android + env: + KEYSTORE_PROPERTIES: ${{ secrets.KEYSTORE_PROPERTIES } + - name: Build application using script - run: ./gradlew :quest:clean && ./gradlew :quest:assembleRelease + run: ./gradlew :quest:clean && ./gradlew :quest:assembleQuest working-directory: android - name: Perform CodeQL Analysis From 2daac325ef57ad12d5a6bf42c26b46460ab2df6e Mon Sep 17 00:00:00 2001 From: Peter Lubell-Doughtie Date: Wed, 5 Apr 2023 09:19:37 -0400 Subject: [PATCH 11/15] missing bracket --- .github/workflows/codeql.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 988be38332..b4a78d4030 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -67,7 +67,7 @@ jobs: run: echo $KEYSTORE_PROPERTIES | base64 -di > keystore.properties working-directory: android env: - KEYSTORE_PROPERTIES: ${{ secrets.KEYSTORE_PROPERTIES } + KEYSTORE_PROPERTIES: ${{ secrets.KEYSTORE_PROPERTIES }} - name: Build application using script run: ./gradlew :quest:clean && ./gradlew :quest:assembleQuest From c8d4b3fe863da023f39951be351e033793745775 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Thu, 6 Apr 2023 09:52:52 +0300 Subject: [PATCH 12/15] Update codeQL config - Remove clean task - Add Stack Trace Logging --- .github/workflows/codeql.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index b4a78d4030..cf89b21501 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -70,7 +70,7 @@ jobs: KEYSTORE_PROPERTIES: ${{ secrets.KEYSTORE_PROPERTIES }} - name: Build application using script - run: ./gradlew :quest:clean && ./gradlew :quest:assembleQuest + run: ./gradlew :quest:assembleQuest --stacktrace working-directory: android - name: Perform CodeQL Analysis From e61ecf818722b42879380b2c4e8b5bbfebbb85d2 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Thu, 6 Apr 2023 10:24:55 +0300 Subject: [PATCH 13/15] Specify Release Build Variant --- .github/workflows/codeql.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index cf89b21501..2d9505303b 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -70,7 +70,7 @@ jobs: KEYSTORE_PROPERTIES: ${{ secrets.KEYSTORE_PROPERTIES }} - name: Build application using script - run: ./gradlew :quest:assembleQuest --stacktrace + run: ./gradlew :quest:assembleQuestRelease --stacktrace working-directory: android - name: Perform CodeQL Analysis From c9a05738f3dc9adc2adf9ab0963296da14370212 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Thu, 6 Apr 2023 11:27:05 +0300 Subject: [PATCH 14/15] Update codeql.yml --- .github/workflows/codeql.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 2d9505303b..a36256a7e4 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -70,7 +70,7 @@ jobs: KEYSTORE_PROPERTIES: ${{ secrets.KEYSTORE_PROPERTIES }} - name: Build application using script - run: ./gradlew :quest:assembleQuestRelease --stacktrace + run: ./gradlew :quest:assembleQuestRelease working-directory: android - name: Perform CodeQL Analysis From 461d2ea2bc188d215dfcc427502488d783630040 Mon Sep 17 00:00:00 2001 From: Peter Lubell-Doughtie Date: Tue, 11 Apr 2023 15:11:11 -0400 Subject: [PATCH 15/15] specify code-scanning explicitly --- .github/codeql/codeql-config.yml | 12 ++++++++++++ .github/workflows/codeql.yml | 10 +++------- 2 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 .github/codeql/codeql-config.yml diff --git a/.github/codeql/codeql-config.yml b/.github/codeql/codeql-config.yml new file mode 100644 index 0000000000..ee31ed4ea3 --- /dev/null +++ b/.github/codeql/codeql-config.yml @@ -0,0 +1,12 @@ +name: "OpenSRP config" + +disable-default-queries: true + +packs: + - codeql/java-queries +query-filters: +- exclude: + problem.severity: + - error + - warning + - recommendation diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index a36256a7e4..0d4d13f45e 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -47,15 +47,11 @@ jobs: uses: github/codeql-action/init@v2 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. - - # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality - - # ℹī¸ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + # Details on CodeQL's query packs refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: code-scanning + config-file: ./.github/codeql/codeql-config.yml - name: Decode & Generate local.properties file run: echo $LOCAL_PROPERTIES | base64 -di > local.properties