@@ -23,7 +23,7 @@ const (
23
23
nonRoot = "non-root"
24
24
)
25
25
26
- type EscalationReport struct {
26
+ type LintReport struct {
27
27
TotalSourceWorkloads int `json:"total_source_workloads"`
28
28
TotalTargetWorkloads int `json:"total_target_workloads"`
29
29
TotalSourceImages int `json:"total_source_images"`
@@ -128,8 +128,8 @@ func (e *Escalation) IsReduced() bool {
128
128
}
129
129
130
130
// NewEscalationReport returns an escalation report object
131
- func NewEscalationReport () * EscalationReport {
132
- return & EscalationReport {
131
+ func NewEscalationReport () * LintReport {
132
+ return & LintReport {
133
133
TotalSourceWorkloads : 0 ,
134
134
TotalTargetWorkloads : 0 ,
135
135
TotalEscalation : 0 ,
@@ -160,131 +160,131 @@ func NewEscalationReport() *EscalationReport {
160
160
}
161
161
162
162
// privileged mode
163
- func (er * EscalationReport ) PrivilegedEscalated () bool {
163
+ func (er * LintReport ) PrivilegedEscalated () bool {
164
164
return er .NewPrivileged .IsEscalated ()
165
165
}
166
166
167
167
// privileged mode
168
- func (er * EscalationReport ) PrivilegedReduced () bool {
168
+ func (er * LintReport ) PrivilegedReduced () bool {
169
169
return er .RemovedPrivileged .IsReduced ()
170
170
}
171
171
172
172
// privileged mode
173
- func (er * EscalationReport ) PrivilegedNoChange () bool {
173
+ func (er * LintReport ) PrivilegedNoChange () bool {
174
174
return ! er .PrivilegedReduced () && ! er .PrivilegedReduced ()
175
175
}
176
176
177
177
// HostIPC
178
- func (er * EscalationReport ) HostIPCEscalated () bool {
178
+ func (er * LintReport ) HostIPCEscalated () bool {
179
179
return er .NewHostIPC .IsEscalated ()
180
180
}
181
181
182
182
// HostIPC
183
- func (er * EscalationReport ) HostIPCReduced () bool {
183
+ func (er * LintReport ) HostIPCReduced () bool {
184
184
return er .RemovedHostIPC .IsReduced ()
185
185
}
186
186
187
187
// HostIPC
188
- func (er * EscalationReport ) HostIPCNoChange () bool {
188
+ func (er * LintReport ) HostIPCNoChange () bool {
189
189
return ! er .HostIPCEscalated () && ! er .HostIPCReduced ()
190
190
}
191
191
192
192
// HostNetwork
193
- func (er * EscalationReport ) HostNetworkEscalated () bool {
193
+ func (er * LintReport ) HostNetworkEscalated () bool {
194
194
return er .NewHostNetwork .IsEscalated ()
195
195
}
196
196
197
197
// HostNetwork
198
- func (er * EscalationReport ) HostNetworkReduced () bool {
198
+ func (er * LintReport ) HostNetworkReduced () bool {
199
199
return er .RemovedHostNetwork .IsReduced ()
200
200
}
201
201
202
202
// HostNetwork
203
- func (er * EscalationReport ) HostNetworkNoChange () bool {
203
+ func (er * LintReport ) HostNetworkNoChange () bool {
204
204
return ! er .HostNetworkEscalated () && ! er .HostNetworkReduced ()
205
205
}
206
206
207
207
// HostPID
208
- func (er * EscalationReport ) HostPIDEscalated () bool {
208
+ func (er * LintReport ) HostPIDEscalated () bool {
209
209
return er .NewHostPID .IsEscalated ()
210
210
}
211
211
212
212
// HostPID
213
- func (er * EscalationReport ) HostPIDReduced () bool {
213
+ func (er * LintReport ) HostPIDReduced () bool {
214
214
return er .RemovedHostPID .IsReduced ()
215
215
}
216
216
217
217
// HostPID
218
- func (er * EscalationReport ) HostPIDNoChange () bool {
218
+ func (er * LintReport ) HostPIDNoChange () bool {
219
219
return ! er .HostPIDEscalated () && ! er .HostPIDReduced ()
220
220
}
221
221
222
222
// ReadOnlyRootFileSystem
223
- func (er * EscalationReport ) ReadOnlyRootFSEscalated () bool {
223
+ func (er * LintReport ) ReadOnlyRootFSEscalated () bool {
224
224
return er .RemovedReadOnlyRootFS .IsEscalated ()
225
225
}
226
226
227
227
// ReadOnlyRootFileSystem
228
- func (er * EscalationReport ) ReadOnlyRootFSReduced () bool {
228
+ func (er * LintReport ) ReadOnlyRootFSReduced () bool {
229
229
return er .NewReadOnlyRootFS .IsReduced ()
230
230
}
231
231
232
232
// ReadOnlyRootFileSystem
233
- func (er * EscalationReport ) ReadOnlyRootFSNoChange () bool {
233
+ func (er * LintReport ) ReadOnlyRootFSNoChange () bool {
234
234
return ! er .ReadOnlyRootFSEscalated () && ! er .ReadOnlyRootFSReduced ()
235
235
}
236
236
237
237
// runAsUser (non root -> root)
238
- func (er * EscalationReport ) RunUserAsRootEscalated () bool {
238
+ func (er * LintReport ) RunUserAsRootEscalated () bool {
239
239
return er .NewRunUserAsRoot .IsEscalated ()
240
240
}
241
241
242
242
// runAsUser (root -> non root)
243
- func (er * EscalationReport ) RunUserAsRootReduced () bool {
243
+ func (er * LintReport ) RunUserAsRootReduced () bool {
244
244
return er .RemovedRunUserAsRoot .IsReduced ()
245
245
}
246
246
247
247
// runAsUser
248
- func (er * EscalationReport ) RunUserAsRootNoChange () bool {
248
+ func (er * LintReport ) RunUserAsRootNoChange () bool {
249
249
return ! er .RunUserAsRootEscalated () && ! er .RunUserAsRootReduced ()
250
250
}
251
251
252
252
// runAsGroup (non root -> root)
253
- func (er * EscalationReport ) RunGroupAsRootEscalated () bool {
253
+ func (er * LintReport ) RunGroupAsRootEscalated () bool {
254
254
return er .NewRunGroupAsRoot .IsEscalated ()
255
255
}
256
256
257
257
// runAsGroup (root -> non root)
258
- func (er * EscalationReport ) RunGroupAsRootReduced () bool {
258
+ func (er * LintReport ) RunGroupAsRootReduced () bool {
259
259
return er .RemovedRunGroupAsRoot .IsReduced ()
260
260
}
261
261
262
262
// runAsGroup
263
- func (er * EscalationReport ) RunGroupAsRootNoChange () bool {
263
+ func (er * LintReport ) RunGroupAsRootNoChange () bool {
264
264
return er .NewRunGroupAsRoot .NoChanges ()
265
265
}
266
266
267
267
// newly added volume types
268
- func (er * EscalationReport ) AddedVolumes () bool {
268
+ func (er * LintReport ) AddedVolumes () bool {
269
269
return len (er .NewVolumeTypes ) > 0
270
270
}
271
271
272
272
// removed volume types
273
- func (er * EscalationReport ) RemovedVolumes () bool {
273
+ func (er * LintReport ) RemovedVolumes () bool {
274
274
return len (er .RemovedVolumeTypes ) > 0
275
275
}
276
276
277
277
// added capabilities
278
- func (er * EscalationReport ) AddedCapabilities () bool {
278
+ func (er * LintReport ) AddedCapabilities () bool {
279
279
return len (er .NewCapabilities ) > 0
280
280
}
281
281
282
282
// dropped capabilities
283
- func (er * EscalationReport ) DroppedCapabilities () bool {
283
+ func (er * LintReport ) DroppedCapabilities () bool {
284
284
return len (er .RemovedCapabilities ) > 0
285
285
}
286
286
287
- func (er * EscalationReport ) Escalated () bool {
287
+ func (er * LintReport ) Escalated () bool {
288
288
if er .PrivilegedEscalated () || er .HostNetworkEscalated () || er .HostPIDEscalated () || er .HostIPCEscalated () || er .AddedVolumes () ||
289
289
er .AddedCapabilities () || er .ReadOnlyRootFSEscalated () || er .RunGroupAsRootEscalated () || er .RunUserAsRootEscalated () {
290
290
return true
@@ -293,7 +293,7 @@ func (er *EscalationReport) Escalated() bool {
293
293
return false
294
294
}
295
295
296
- func (er * EscalationReport ) Reduced () bool {
296
+ func (er * LintReport ) Reduced () bool {
297
297
if er .PrivilegedReduced () || er .HostNetworkReduced () || er .HostPIDReduced () || er .HostIPCReduced () || er .RemovedVolumes () ||
298
298
er .DroppedCapabilities () || er .ReadOnlyRootFSReduced () || er .RunGroupAsRootReduced () || er .RunUserAsRootReduced () {
299
299
return true
@@ -303,7 +303,7 @@ func (er *EscalationReport) Reduced() bool {
303
303
}
304
304
305
305
// GenerateEscalationReportFromSecurityContext returns a escalation report after comparing the source and target YAML files
306
- func (er * EscalationReport ) GenerateEscalationReportFromSecurityContext (srcCssList , targetCssList []ContainerSecuritySpec , srcPssList , targetPssList []PodSecuritySpec ) {
306
+ func (er * LintReport ) GenerateEscalationReportFromSecurityContext (srcCssList , targetCssList []ContainerSecuritySpec , srcPssList , targetPssList []PodSecuritySpec ) {
307
307
srcCssMap := NewContainerSecuritySpecMap (srcCssList )
308
308
targetCssMap := NewContainerSecuritySpecMap (targetCssList )
309
309
0 commit comments