Skip to content

Commit dbec245

Browse files
kevinjqliuzhjwpku
andauthored
CI: Add CodeQL workflow for GitHub Actions security scanning (#567)
This adds a CodeQL workflow to scan GitHub Actions workflow files for security issues such as script injection, use of untrusted input, and other misconfigurations. Reference: https://github.blog/security/application-security/how-to-secure-your-github-actions-workflows-with-codeql/ **Triggers:** - Push and PR to `main` - Weekly scheduled scan (Mondays at 4:16 UTC) This is based on [Apache Infra recommendation](https://cwiki.apache.org/confluence/display/BUILDS/GitHub+Actions+Security), > IMPORTANT! You should enable CodeQL "actions" scanning in your repositories as described in https://github.blog/security/application-security/how-to-secure-your-github-actions-workflows-with-codeql/ - this will scan and flag those issues described below and many more automatically for you --------- Co-authored-by: Junwang Zhao <zhjwpku@gmail.com>
1 parent c559a08 commit dbec245

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

.github/workflows/codeql.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
20+
name: "CodeQL"
21+
22+
on:
23+
push:
24+
branches:
25+
- main
26+
pull_request:
27+
branches:
28+
- main
29+
schedule:
30+
- cron: '16 4 * * 1'
31+
32+
jobs:
33+
analyze:
34+
name: Analyze Actions
35+
runs-on: ubuntu-latest
36+
permissions:
37+
security-events: write
38+
packages: read
39+
40+
steps:
41+
- name: Checkout repository
42+
uses: actions/checkout@v4
43+
44+
- name: Initialize CodeQL
45+
uses: github/codeql-action/init@v4
46+
with:
47+
languages: actions
48+
49+
- name: Perform CodeQL Analysis
50+
uses: github/codeql-action/analyze@v4
51+
with:
52+
category: "/language:actions"

0 commit comments

Comments
 (0)