Skip to content

Commit bebed17

Browse files
committed
rename escaltion.go to lintreport.go
Signed-off-by: kaizhe <derek0405@gmail.com>
1 parent a17acbc commit bebed17

File tree

3 files changed

+32
-32
lines changed

3 files changed

+32
-32
lines changed

advisor/types/escalation.go renamed to advisor/types/lintreport.go

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const (
2323
nonRoot = "non-root"
2424
)
2525

26-
type EscalationReport struct {
26+
type LintReport struct {
2727
TotalSourceWorkloads int `json:"total_source_workloads"`
2828
TotalTargetWorkloads int `json:"total_target_workloads"`
2929
TotalSourceImages int `json:"total_source_images"`
@@ -128,8 +128,8 @@ func (e *Escalation) IsReduced() bool {
128128
}
129129

130130
// NewEscalationReport returns an escalation report object
131-
func NewEscalationReport() *EscalationReport {
132-
return &EscalationReport{
131+
func NewEscalationReport() *LintReport {
132+
return &LintReport{
133133
TotalSourceWorkloads: 0,
134134
TotalTargetWorkloads: 0,
135135
TotalEscalation: 0,
@@ -160,131 +160,131 @@ func NewEscalationReport() *EscalationReport {
160160
}
161161

162162
// privileged mode
163-
func (er *EscalationReport) PrivilegedEscalated() bool {
163+
func (er *LintReport) PrivilegedEscalated() bool {
164164
return er.NewPrivileged.IsEscalated()
165165
}
166166

167167
// privileged mode
168-
func (er *EscalationReport) PrivilegedReduced() bool {
168+
func (er *LintReport) PrivilegedReduced() bool {
169169
return er.RemovedPrivileged.IsReduced()
170170
}
171171

172172
// privileged mode
173-
func (er *EscalationReport) PrivilegedNoChange() bool {
173+
func (er *LintReport) PrivilegedNoChange() bool {
174174
return !er.PrivilegedReduced() && !er.PrivilegedReduced()
175175
}
176176

177177
// HostIPC
178-
func (er *EscalationReport) HostIPCEscalated() bool {
178+
func (er *LintReport) HostIPCEscalated() bool {
179179
return er.NewHostIPC.IsEscalated()
180180
}
181181

182182
// HostIPC
183-
func (er *EscalationReport) HostIPCReduced() bool {
183+
func (er *LintReport) HostIPCReduced() bool {
184184
return er.RemovedHostIPC.IsReduced()
185185
}
186186

187187
// HostIPC
188-
func (er *EscalationReport) HostIPCNoChange() bool {
188+
func (er *LintReport) HostIPCNoChange() bool {
189189
return !er.HostIPCEscalated() && !er.HostIPCReduced()
190190
}
191191

192192
// HostNetwork
193-
func (er *EscalationReport) HostNetworkEscalated() bool {
193+
func (er *LintReport) HostNetworkEscalated() bool {
194194
return er.NewHostNetwork.IsEscalated()
195195
}
196196

197197
// HostNetwork
198-
func (er *EscalationReport) HostNetworkReduced() bool {
198+
func (er *LintReport) HostNetworkReduced() bool {
199199
return er.RemovedHostNetwork.IsReduced()
200200
}
201201

202202
// HostNetwork
203-
func (er *EscalationReport) HostNetworkNoChange() bool {
203+
func (er *LintReport) HostNetworkNoChange() bool {
204204
return !er.HostNetworkEscalated() && !er.HostNetworkReduced()
205205
}
206206

207207
// HostPID
208-
func (er *EscalationReport) HostPIDEscalated() bool {
208+
func (er *LintReport) HostPIDEscalated() bool {
209209
return er.NewHostPID.IsEscalated()
210210
}
211211

212212
// HostPID
213-
func (er *EscalationReport) HostPIDReduced() bool {
213+
func (er *LintReport) HostPIDReduced() bool {
214214
return er.RemovedHostPID.IsReduced()
215215
}
216216

217217
// HostPID
218-
func (er *EscalationReport) HostPIDNoChange() bool {
218+
func (er *LintReport) HostPIDNoChange() bool {
219219
return !er.HostPIDEscalated() && !er.HostPIDReduced()
220220
}
221221

222222
// ReadOnlyRootFileSystem
223-
func (er *EscalationReport) ReadOnlyRootFSEscalated() bool {
223+
func (er *LintReport) ReadOnlyRootFSEscalated() bool {
224224
return er.RemovedReadOnlyRootFS.IsEscalated()
225225
}
226226

227227
// ReadOnlyRootFileSystem
228-
func (er *EscalationReport) ReadOnlyRootFSReduced() bool {
228+
func (er *LintReport) ReadOnlyRootFSReduced() bool {
229229
return er.NewReadOnlyRootFS.IsReduced()
230230
}
231231

232232
// ReadOnlyRootFileSystem
233-
func (er *EscalationReport) ReadOnlyRootFSNoChange() bool {
233+
func (er *LintReport) ReadOnlyRootFSNoChange() bool {
234234
return !er.ReadOnlyRootFSEscalated() && !er.ReadOnlyRootFSReduced()
235235
}
236236

237237
// runAsUser (non root -> root)
238-
func (er *EscalationReport) RunUserAsRootEscalated() bool {
238+
func (er *LintReport) RunUserAsRootEscalated() bool {
239239
return er.NewRunUserAsRoot.IsEscalated()
240240
}
241241

242242
// runAsUser (root -> non root)
243-
func (er *EscalationReport) RunUserAsRootReduced() bool {
243+
func (er *LintReport) RunUserAsRootReduced() bool {
244244
return er.RemovedRunUserAsRoot.IsReduced()
245245
}
246246

247247
// runAsUser
248-
func (er *EscalationReport) RunUserAsRootNoChange() bool {
248+
func (er *LintReport) RunUserAsRootNoChange() bool {
249249
return !er.RunUserAsRootEscalated() && !er.RunUserAsRootReduced()
250250
}
251251

252252
// runAsGroup (non root -> root)
253-
func (er *EscalationReport) RunGroupAsRootEscalated() bool {
253+
func (er *LintReport) RunGroupAsRootEscalated() bool {
254254
return er.NewRunGroupAsRoot.IsEscalated()
255255
}
256256

257257
// runAsGroup (root -> non root)
258-
func (er *EscalationReport) RunGroupAsRootReduced() bool {
258+
func (er *LintReport) RunGroupAsRootReduced() bool {
259259
return er.RemovedRunGroupAsRoot.IsReduced()
260260
}
261261

262262
// runAsGroup
263-
func (er *EscalationReport) RunGroupAsRootNoChange() bool {
263+
func (er *LintReport) RunGroupAsRootNoChange() bool {
264264
return er.NewRunGroupAsRoot.NoChanges()
265265
}
266266

267267
// newly added volume types
268-
func (er *EscalationReport) AddedVolumes() bool {
268+
func (er *LintReport) AddedVolumes() bool {
269269
return len(er.NewVolumeTypes) > 0
270270
}
271271

272272
// removed volume types
273-
func (er *EscalationReport) RemovedVolumes() bool {
273+
func (er *LintReport) RemovedVolumes() bool {
274274
return len(er.RemovedVolumeTypes) > 0
275275
}
276276

277277
// added capabilities
278-
func (er *EscalationReport) AddedCapabilities() bool {
278+
func (er *LintReport) AddedCapabilities() bool {
279279
return len(er.NewCapabilities) > 0
280280
}
281281

282282
// dropped capabilities
283-
func (er *EscalationReport) DroppedCapabilities() bool {
283+
func (er *LintReport) DroppedCapabilities() bool {
284284
return len(er.RemovedCapabilities) > 0
285285
}
286286

287-
func (er *EscalationReport) Escalated() bool {
287+
func (er *LintReport) Escalated() bool {
288288
if er.PrivilegedEscalated() || er.HostNetworkEscalated() || er.HostPIDEscalated() || er.HostIPCEscalated() || er.AddedVolumes() ||
289289
er.AddedCapabilities() || er.ReadOnlyRootFSEscalated() || er.RunGroupAsRootEscalated() || er.RunUserAsRootEscalated() {
290290
return true
@@ -293,7 +293,7 @@ func (er *EscalationReport) Escalated() bool {
293293
return false
294294
}
295295

296-
func (er *EscalationReport) Reduced() bool {
296+
func (er *LintReport) Reduced() bool {
297297
if er.PrivilegedReduced() || er.HostNetworkReduced() || er.HostPIDReduced() || er.HostIPCReduced() || er.RemovedVolumes() ||
298298
er.DroppedCapabilities() || er.ReadOnlyRootFSReduced() || er.RunGroupAsRootReduced() || er.RunUserAsRootReduced() {
299299
return true
@@ -303,7 +303,7 @@ func (er *EscalationReport) Reduced() bool {
303303
}
304304

305305
// 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) {
307307
srcCssMap := NewContainerSecuritySpecMap(srcCssList)
308308
targetCssMap := NewContainerSecuritySpecMap(targetCssList)
309309

File renamed without changes.

comparator/comparator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const (
1515
)
1616

1717
type Comparator struct {
18-
escalationReport *types.EscalationReport
18+
escalationReport *types.LintReport
1919
gen *generator.Generator
2020
srcCssList []types.ContainerSecuritySpec
2121
srcPssList []types.PodSecuritySpec

0 commit comments

Comments
 (0)