-
Notifications
You must be signed in to change notification settings - Fork 3
202 lines (161 loc) · 5.89 KB
/
CodeQL_AIO_Examples.yml
File metadata and controls
202 lines (161 loc) · 5.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
name: CodeQL_AIO_ContainerizedApp
on:
# push:
# branches: [ main ]
pull_request:
branches: [main]
jobs:
Container_Example01_JavaScript:
runs-on: "Ubuntu-latest"
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [javascript]
container:
image: node:18
options: --user root
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set safe directory
run: |
git config --global --add safe.directory /__w/CodeQL_containerizedApp/CodeQL_containerizedApp/
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages:
${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# 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
# queries: security-extended,security-and-quality
- name: NPM Installation
working-directory: /__w/CodeQL_containerizedApp/CodeQL_containerizedApp/Example01_JavaScript/
run: |
npm i -g typescript ts-node && \
npm install --omit=dev --unsafe-perm && \
npm dedupe && \
rm -rf frontend/node_modules && \
rm -rf frontend/.angular && \
rm -rf frontend/src/assets && \
mkdir logs && \
chown -R 65532 logs && \
chgrp -R 0 ftp/ frontend/dist/ logs/ data/ i18n/ && \
chmod -R g=u ftp/ frontend/dist/ logs/ data/ i18n/ && \
rm data/chatbot/botDefaultTrainingData.json || true && \
rm ftp/legal.md || true && \
rm i18n/*.json || true
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
Container_Example02_Java:
needs: Container_Example01_JavaScript
runs-on: "Ubuntu-latest"
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [Java]
container:
image: openjdk:8
options: --user root
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set safe directory
run: |
git config --global --add safe.directory /__w/CodeQL_containerizedApp/CodeQL_containerizedApp/
- name: Install dependencies
working-directory: /__w/CodeQL_containerizedApp/CodeQL_containerizedApp/Example02_Java/
run: |
apt-get update && \
apt-get install build-essential maven default-jdk cowsay netcat -y && \
update-alternatives --config javac
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
- name: Build with Maven
working-directory: /__w/CodeQL_containerizedApp/CodeQL_containerizedApp/Example02_Java/
run: |
mvn -B package --file pom.xml
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
Container_Example03_Csharp:
needs: [Container_Example01_JavaScript, Container_Example02_Java]
runs-on: "Ubuntu-latest"
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [csharp]
container:
image: mcr.microsoft.com/dotnet/aspnet:7.0
#options: --cpu 2
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
- name: Install dependencies
run: |
apt-get update && apt-get upgrade -y --no-install-recommends && \
apt-get install -y wget && \
apt-get install -y curl
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Build with dotnet
working-directory: /__w/CodeQL_containerizedApp/CodeQL_containerizedApp/Example03_Csharp/WebGoatCore/
run: dotnet build WebGoatCore.csproj
# - name: Autobuild
# uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
Container_Example04_DockerBuild_and_Scan:
needs: [Container_Example01_JavaScript, Container_Example02_Java, Container_Example03_Csharp]
name: Analyze
runs-on: "Ubuntu-latest"
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'python' ]
container:
image: jkafaty/codeql-dockerapp-example
options: --user root
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Fix permissions and Install Python3
run: |
chown root:root -R /github/home/ && \
chmod 777 -R /github/home/ && \
chown root:root -R /__w/_actions/github/codeql-action/ && \
chmod 777 -R /__w/_actions/github/codeql-action/ && \
apt-get update && apt-get install -y python3 python3-pip
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2