|
| 1 | +name: "Code Scanning" |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "master" ] |
| 6 | + pull_request: |
| 7 | + # The branches below must be a subset of the branches above |
| 8 | + branches: [ "master" ] |
| 9 | + schedule: |
| 10 | + - cron: '20 3 * * 0' |
| 11 | + |
| 12 | +jobs: |
| 13 | + codeql: |
| 14 | + name: CodeQL |
| 15 | + # Runner size impacts CodeQL analysis time. To learn more, please see: |
| 16 | + # - https://gh.io/recommended-hardware-resources-for-running-codeql |
| 17 | + # - https://gh.io/supported-runners-and-hardware-resources |
| 18 | + # - https://gh.io/using-larger-runners |
| 19 | + # Consider using larger runners for possible analysis time improvements. |
| 20 | + runs-on: ubuntu-latest |
| 21 | + timeout-minutes: 360 |
| 22 | + permissions: |
| 23 | + actions: read |
| 24 | + contents: read |
| 25 | + security-events: write |
| 26 | + |
| 27 | + steps: |
| 28 | + - name: Checkout repository |
| 29 | + uses: actions/checkout@v3 |
| 30 | + |
| 31 | + # Initializes the CodeQL tools for scanning. |
| 32 | + - name: Initialize CodeQL |
| 33 | + uses: github/codeql-action/init@v2 |
| 34 | + with: |
| 35 | + languages: 'c-cpp' |
| 36 | + # If you wish to specify custom queries, you can do so here or in a config file. |
| 37 | + # By default, queries listed here will override any specified in a config file. |
| 38 | + # Prefix the list here with "+" to use these queries and those in the config file. |
| 39 | + |
| 40 | + # For more 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 |
| 41 | + # queries: security-extended,security-and-quality |
| 42 | + |
| 43 | + |
| 44 | + # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). |
| 45 | + # If this step fails, then you should remove it and run the build manually (see below) |
| 46 | + - name: Autobuild |
| 47 | + uses: github/codeql-action/autobuild@v2 |
| 48 | + |
| 49 | + # ℹ️ Command-line programs to run using the OS shell. |
| 50 | + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun |
| 51 | + |
| 52 | + # If the Autobuild fails above, remove it and uncomment the following three lines. |
| 53 | + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. |
| 54 | + |
| 55 | + # - run: | |
| 56 | + # echo "Run, Build Application using script" |
| 57 | + # ./location_of_script_within_repo/buildscript.sh |
| 58 | + |
| 59 | + - name: Perform CodeQL Analysis |
| 60 | + uses: github/codeql-action/analyze@v2 |
| 61 | + with: |
| 62 | + category: "/language:c-cpp" |
| 63 | + |
| 64 | + flawfinder: |
| 65 | + name: Flawfinder |
| 66 | + runs-on: ubuntu-latest |
| 67 | + permissions: |
| 68 | + actions: read |
| 69 | + contents: read |
| 70 | + security-events: write |
| 71 | + steps: |
| 72 | + - name: Checkout code |
| 73 | + uses: actions/checkout@v3 |
| 74 | + |
| 75 | + - name: flawfinder_scan |
| 76 | + uses: david-a-wheeler/flawfinder@8e4a779ad59dbfaee5da586aa9210853b701959c |
| 77 | + with: |
| 78 | + arguments: '--sarif ./' |
| 79 | + output: 'flawfinder_results.sarif' |
| 80 | + |
| 81 | + - name: Upload analysis results to GitHub Security tab |
| 82 | + uses: github/codeql-action/upload-sarif@v2 |
| 83 | + with: |
| 84 | + sarif_file: ${{github.workspace}}/flawfinder_results.sarif |
| 85 | + |
| 86 | + # microsoft-analyze: |
| 87 | + # permissions: |
| 88 | + # contents: read # for actions/checkout to fetch code |
| 89 | + # security-events: write # for github/codeql-action/upload-sarif to upload SARIF results |
| 90 | + # actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status |
| 91 | + # name: Microsoft Analyze |
| 92 | + # runs-on: windows-latest |
| 93 | + |
| 94 | + # steps: |
| 95 | + # - name: Checkout repository |
| 96 | + # uses: actions/checkout@v3 |
| 97 | + |
| 98 | + # - name: Configure CMake |
| 99 | + # run: cmake -B ./build |
| 100 | + |
| 101 | + # # Build is not required unless generated source files are used |
| 102 | + # # - name: Build CMake |
| 103 | + # # run: cmake --build ./build |
| 104 | + |
| 105 | + # - name: Initialize MSVC Code Analysis |
| 106 | + # uses: microsoft/msvc-code-analysis-action@04825f6d9e00f87422d6bf04e1a38b1f3ed60d99 |
| 107 | + # # Provide a unique ID to access the sarif output path |
| 108 | + # id: run-analysis |
| 109 | + # with: |
| 110 | + # cmakeBuildDirectory: ${{ env.build }} |
| 111 | + # # Ruleset file that will determine what checks will be run |
| 112 | + # ruleset: NativeRecommendedRules.ruleset |
| 113 | + |
| 114 | + # # Upload SARIF file to GitHub Code Scanning Alerts |
| 115 | + # - name: Upload SARIF to GitHub |
| 116 | + # uses: github/codeql-action/upload-sarif@v2 |
| 117 | + # with: |
| 118 | + # sarif_file: ${{ steps.run-analysis.outputs.sarif }} |
| 119 | + |
| 120 | + # # Upload SARIF file as an Artifact to download and view |
| 121 | + # # - name: Upload SARIF as an Artifact |
| 122 | + # # uses: actions/upload-artifact@v3 |
| 123 | + # # with: |
| 124 | + # # name: sarif-file |
| 125 | + # # path: ${{ steps.run-analysis.outputs.sarif }} |
0 commit comments