Skip to content

Commit ff3fc18

Browse files
committed
Set allowPrivilegeEscalation to false as a default
This commit fixes openfaas#523 and sets a default, which nobody has raised any concerns with. If this affects you in a negative way then please feel free to raise an issue for discussion. Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
1 parent 1994b52 commit ff3fc18

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

pkg/controller/deployment.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ func newDeployment(
5656
}
5757
}
5858

59+
allowPrivilegeEscalation := false
60+
5961
deploymentSpec := &appsv1.Deployment{
6062
ObjectMeta: metav1.ObjectMeta{
6163
Name: function.Spec.Name,
@@ -110,6 +112,9 @@ func newDeployment(
110112
Resources: *resources,
111113
LivenessProbe: probes.Liveness,
112114
ReadinessProbe: probes.Readiness,
115+
SecurityContext: &corev1.SecurityContext{
116+
AllowPrivilegeEscalation: &allowPrivilegeEscalation,
117+
},
113118
},
114119
},
115120
},

pkg/handlers/deploy.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ func makeDeploymentSpec(request types.FunctionDeployment, existingSecrets map[st
173173
}
174174

175175
enableServiceLinks := false
176+
allowPrivilegeEscalation := false
176177

177178
deploymentSpec := &appsv1.Deployment{
178179
ObjectMeta: metav1.ObjectMeta{
@@ -228,7 +229,8 @@ func makeDeploymentSpec(request types.FunctionDeployment, existingSecrets map[st
228229
LivenessProbe: probes.Liveness,
229230
ReadinessProbe: probes.Readiness,
230231
SecurityContext: &corev1.SecurityContext{
231-
ReadOnlyRootFilesystem: &request.ReadOnlyRootFilesystem,
232+
ReadOnlyRootFilesystem: &request.ReadOnlyRootFilesystem,
233+
AllowPrivilegeEscalation: &allowPrivilegeEscalation,
232234
},
233235
},
234236
},

0 commit comments

Comments
 (0)