diff --git a/pkg/reconciler/apiserversource/resources/receive_adapter.go b/pkg/reconciler/apiserversource/resources/receive_adapter.go index aa1b1fdf2cb..83c784317ac 100644 --- a/pkg/reconciler/apiserversource/resources/receive_adapter.go +++ b/pkg/reconciler/apiserversource/resources/receive_adapter.go @@ -103,6 +103,13 @@ func MakeReceiveAdapter(args *ReceiveAdapterArgs) (*appsv1.Deployment, error) { }, }, }, + SecurityContext: &corev1.SecurityContext{ + AllowPrivilegeEscalation: ptr.Bool(false), + ReadOnlyRootFilesystem: ptr.Bool(true), + RunAsNonRoot: ptr.Bool(true), + Capabilities: &corev1.Capabilities{Drop: []corev1.Capability{"ALL"}}, + SeccompProfile: &corev1.SeccompProfile{Type: corev1.SeccompProfileTypeRuntimeDefault}, + }, }, }, }, diff --git a/pkg/reconciler/apiserversource/resources/receive_adapter_test.go b/pkg/reconciler/apiserversource/resources/receive_adapter_test.go index b2a095c84f7..777ec57699b 100644 --- a/pkg/reconciler/apiserversource/resources/receive_adapter_test.go +++ b/pkg/reconciler/apiserversource/resources/receive_adapter_test.go @@ -164,6 +164,13 @@ func TestMakeReceiveAdapters(t *testing.T) { }, }, }, + SecurityContext: &corev1.SecurityContext{ + AllowPrivilegeEscalation: ptr.Bool(false), + ReadOnlyRootFilesystem: ptr.Bool(true), + RunAsNonRoot: ptr.Bool(true), + Capabilities: &corev1.Capabilities{Drop: []corev1.Capability{"ALL"}}, + SeccompProfile: &corev1.SeccompProfile{Type: corev1.SeccompProfileTypeRuntimeDefault}, + }, }, }, },