Skip to content

Commit 0ca9d65

Browse files
authored
CI: Add CodeQL workflow for GitHub Actions security scanning (#20636)
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 --- *This PR was generated by https://gist.github.com/kevinjqliu/97d24733c7b75cd92b68bf8f5b247891*
1 parent 3238a7e commit 0ca9d65

1 file changed

Lines changed: 55 additions & 0 deletions

File tree

.github/workflows/codeql.yml

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

0 commit comments

Comments
 (0)