| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,10 +3,10 @@ package common | |||
| 3 | 3 | import ( | |
| 4 | 4 | "strings" | |
| 5 | 5 | ||
| 6 | - "github.com/gogo/protobuf/proto" | ||
| 7 | 6 | "github.com/stackrox/rox/central/compliance/framework" | |
| 8 | 7 | "github.com/stackrox/rox/generated/storage" | |
| 9 | 8 | "github.com/stackrox/rox/pkg/k8srbac" | |
| 9 | + "github.com/stackrox/rox/pkg/protocompat" | ||
| 10 | 10 | setPkg "github.com/stackrox/rox/pkg/set" | |
| 11 | 11 | ) | |
| 12 | 12 | ||
@@ -89,7 +89,7 @@ func CheckDeploymentsDoNotHaveClusterAccess(ctx framework.ComplianceContext, pr | |||
| 89 | 89 | framework.ForEachDeployment(ctx, func(ctx framework.ComplianceContext, deployment *storage.Deployment) { | |
| 90 | 90 | // Check deployment | |
| 91 | 91 | if !isKubeSystem(deployment) && clusterEvaluator.ForSubject(k8srbac.GetSubjectForDeployment(deployment)).Grants(pr) { | |
| 92 | - framework.Failf(ctx, "deployment has cluster access to %s, this should be scoped down where possible.", proto.MarshalTextString(pr)) | ||
| 92 | + framework.Failf(ctx, "deployment has cluster access to %s, this should be scoped down where possible.", protocompat.MarshalTextString(pr)) | ||
| 93 | 93 | } else { | |
| 94 | 94 | framework.Pass(ctx, "No deployments have been launched with cluster admin level access.") | |
| 95 | 95 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,10 +4,10 @@ import ( | |||
| 4 | 4 | "context" | |
| 5 | 5 | "strconv" | |
| 6 | 6 | ||
| 7 | - "github.com/gogo/protobuf/proto" | ||
| 8 | 7 | v1 "github.com/stackrox/rox/generated/api/v1" | |
| 9 | 8 | "github.com/stackrox/rox/generated/storage" | |
| 10 | 9 | "github.com/stackrox/rox/pkg/logging" | |
| 10 | + "github.com/stackrox/rox/pkg/protocompat" | ||
| 11 | 11 | "github.com/stackrox/rox/pkg/search" | |
| 12 | 12 | "github.com/stackrox/rox/pkg/search/scoped" | |
| 13 | 13 | ) | |
@@ -130,7 +130,7 @@ func getCVEEdgeQuery(q *v1.Query) { | |||
| 130 | 130 | search.NewQueryBuilder().AddBools(search.ClusterCVEFixable, val).ProtoQuery()) | |
| 131 | 131 | } | |
| 132 | 132 | default: | |
| 133 | - log.Errorf("Unhandled query type: %T; query was %s", q, proto.MarshalTextString(q)) | ||
| 133 | + log.Errorf("Unhandled query type: %T; query was %s", q, protocompat.MarshalTextString(q)) | ||
| 134 | 134 | } | |
| 135 | 135 | } | |
| 136 | 136 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,7 +7,6 @@ import ( | |||
| 7 | 7 | "testing" | |
| 8 | 8 | "time" | |
| 9 | 9 | ||
| 10 | - "github.com/gogo/protobuf/proto" | ||
| 11 | 10 | ptypes "github.com/gogo/protobuf/types" | |
| 12 | 11 | alertMocks "github.com/stackrox/rox/central/alert/datastore/mocks" | |
| 13 | 12 | "github.com/stackrox/rox/central/detection" | |
@@ -183,11 +182,11 @@ func (suite *AlertManagerTestSuite) TestNotifyAndUpdateBatch() { | |||
| 183 | 182 | ||
| 184 | 183 | suite.alertsMock.EXPECT().SearchRawAlerts(suite.ctx, | |
| 185 | 184 | testutils.PredMatcher("query for dep 1", func(q *v1.Query) bool { | |
| 186 | - return strings.Contains(proto.MarshalTextString(q), "Dep1") | ||
| 185 | + return strings.Contains(protocompat.MarshalTextString(q), "Dep1") | ||
| 187 | 186 | })).Return([]*storage.Alert{resolvedAlerts[0]}, nil) | |
| 188 | 187 | suite.alertsMock.EXPECT().SearchRawAlerts(suite.ctx, | |
| 189 | 188 | testutils.PredMatcher("query for dep 2", func(q *v1.Query) bool { | |
| 190 | - return strings.Contains(proto.MarshalTextString(q), "Dep2") | ||
| 189 | + return strings.Contains(protocompat.MarshalTextString(q), "Dep2") | ||
| 191 | 190 | })).Return([]*storage.Alert{resolvedAlerts[1]}, nil) | |
| 192 | 191 | ||
| 193 | 192 | // Only the first alert will get notified | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,11 +3,11 @@ package buildtime | |||
| 3 | 3 | import ( | |
| 4 | 4 | "testing" | |
| 5 | 5 | ||
| 6 | - "github.com/gogo/protobuf/proto" | ||
| 7 | 6 | "github.com/stackrox/rox/central/detection" | |
| 8 | 7 | "github.com/stackrox/rox/central/policy/datastore/mocks" | |
| 9 | 8 | "github.com/stackrox/rox/generated/storage" | |
| 10 | 9 | "github.com/stackrox/rox/pkg/defaults/policies" | |
| 10 | + "github.com/stackrox/rox/pkg/protocompat" | ||
| 11 | 11 | "github.com/stretchr/testify/assert" | |
| 12 | 12 | "github.com/stretchr/testify/require" | |
| 13 | 13 | "go.uber.org/mock/gomock" | |
@@ -68,7 +68,7 @@ func TestDetector(t *testing.T) { | |||
| 68 | 68 | expectedAlerts: 1, | |
| 69 | 69 | }, | |
| 70 | 70 | } { | |
| 71 | - t.Run(proto.MarshalTextString(testCase.image), func(t *testing.T) { | ||
| 71 | + t.Run(protocompat.MarshalTextString(testCase.image), func(t *testing.T) { | ||
| 72 | 72 | filter, getUnusedCategories := detection.MakeCategoryFilter(testCase.allowedCategories) | |
| 73 | 73 | alerts, err := detector.Detect(testCase.image, filter) | |
| 74 | 74 | require.NoError(t, err) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,7 +5,6 @@ import ( | |||
| 5 | 5 | "fmt" | |
| 6 | 6 | "time" | |
| 7 | 7 | ||
| 8 | - "github.com/gogo/protobuf/proto" | ||
| 9 | 8 | "github.com/pkg/errors" | |
| 10 | 9 | "github.com/stackrox/rox/central/activecomponent/updater/aggregator" | |
| 11 | 10 | deploymentDatastore "github.com/stackrox/rox/central/deployment/datastore" | |
@@ -311,7 +310,7 @@ func (m *managerImpl) checkAndUpdateBaseline(baselineKey processBaselineKey, ind | |||
| 311 | 310 | ||
| 312 | 311 | func (m *managerImpl) IndicatorAdded(indicator *storage.ProcessIndicator) error { | |
| 313 | 312 | if indicator.GetId() == "" { | |
| 314 | - return fmt.Errorf("invalid indicator received: %s, id was empty", proto.MarshalTextString(indicator)) | ||
| 313 | + return fmt.Errorf("invalid indicator received: %s, id was empty", protocompat.MarshalTextString(indicator)) | ||
| 315 | 314 | } | |
| 316 | 315 | ||
| 317 | 316 | // Evaluate filter before even adding to the queue | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,7 +3,6 @@ package datastore | |||
| 3 | 3 | import ( | |
| 4 | 4 | "context" | |
| 5 | 5 | ||
| 6 | - "github.com/gogo/protobuf/proto" | ||
| 7 | 6 | "github.com/hashicorp/go-multierror" | |
| 8 | 7 | "github.com/pkg/errors" | |
| 9 | 8 | groupFilter "github.com/stackrox/rox/central/group/datastore/filter" | |
@@ -14,6 +13,7 @@ import ( | |||
| 14 | 13 | "github.com/stackrox/rox/pkg/declarativeconfig" | |
| 15 | 14 | "github.com/stackrox/rox/pkg/errox" | |
| 16 | 15 | "github.com/stackrox/rox/pkg/postgres/pgutils" | |
| 16 | + "github.com/stackrox/rox/pkg/protocompat" | ||
| 17 | 17 | "github.com/stackrox/rox/pkg/sac" | |
| 18 | 18 | "github.com/stackrox/rox/pkg/sac/resources" | |
| 19 | 19 | "github.com/stackrox/rox/pkg/sync" | |
@@ -248,7 +248,7 @@ func (ds *dataStoreImpl) RemoveAllWithEmptyProperties(ctx context.Context) error | |||
| 248 | 248 | id := group.GetProps().GetId() | |
| 249 | 249 | if id == "" { | |
| 250 | 250 | removeGroupErrs = multierror.Append(removeGroupErrs, errox.InvalidArgs.Newf("group %s has no ID"+ | |
| 251 | - " set and cannot be deleted", proto.MarshalTextString(group))) | ||
| 251 | + " set and cannot be deleted", protocompat.MarshalTextString(group))) | ||
| 252 | 252 | continue | |
| 253 | 253 | } | |
| 254 | 254 | if err := ds.storage.Delete(ctx, id); err != nil { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,9 +1,9 @@ | |||
| 1 | 1 | package datastore | |
| 2 | 2 | ||
| 3 | 3 | import ( | |
| 4 | - "github.com/gogo/protobuf/proto" | ||
| 5 | 4 | "github.com/pkg/errors" | |
| 6 | 5 | "github.com/stackrox/rox/generated/storage" | |
| 6 | + "github.com/stackrox/rox/pkg/protocompat" | ||
| 7 | 7 | "github.com/stackrox/rox/pkg/uuid" | |
| 8 | 8 | ) | |
| 9 | 9 | ||
@@ -36,13 +36,13 @@ func ValidateGroup(group *storage.Group, requireID bool) error { | |||
| 36 | 36 | // - if no key is given, no value shall be given. | |
| 37 | 37 | func ValidateProps(props *storage.GroupProperties, requireID bool) error { | |
| 38 | 38 | if requireID && props.GetId() == "" { | |
| 39 | - return errors.Errorf("group ID must be set in {%s}", proto.MarshalTextString(props)) | ||
| 39 | + return errors.Errorf("group ID must be set in {%s}", protocompat.MarshalTextString(props)) | ||
| 40 | 40 | } | |
| 41 | 41 | if props.GetAuthProviderId() == "" { | |
| 42 | - return errors.Errorf("authprovider ID must be set in {%s}", proto.MarshalTextString(props)) | ||
| 42 | + return errors.Errorf("authprovider ID must be set in {%s}", protocompat.MarshalTextString(props)) | ||
| 43 | 43 | } | |
| 44 | 44 | if props.GetKey() == "" && props.GetValue() != "" { | |
| 45 | - return errors.Errorf("cannot have a value without a key in {%s}", proto.MarshalTextString(props)) | ||
| 45 | + return errors.Errorf("cannot have a value without a key in {%s}", protocompat.MarshalTextString(props)) | ||
| 46 | 46 | } | |
| 47 | 47 | if props.GetKey() == "" && props.GetValue() == "" && | |
| 48 | 48 | props.GetTraits().GetMutabilityMode() == storage.Traits_ALLOW_MUTATE_FORCED { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,6 +15,7 @@ import ( | |||
| 15 | 15 | "github.com/stackrox/rox/pkg/grpc/authz" | |
| 16 | 16 | "github.com/stackrox/rox/pkg/grpc/authz/perrpc" | |
| 17 | 17 | "github.com/stackrox/rox/pkg/grpc/authz/user" | |
| 18 | + "github.com/stackrox/rox/pkg/protocompat" | ||
| 18 | 19 | "github.com/stackrox/rox/pkg/sac/resources" | |
| 19 | 20 | "google.golang.org/grpc" | |
| 20 | 21 | ) | |
@@ -100,7 +101,7 @@ func (s *serviceImpl) GetGroup(ctx context.Context, props *storage.GroupProperti | |||
| 100 | 101 | return nil, err | |
| 101 | 102 | } | |
| 102 | 103 | if group == nil { | |
| 103 | - return nil, errors.Wrapf(errox.NotFound, "group %q not found", proto.MarshalTextString(props)) | ||
| 104 | + return nil, errors.Wrapf(errox.NotFound, "group %q not found", protocompat.MarshalTextString(props)) | ||
| 104 | 105 | } | |
| 105 | 106 | return group, nil | |
| 106 | 107 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,7 +6,6 @@ import ( | |||
| 6 | 6 | "sort" | |
| 7 | 7 | "testing" | |
| 8 | 8 | ||
| 9 | - "github.com/gogo/protobuf/proto" | ||
| 10 | 9 | dDSMocks "github.com/stackrox/rox/central/deployment/datastore/mocks" | |
| 11 | 10 | nsDSMocks "github.com/stackrox/rox/central/namespace/datastore/mocks" | |
| 12 | 11 | networkBaselineMocks "github.com/stackrox/rox/central/networkbaseline/datastore/mocks" | |
@@ -202,15 +201,15 @@ func sortPolicies(policies []*storage.NetworkPolicy) { | |||
| 202 | 201 | for _, policy := range policies { | |
| 203 | 202 | for _, ingressRule := range policy.Spec.Ingress { | |
| 204 | 203 | sort.Slice(ingressRule.From, func(i, j int) bool { | |
| 205 | - return proto.MarshalTextString(ingressRule.From[i]) < proto.MarshalTextString(ingressRule.From[j]) | ||
| 204 | + return protocompat.MarshalTextString(ingressRule.From[i]) < protocompat.MarshalTextString(ingressRule.From[j]) | ||
| 206 | 205 | }) | |
| 207 | 206 | } | |
| 208 | 207 | sort.Slice(policy.Spec.Ingress, func(i, j int) bool { | |
| 209 | - return proto.MarshalTextString(policy.Spec.Ingress[i]) < proto.MarshalTextString(policy.Spec.Ingress[j]) | ||
| 208 | + return protocompat.MarshalTextString(policy.Spec.Ingress[i]) < protocompat.MarshalTextString(policy.Spec.Ingress[j]) | ||
| 210 | 209 | }) | |
| 211 | 210 | } | |
| 212 | 211 | sort.Slice(policies, func(i, j int) bool { | |
| 213 | - return proto.MarshalTextString(policies[i]) < proto.MarshalTextString(policies[j]) | ||
| 212 | + return protocompat.MarshalTextString(policies[i]) < protocompat.MarshalTextString(policies[j]) | ||
| 214 | 213 | }) | |
| 215 | 214 | } | |
| 216 | 215 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,7 +3,6 @@ package mapper | |||
| 3 | 3 | import ( | |
| 4 | 4 | "context" | |
| 5 | 5 | ||
| 6 | - "github.com/gogo/protobuf/proto" | ||
| 7 | 6 | "github.com/pkg/errors" | |
| 8 | 7 | groupDataStore "github.com/stackrox/rox/central/group/datastore" | |
| 9 | 8 | roleDataStore "github.com/stackrox/rox/central/role/datastore" | |
@@ -12,6 +11,7 @@ import ( | |||
| 12 | 11 | "github.com/stackrox/rox/pkg/auth/permissions" | |
| 13 | 12 | "github.com/stackrox/rox/pkg/grpc/authn" | |
| 14 | 13 | "github.com/stackrox/rox/pkg/logging" | |
| 14 | + "github.com/stackrox/rox/pkg/protocompat" | ||
| 15 | 15 | "github.com/stackrox/rox/pkg/set" | |
| 16 | 16 | ) | |
| 17 | 17 | ||
@@ -44,7 +44,7 @@ func (rm *storeBasedMapperImpl) recordUser(ctx context.Context, descriptor *perm | |||
| 44 | 44 | ||
| 45 | 45 | if err := rm.users.Upsert(ctx, user); err != nil { | |
| 46 | 46 | // Just log since we don't actually need the user information. | |
| 47 | - log.Errorf("unable to log user: %s: %v", proto.MarshalTextString(user), err) | ||
| 47 | + log.Errorf("unable to log user: %s: %v", protocompat.MarshalTextString(user), err) | ||
| 48 | 48 | } | |
| 49 | 49 | } | |
| 50 | 50 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments