From eb4d4c161225ebf2b7049fc86c2367e720ceaf32 Mon Sep 17 00:00:00 2001 From: ArielSAdamsNASA Date: Fri, 21 May 2021 08:20:49 -0500 Subject: [PATCH] Fix #86, Implement Coding Standard in CodeQL --- .github/codeql/codeql-coding-standard.yml | 19 +++++++ .github/codeql/codeql-security.yml | 8 +++ .github/workflows/codeql-build.yml | 63 +++++++++++++++++++++-- 2q | 14 +++++ 4 files changed, 101 insertions(+), 3 deletions(-) create mode 100644 .github/codeql/codeql-coding-standard.yml create mode 100644 .github/codeql/codeql-security.yml create mode 100644 2q diff --git a/.github/codeql/codeql-coding-standard.yml b/.github/codeql/codeql-coding-standard.yml new file mode 100644 index 0000000..57b668f --- /dev/null +++ b/.github/codeql/codeql-coding-standard.yml @@ -0,0 +1,19 @@ +name: "CodeQL Coding Standard Configuration File" + +disable-default-queries: true + +queries: + - name: JPL Rules + uses: ./codeql/cpp/ql/src/JPL_C + - name: MISRA Rule 9-5-1 + uses: ./codeql/cpp/ql/src/jsf/4.20 Unions and Bit Fields/AV Rule 153.ql + - name: MISRA Rule 5-18-1 + uses: ./codeql/cpp/ql/src/jsf/4.21 Operators/AV Rule 168.ql + - name: MISRA 6-2-2 + uses: ./codeql/cpp/ql/src/jsf/4.25 Expressions/AV Rule 202.ql + - name: MISRA Rule 5-14-1 + uses: ./codeql/cpp/ql/src/jsf/4.21 Operators/AV Rule 165.ql + - name: MISRA Rule 5-3-2 + uses: ./codeql/cpp/ql/src/jsf/4.21 Operators/AV Rule 165.ql + - name: MISRA Rule 7-5-2 + uses: ./codeql/cpp/ql/src/jsf/4.22 Pointers and References/AV Rule 173.ql diff --git a/.github/codeql/codeql-security.yml b/.github/codeql/codeql-security.yml new file mode 100644 index 0000000..a1cfa6a --- /dev/null +++ b/.github/codeql/codeql-security.yml @@ -0,0 +1,8 @@ +name: "CodeQL Security Configuration File" + +queries: + - name: Security and Quality + uses: security-and-quality + - name: Security Extended + uses: security-extended + \ No newline at end of file diff --git a/.github/workflows/codeql-build.yml b/.github/workflows/codeql-build.yml index cbeb3d4..dfa2c8e 100644 --- a/.github/workflows/codeql-build.yml +++ b/.github/workflows/codeql-build.yml @@ -2,9 +2,9 @@ name: "CodeQL Analysis" on: push: + pull_request: branches: - main - pull_request: env: SIMULATION: native @@ -13,8 +13,23 @@ env: BUILDTYPE: release jobs: + #Checks for duplicate actions. Skips push actions if there is a matching or duplicate pull-request action. + check-for-duplicates: + runs-on: ubuntu-latest + # Map a step output to a job output + outputs: + should_skip: ${{ steps.skip_check.outputs.should_skip }} + steps: + - id: skip_check + uses: fkirc/skip-duplicate-actions@master + with: + concurrent_skipping: 'same_content' + skip_after_successful_duplicate: 'true' + do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]' - CodeQL-Build: + CodeQL-Security-Build: + needs: check-for-duplicates + if: ${{ needs.check-for-duplicates.outputs.should_skip != 'true' }} runs-on: ubuntu-18.04 timeout-minutes: 15 @@ -38,7 +53,7 @@ jobs: uses: github/codeql-action/init@v1 with: languages: c - queries: +security-extended, security-and-quality + config-file: nasa/ci_lab/.github/codeql/codeql-security.yml@main # Setup the build system - name: Set up for build @@ -53,3 +68,45 @@ jobs: - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v1 + + CodeQL-Coding Standard-Build: + needs: check-for-duplicates + if: ${{ needs.check-for-duplicates.outputs.should_skip != 'true' }} + runs-on: ubuntu-18.04 + timeout-minutes: 15 + + steps: + # Checks out a copy of your repository on the ubuntu-latest machine + - name: Checkout bundle + uses: actions/checkout@v2 + with: + repository: nasa/cFS + submodules: true + + - name: Checkout submodule + uses: actions/checkout@v2 + with: + path: apps/ci_lab + + - name: Check versions + run: git submodule + + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: c + config-file: nasa/ci_lab/.github/codeql/codeql-coding-standard.yml@main + + # Setup the build system + - name: Set up for build + run: | + cp ./cfe/cmake/Makefile.sample Makefile + cp -r ./cfe/cmake/sample_defs sample_defs + make prep + + # Build the code + - name: Build + run: make ci_lab + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 \ No newline at end of file diff --git a/2q b/2q new file mode 100644 index 0000000..0e2aad4 --- /dev/null +++ b/2q @@ -0,0 +1,14 @@ +Fix #80, Add Contributing Guide + +# Please enter the commit message for your changes. Lines starting +# with '#' will be ignored, and an empty message aborts the commit. +# +# Date: Tue Mar 16 12:53:19 2021 -0500 +# +# On branch fix-80-add_contributing_guide +# Changes to be committed: +# new file: CONTRIBUTING.md +# +# Changes not staged for commit: +# modified: CONTRIBUTING.md +#