Skip to content

Commit ea04be9

Browse files
authored
Refactor CodeQL workflow configuration
Updated CodeQL workflow to restrict permissions and schedule analysis.
1 parent 9a60055 commit ea04be9

1 file changed

Lines changed: 20 additions & 22 deletions

File tree

.github/workflows/codeql.yml

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,22 @@ on:
66
pull_request:
77
branches: [ "main", "DSSRF_Branch_Rule" ]
88
schedule:
9-
- cron: '* * * * *'
9+
- cron: '0 13 * * *'
10+
11+
# SCORECARD FIX: Top-level permission restriction (SolarWinds Defense)
12+
permissions: read-all
1013

1114
jobs:
1215
analyze:
1316
name: Analyze (${{ matrix.language }})
1417
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
18+
19+
# Job-level permissions (Least Privilege)
1520
permissions:
16-
# required for all workflows
17-
security-events: write
18-
19-
# required to fetch internal or private CodeQL packs
20-
packages: read
21-
22-
# only required for workflows in private repositories
23-
actions: read
24-
contents: read
21+
security-events: write # Required to upload results
22+
packages: read # Required for CodeQL packs
23+
actions: read # Required for private repo status
24+
contents: read # Required to scan code
2525

2626
strategy:
2727
fail-fast: false
@@ -31,24 +31,22 @@ jobs:
3131
build-mode: none
3232
- language: javascript-typescript
3333
build-mode: none
34-
# CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift'
35-
# Use `c-cpp` to analyze code written in C, C++ or both
36-
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
37-
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
38-
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
39-
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
40-
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
41-
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
34+
4235
steps:
4336
- name: Checkout repository
44-
uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98
37+
# Pinned SHA (v4.2.2 equivalent)
38+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
4539

46-
# Initializes the CodeQL tools for scanning.
4740
- name: Initialize CodeQL
41+
# Pinned SHA (v3 equivalent)
4842
uses: github/codeql-action/init@7434149006143a4d75b82a2f411ef15b03ccc2d7
4943
with:
5044
languages: ${{ matrix.language }}
5145
build-mode: ${{ matrix.build-mode }}
52-
53-
# 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
46+
# Added security-extended to find deeper SSRF issues
5447
queries: security-extended,security-and-quality
48+
49+
- name: Perform CodeQL Analysis
50+
uses: github/codeql-action/analyze@7434149006143a4d75b82a2f411ef15b03ccc2d7
51+
with:
52+
category: "/language:${{matrix.language}}"

0 commit comments

Comments
 (0)