Merge pull request #124 from OWASP/renovate/major-github-actions #184
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| name: "Security Scanning" | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: ["main", "master"] | |
| pull_request: | |
| branches: ["main", "master"] | |
| schedule: | |
| # Run weekly on Sundays at 3 AM UTC | |
| - cron: '0 3 * * 0' | |
| permissions: | |
| actions: read | |
| contents: read | |
| security-events: write | |
| jobs: | |
| codeql-analysis: | |
| name: CodeQL Analysis | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| language: ['c-cpp', 'go', 'csharp'] | |
| include: | |
| - language: 'c-cpp' | |
| build-mode: manual | |
| - language: 'go' | |
| build-mode: autobuild | |
| - language: 'csharp' | |
| build-mode: manual | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Setup Go | |
| if: matrix.language == 'go' | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: '1.26' | |
| - name: Setup .NET | |
| if: matrix.language == 'csharp' | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: '8.0.x' | |
| - name: Initialize CodeQL | |
| uses: github/codeql-action/init@v4 | |
| with: | |
| languages: ${{ matrix.language }} | |
| build-mode: ${{ matrix.build-mode }} | |
| - name: Manual build for .NET | |
| if: matrix.language == 'csharp' | |
| run: | | |
| cd dotnet/dotnetproject | |
| dotnet restore | |
| dotnet build | |
| - name: Manual build for C/C++ | |
| if: matrix.language == 'c-cpp' | |
| run: | | |
| # Build C projects | |
| gcc c/main.c -o c/main | |
| gcc c/advanced/advanced.c -o c/advanced/advanced | |
| gcc c/challenge52/main.c -o c/challenge52/main | |
| # Build C++ projects | |
| g++ cplus/main.cpp -o cplus/main | |
| - name: Perform CodeQL Analysis | |
| uses: github/codeql-action/analyze@v4 | |
| with: | |
| category: "/language:${{matrix.language}}" | |
| semgrep-analysis: | |
| name: Semgrep Analysis | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Run Semgrep | |
| id: semgrep | |
| uses: semgrep/semgrep-action@v1 | |
| with: | |
| config: >- | |
| p/security-audit | |
| p/secrets | |
| p/owasp-top-ten | |
| p/cwe-top-25 | |
| generateSarif: "1" | |
| continue-on-error: true | |
| - name: Upload Semgrep SARIF | |
| uses: github/codeql-action/upload-sarif@v4 | |
| with: | |
| sarif_file: semgrep.sarif | |
| if: always() && steps.semgrep.conclusion != 'skipped' |