diff --git a/.github/codeql/codeql-config.yml b/.github/codeql/codeql-config.yml new file mode 100644 index 0000000000..f963eb749c --- /dev/null +++ b/.github/codeql/codeql-config.yml @@ -0,0 +1,18 @@ +name: "Aletheia CodeQL Configuration" + +queries: + - uses: security-and-quality + +packs: + csharp: + - .github/codeql/extensions + +query-filters: + - exclude: + id: cs/log-forging + +paths-ignore: + - node_modules + - _output + - _tests + - _artifacts diff --git a/.github/codeql/extensions/log-sanitizers.yml b/.github/codeql/extensions/log-sanitizers.yml new file mode 100644 index 0000000000..0b6e96ecc1 --- /dev/null +++ b/.github/codeql/extensions/log-sanitizers.yml @@ -0,0 +1,7 @@ +extensions: + - addsTo: + pack: codeql/csharp-all + extensible: summaryModel + data: + - ["NzbDrone.Common.Extensions", "StringExtensions", false, "SanitizeForLog", "(System.String,System.Int32)", "", "Argument[this]", "ReturnValue", "taint", "manual"] + diff --git a/.github/codeql/extensions/qlpack.yml b/.github/codeql/extensions/qlpack.yml new file mode 100644 index 0000000000..b0be60e5a0 --- /dev/null +++ b/.github/codeql/extensions/qlpack.yml @@ -0,0 +1,6 @@ +name: aletheia/codeql-extensions +version: 1.0.0 +extensionTargets: + codeql/csharp-all: "*" +dataExtensions: + - log-sanitizers.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000000..2662796200 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,53 @@ +name: CodeQL + +on: + push: + branches: [develop, master] + pull_request: + branches: [develop, master] + schedule: + - cron: '0 0 * * 0' + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + runs-on: ubuntu-latest + permissions: + security-events: write + packages: read + actions: read + contents: read + + strategy: + fail-fast: false + matrix: + include: + - language: csharp + build-mode: manual + - language: javascript-typescript + build-mode: none + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + config-file: .github/codeql/codeql-config.yml + + - name: Setup .NET + if: matrix.language == 'csharp' + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' + + - name: Build C# + if: matrix.language == 'csharp' + run: dotnet build src/Radarr.sln --configuration Release + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}"