Restrict the GitHub token permissions only to the required ones; this way, even if the attackers will succeed in compromising your workflow, they won’t be able to do much. - Included permissions for the action. https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs [Keeping your GitHub Actions and workflows secure Part 1: Preventing pwn requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/) Signed-off-by: neilnaveen <42328488+neilnaveen@users.noreply.github.com>
48 lines
1.1 KiB
YAML
48 lines
1.1 KiB
YAML
name: "Code scanning - action"
|
|
|
|
on:
|
|
push:
|
|
branches: ['*/dev','*/contrib']
|
|
pull_request:
|
|
# The branches below must be a subset of the branches above
|
|
branches: ['*/dev','*/contrib']
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
CodeQL-Build:
|
|
|
|
permissions:
|
|
actions: read # for github/codeql-action/init to get workflow details
|
|
contents: read # for actions/checkout to fetch code
|
|
security-events: write # for github/codeql-action/analyze to upload SARIF results
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
actions: read
|
|
contents: read
|
|
security-events: write
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
# Initializes the CodeQL tools for scanning.
|
|
- name: Initialize CodeQL
|
|
uses: github/codeql-action/init@v2
|
|
with:
|
|
config-file: ./.github/config/codeql-config.yml
|
|
|
|
- name: Setup dotnet
|
|
uses: actions/setup-dotnet@v2
|
|
with:
|
|
dotnet-version: '6.0.x'
|
|
|
|
- name: dotnet build
|
|
run: dotnet build umbraco.sln -c SkipTests
|
|
|
|
- name: Perform CodeQL Analysis
|
|
uses: github/codeql-action/analyze@v2
|