Skip to content

Commit 5fc4572

Browse files
TGTGamerymc9
authored andcommitted
feat(codeql.yml): add CodeQL workflow for security analysis on push, pull request,
and schedule events targeting main, develop, and release/* branches. Set permissions for job execution and analysis. Include steps to harden runner, checkout repository, initialize CodeQL, autobuild, and perform CodeQL analysis for javascript and typescript languages.
1 parent 24b6c26 commit 5fc4572

File tree

1 file changed

+112
-0
lines changed

1 file changed

+112
-0
lines changed

.github/workflows/codeql.yml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
###
2+
# @format
3+
# -----
4+
# Project: zenstack-monorepo
5+
# File: codeql.yml
6+
# Path: \.github\workflows\codeql.yml
7+
# Created Date: Monday, February 19th 2024
8+
# Author: Jonathan Stevens, jonathan@resnovas.com
9+
# Github: https://github.com/TGTGamer
10+
# -----
11+
# Contributing: Please read through our contributing guidelines.
12+
# Included are directions for opening issues, coding standards,
13+
# and notes on development. These can be found at
14+
# https://github.com/zenstack-monorepo/blob/develop/CONTRIBUTING.md
15+
# -----
16+
# Code of Conduct: This project abides by the Contributor Covenant, v2.0
17+
# Please interact in ways that contribute to an open, welcoming, diverse,
18+
# inclusive, and healthy community. Our Code of Conduct can be found at
19+
# https://github.com/zenstack-monorepo/blob/develop/CODE_OF_CONDUCT.md
20+
# -----
21+
# Copyright (c) 2024 ZenstackHQ - All Rights Reserved
22+
# LICENSE: MIT License (MIT)
23+
# -----
24+
# This program has been provided under confidence of the copyright holder and
25+
# is licensed for copying, distribution and modification under the terms
26+
# of the MIT License (MIT) published as the License,
27+
# or (at your option) any later version of this license.
28+
# This program is distributed in the hope that it will be useful,
29+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
30+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31+
# MIT License for more details.
32+
# You should have received a copy of the MIT License
33+
# along with this program. If not, please write to: jonathan@resnovas.com,
34+
# or see https://opensource.org/licenses/MIT
35+
# -----
36+
# DELETING THIS NOTICE AUTOMATICALLY VOIDS YOUR LICENSE
37+
###
38+
39+
name: Security - CodeQL
40+
41+
on:
42+
merge_group:
43+
push:
44+
branches:
45+
- main
46+
- develop
47+
- release/*
48+
pull_request:
49+
branches:
50+
- main
51+
- develop
52+
- release/*
53+
schedule:
54+
- cron: "0 0 * * 1"
55+
56+
permissions:
57+
contents: read
58+
59+
60+
jobs:
61+
analyze:
62+
permissions:
63+
actions: read
64+
contents: read
65+
security-events: write
66+
name: Analyze
67+
runs-on: ubuntu-latest
68+
69+
strategy:
70+
fail-fast: false
71+
matrix:
72+
language: ["javascript", "typescript"]
73+
# CodeQL supports [ $supported-codeql-languages ]
74+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
75+
76+
steps:
77+
- name: Harden Runner
78+
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1
79+
with:
80+
egress-policy: audit
81+
82+
- name: Checkout repository
83+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
84+
85+
# Initializes the CodeQL tools for scanning.
86+
- name: Initialize CodeQL
87+
uses: github/codeql-action/init@1500a131381b66de0c52ac28abb13cd79f4b7ecc # v2.22.12
88+
with:
89+
languages: ${{ matrix.language }}
90+
# If you wish to specify custom queries, you can do so here or in a config file.
91+
# By default, queries listed here will override any specified in a config file.
92+
# Prefix the list here with "+" to use these queries and those in the config file.
93+
94+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
95+
# If this step fails, then you should remove it and run the build manually (see below)
96+
- name: Autobuild
97+
uses: github/codeql-action/autobuild@1500a131381b66de0c52ac28abb13cd79f4b7ecc # v2.22.12
98+
99+
# ℹ️ Command-line programs to run using the OS shell.
100+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
101+
102+
# If the Autobuild fails above, remove it and uncomment the following three lines.
103+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
104+
105+
# - run: |
106+
# echo "Run, Build Application using script"
107+
# ./location_of_script_within_repo/buildscript.sh
108+
109+
- name: Perform CodeQL Analysis
110+
uses: github/codeql-action/analyze@1500a131381b66de0c52ac28abb13cd79f4b7ecc # v2.22.12
111+
with:
112+
category: "/language:${{matrix.language}}"

0 commit comments

Comments
 (0)