Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NET-704 CVEs (backport to 1.1.x) #2226

Merged
merged 2 commits into from
May 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/2226.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:security
Bump `controller-runtime` to address CVEs in dependencies.
```
4 changes: 2 additions & 2 deletions control-plane/api/common/configentry_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"errors"
"testing"

logrtest "github.com/go-logr/logr/testing"
logrtest "github.com/go-logr/logr/testr"
capi "github.com/hashicorp/consul/api"
"github.com/stretchr/testify/require"
"gomodules.xyz/jsonpatch/v2"
Expand Down Expand Up @@ -112,7 +112,7 @@ func TestValidateConfigEntry(t *testing.T) {
},
},
},
logrtest.TestLogger{T: t},
logrtest.New(t),
lister,
c.newResource,
ConsulMeta{
Expand Down
4 changes: 2 additions & 2 deletions control-plane/api/v1alpha1/exportedservices_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"encoding/json"
"testing"

logrtest "github.com/go-logr/logr/testing"
logrtest "github.com/go-logr/logr/testr"
"github.com/hashicorp/consul-k8s/control-plane/api/common"
"github.com/stretchr/testify/require"
admissionv1 "k8s.io/api/admission/v1"
Expand Down Expand Up @@ -177,7 +177,7 @@ func TestValidateExportedServices(t *testing.T) {

validator := &ExportedServicesWebhook{
Client: client,
Logger: logrtest.TestLogger{T: t},
Logger: logrtest.New(t),
decoder: decoder,
ConsulMeta: c.consulMeta,
}
Expand Down
4 changes: 2 additions & 2 deletions control-plane/api/v1alpha1/mesh_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"encoding/json"
"testing"

logrtest "github.com/go-logr/logr/testing"
logrtest "github.com/go-logr/logr/testr"
"github.com/hashicorp/consul-k8s/control-plane/api/common"
"github.com/stretchr/testify/require"
admissionv1 "k8s.io/api/admission/v1"
Expand Down Expand Up @@ -94,7 +94,7 @@ func TestValidateMesh(t *testing.T) {

validator := &MeshWebhook{
Client: client,
Logger: logrtest.TestLogger{T: t},
Logger: logrtest.New(t),
decoder: decoder,
}
response := validator.Handle(ctx, admission.Request{
Expand Down
4 changes: 2 additions & 2 deletions control-plane/api/v1alpha1/peeringacceptor_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"encoding/json"
"testing"

logrtest "github.com/go-logr/logr/testing"
logrtest "github.com/go-logr/logr/testr"
"github.com/stretchr/testify/require"
admissionv1 "k8s.io/api/admission/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -135,7 +135,7 @@ func TestValidatePeeringAcceptor(t *testing.T) {

validator := &PeeringAcceptorWebhook{
Client: client,
Logger: logrtest.TestLogger{T: t},
Logger: logrtest.New(t),
decoder: decoder,
}
response := validator.Handle(ctx, admission.Request{
Expand Down
4 changes: 2 additions & 2 deletions control-plane/api/v1alpha1/peeringdialer_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"encoding/json"
"testing"

logrtest "github.com/go-logr/logr/testing"
logrtest "github.com/go-logr/logr/testr"
"github.com/stretchr/testify/require"
admissionv1 "k8s.io/api/admission/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -135,7 +135,7 @@ func TestValidatePeeringDialer(t *testing.T) {

validator := &PeeringDialerWebhook{
Client: client,
Logger: logrtest.TestLogger{T: t},
Logger: logrtest.New(t),
decoder: decoder,
}
response := validator.Handle(ctx, admission.Request{
Expand Down
4 changes: 2 additions & 2 deletions control-plane/api/v1alpha1/proxydefaults_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"encoding/json"
"testing"

logrtest "github.com/go-logr/logr/testing"
logrtest "github.com/go-logr/logr/testr"
"github.com/hashicorp/consul-k8s/control-plane/api/common"
"github.com/stretchr/testify/require"
admissionv1 "k8s.io/api/admission/v1"
Expand Down Expand Up @@ -119,7 +119,7 @@ func TestValidateProxyDefault(t *testing.T) {

validator := &ProxyDefaultsWebhook{
Client: client,
Logger: logrtest.TestLogger{T: t},
Logger: logrtest.New(t),
decoder: decoder,
}
response := validator.Handle(ctx, admission.Request{
Expand Down
8 changes: 4 additions & 4 deletions control-plane/api/v1alpha1/serviceintentions_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"fmt"
"testing"

logrtest "github.com/go-logr/logr/testing"
logrtest "github.com/go-logr/logr/testr"
"github.com/hashicorp/consul-k8s/control-plane/api/common"
"github.com/stretchr/testify/require"
"gomodules.xyz/jsonpatch/v2"
Expand Down Expand Up @@ -250,7 +250,7 @@ func TestHandle_ServiceIntentions_Create(t *testing.T) {

validator := &ServiceIntentionsWebhook{
Client: client,
Logger: logrtest.TestLogger{T: t},
Logger: logrtest.New(t),
decoder: decoder,
ConsulMeta: common.ConsulMeta{
NamespacesEnabled: true,
Expand Down Expand Up @@ -439,7 +439,7 @@ func TestHandle_ServiceIntentions_Update(t *testing.T) {

validator := &ServiceIntentionsWebhook{
Client: client,
Logger: logrtest.TestLogger{T: t},
Logger: logrtest.New(t),
decoder: decoder,
ConsulMeta: common.ConsulMeta{
NamespacesEnabled: true,
Expand Down Expand Up @@ -599,7 +599,7 @@ func TestHandle_ServiceIntentions_Patches(t *testing.T) {

validator := &ServiceIntentionsWebhook{
Client: client,
Logger: logrtest.TestLogger{T: t},
Logger: logrtest.New(t),
decoder: decoder,
ConsulMeta: common.ConsulMeta{
NamespacesEnabled: namespacesEnabled,
Expand Down
8 changes: 4 additions & 4 deletions control-plane/catalog/to-consul/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1662,8 +1662,8 @@ func TestServiceResource_addIngress(t *testing.T) {
},
},
Status: networkingv1.IngressStatus{
LoadBalancer: corev1.LoadBalancerStatus{
Ingress: []corev1.LoadBalancerIngress{{IP: "1.2.3.4"}},
LoadBalancer: networkingv1.IngressLoadBalancerStatus{
Ingress: []networkingv1.IngressLoadBalancerIngress{{IP: "1.2.3.4"}},
},
},
},
Expand Down Expand Up @@ -1709,8 +1709,8 @@ func TestServiceResource_addIngress(t *testing.T) {
},
},
Status: networkingv1.IngressStatus{
LoadBalancer: corev1.LoadBalancerStatus{
Ingress: []corev1.LoadBalancerIngress{{IP: "1.2.3.4"}},
LoadBalancer: networkingv1.IngressLoadBalancerStatus{
Ingress: []networkingv1.IngressLoadBalancerIngress{{IP: "1.2.3.4"}},
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package endpoints
import (
"testing"

logrtest "github.com/go-logr/logr/testing"
logrtest "github.com/go-logr/logr/testr"
"github.com/hashicorp/consul-k8s/control-plane/connect-inject/constants"
"github.com/hashicorp/consul-k8s/control-plane/helper/test"
"github.com/hashicorp/consul-server-connection-manager/discovery"
Expand Down Expand Up @@ -238,7 +238,7 @@ func TestUpdateHealthCheckOnConsulClient(t *testing.T) {

ctrl := Controller{
ConsulClientConfig: testClient.Cfg,
Log: logrtest.TestLogger{T: t},
Log: logrtest.New(t),
}

err := ctrl.updateHealthCheckOnConsulClient(testClient.Cfg.APIClientConfig, pod, endpoints, c.updateToStatus)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"testing"

mapset "github.com/deckarep/golang-set"
logrtest "github.com/go-logr/logr/testing"
logrtest "github.com/go-logr/logr/testr"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/hashicorp/consul-k8s/control-plane/connect-inject/constants"
Expand Down Expand Up @@ -226,7 +226,7 @@ func TestReconcileCreateEndpointWithNamespaces(t *testing.T) {
// Create the endpoints controller.
ep := &Controller{
Client: fakeClient,
Log: logrtest.TestLogger{T: t},
Log: logrtest.New(t),
ConsulClientConfig: testClient.Cfg,
ConsulServerConnMgr: testClient.Watcher,
AllowK8sNamespacesSet: mapset.NewSetWith("*"),
Expand Down Expand Up @@ -487,7 +487,7 @@ func TestReconcileCreateGatewayWithNamespaces(t *testing.T) {
// Create the endpoints controller.
ep := &Controller{
Client: fakeClient,
Log: logrtest.TestLogger{T: t},
Log: logrtest.New(t),
ConsulClientConfig: testClient.Cfg,
ConsulServerConnMgr: testClient.Watcher,
AllowK8sNamespacesSet: mapset.NewSetWith("*"),
Expand Down Expand Up @@ -1494,7 +1494,7 @@ func TestReconcileUpdateEndpointWithNamespaces(t *testing.T) {
// Create the endpoints controller.
ep := &Controller{
Client: fakeClient,
Log: logrtest.TestLogger{T: t},
Log: logrtest.New(t),
ConsulClientConfig: testClient.Cfg,
ConsulServerConnMgr: testClient.Watcher,
AllowK8sNamespacesSet: mapset.NewSetWith("*"),
Expand Down Expand Up @@ -1780,7 +1780,7 @@ func TestReconcileDeleteEndpointWithNamespaces(t *testing.T) {
// Create the endpoints controller.
ep := &Controller{
Client: fakeClient,
Log: logrtest.TestLogger{T: t},
Log: logrtest.New(t),
ConsulClientConfig: testClient.Cfg,
ConsulServerConnMgr: testClient.Watcher,
AllowK8sNamespacesSet: mapset.NewSetWith("*"),
Expand Down Expand Up @@ -2074,7 +2074,7 @@ func TestReconcileDeleteGatewayWithNamespaces(t *testing.T) {
// Create the endpoints controller.
ep := &Controller{
Client: fakeClient,
Log: logrtest.TestLogger{T: t},
Log: logrtest.New(t),
ConsulClientConfig: testClient.Cfg,
ConsulServerConnMgr: testClient.Watcher,
AllowK8sNamespacesSet: mapset.NewSetWith("*"),
Expand Down
Loading