Skip to content
This repository was archived by the owner on Oct 14, 2020. It is now read-only.

Commit 1c597ed

Browse files
committed
Add securityContext to lurcher
1 parent b45cf43 commit 1c597ed

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

lurcher/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,5 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o lurcher
2020
FROM gcr.io/distroless/static:nonroot
2121
WORKDIR /
2222
COPY --from=builder /workspace/lurcher .
23-
USER nonroot:nonroot
2423

2524
ENTRYPOINT ["/lurcher"]

operator/controllers/execution/scans/scan_reconciler.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,9 @@ func (r *ScanReconciler) constructJobForScan(scan *executionv1.Scan, scanType *e
221221
return nil, fmt.Errorf("Unknown imagePull Policy for lurcher: %s", lurcherPullPolicyRaw)
222222
}
223223

224+
falsePointer := false
225+
truePointer := true
226+
224227
lurcherSidecar := &corev1.Container{
225228
Name: "lurcher",
226229
Image: lurcherImage,
@@ -260,6 +263,15 @@ func (r *ScanReconciler) constructJobForScan(scan *executionv1.Scan, scanType *e
260263
ReadOnly: true,
261264
},
262265
},
266+
SecurityContext: &corev1.SecurityContext{
267+
RunAsNonRoot: &truePointer,
268+
AllowPrivilegeEscalation: &falsePointer,
269+
ReadOnlyRootFilesystem: &truePointer,
270+
Privileged: &falsePointer,
271+
Capabilities: &corev1.Capabilities{
272+
Drop: []corev1.Capability{"all"},
273+
},
274+
},
263275
}
264276

265277
job.Spec.Template.Spec.Containers = append(job.Spec.Template.Spec.Containers, *lurcherSidecar)

0 commit comments

Comments
 (0)