Skip to content

Commit 63189f4

Browse files
committed
ci: add CodeQL Advanced security scanning workflow
Adds security scanning via GitHub CodeQL to detect vulnerabilities in JavaScript/TypeScript source and GitHub Actions workflows. - Analyzes javascript-typescript and actions with build-mode: none - Uses security-extended query suite for comprehensive coverage - SHA-pinned actions following existing repo conventions - Daily scheduled run at 23:28 UTC plus push/PR triggers - paths-ignore on PRs to skip markdown-only changes - Updated docs/07-github-automation.md Closes #386 Signed-off-by: cheese-cakee <farzanaman99@gmail.com>
1 parent 287d245 commit 63189f4

File tree

2 files changed

+85
-0
lines changed

2 files changed

+85
-0
lines changed

.github/workflows/codeql.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
name: "CodeQL Advanced"
4+
5+
on:
6+
push:
7+
branches: ["main"]
8+
pull_request:
9+
branches: ["main"]
10+
paths-ignore:
11+
- "**/*.md"
12+
schedule:
13+
- cron: "28 23 * * *"
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: true
18+
19+
permissions:
20+
contents: read
21+
22+
jobs:
23+
analyze:
24+
name: Analyze (${{ matrix.language }})
25+
runs-on: ubuntu-latest
26+
permissions:
27+
contents: read
28+
security-events: write
29+
packages: read
30+
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
include:
35+
- language: actions
36+
build-mode: none
37+
- language: javascript-typescript
38+
build-mode: none
39+
40+
steps:
41+
- name: Harden the runner (Audit all outbound calls)
42+
uses: step-security/harden-runner@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1
43+
with:
44+
egress-policy: audit
45+
46+
- name: Checkout repository
47+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
48+
49+
- name: Initialize CodeQL
50+
uses: github/codeql-action/init@c10b8064de6f491fea524254123dbe5e09572f13 # v4.3.5
51+
with:
52+
languages: ${{ matrix.language }}
53+
build-mode: ${{ matrix.build-mode }}
54+
queries: security-extended
55+
dependency-caching: true
56+
57+
- name: Perform CodeQL Analysis
58+
uses: github/codeql-action/analyze@c10b8064de6f491fea524254123dbe5e09572f13 # v4.3.5
59+
with:
60+
category: "/language:${{ matrix.language }}"

docs/07-github-automation.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ The repo currently includes:
99

1010
- `.github/workflows/ci.yml`
1111
- `.github/workflows/pr-formatting.yaml`
12+
- `.github/workflows/codeql.yml`
1213

1314
## CI Workflow
1415

@@ -53,6 +54,29 @@ The workflow does not currently run:
5354

5455
This workflow checks the pull request title against conventional commit style.
5556

57+
## CodeQL Workflow
58+
59+
`codeql.yml` runs security analysis via GitHub's CodeQL scanning. It triggers on:
60+
61+
- pushes to `main`
62+
- pull requests targeting `main` (ignoring `.md` file-only changes)
63+
- a daily schedule at 23:28 UTC
64+
65+
### Languages Analyzed
66+
67+
The workflow uses a matrix strategy to analyze two languages in parallel:
68+
69+
- **GitHub Actions** (`actions`) — analyzes the repository's own Actions workflow files
70+
- **JavaScript/TypeScript** (`javascript-typescript`) — analyzes the website's source code
71+
72+
Both use `build-mode: none` since JavaScript/TypeScript and Actions are interpreted languages
73+
that do not require compilation.
74+
75+
### Security Queries
76+
77+
The workflow uses the `security-extended` query suite for comprehensive security coverage,
78+
including CWE classifications and security hardening recommendations.
79+
5680
## What Contributors Should Expect
5781

5882
Before asking for review, contributors should expect GitHub to reject:
@@ -61,6 +85,7 @@ Before asking for review, contributors should expect GitHub to reject:
6185
- source changes that are not formatted
6286
- lint-breaking changes
6387
- changes that break the production build
88+
- changes that introduce security vulnerabilities (detected by CodeQL)
6489

6590
## Recommended Habit
6691

0 commit comments

Comments
 (0)