From e5cf6215c8149838928e4797a8a8203935281916 Mon Sep 17 00:00:00 2001 From: Jonathan Brill Date: Wed, 27 Nov 2024 12:45:45 -0500 Subject: [PATCH] update anser --- environment.go | 12 +++++------- go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/environment.go b/environment.go index 1c3ce35095e..3a0a7caf937 100644 --- a/environment.go +++ b/environment.go @@ -27,7 +27,6 @@ import ( "github.com/mongodb/jasper" "github.com/pkg/errors" "go.mongodb.org/mongo-driver/bson" - "go.mongodb.org/mongo-driver/bson/bsontype" "go.mongodb.org/mongo-driver/mongo" "go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws" "go.opentelemetry.io/otel" @@ -354,23 +353,22 @@ func getCollectionName(command bson.Raw) (string, error) { if err != nil { return "", errors.Wrap(err, "getting element value") } - if v.Type != bsontype.String { + if v.Type != bson.TypeString { return "", errors.Errorf("element value was of unexpected type '%s'", v.Type) } return v.StringValue(), nil } // redactSensitiveCollections satisfies the apm.CommandTransformer interface. -// Returns an empty string when the command is a CRUD command on a sensitive collection +// Returns nil when the command is a CRUD command on a sensitive collection // or if we can't determine the collection the command is on. -func redactSensitiveCollections(command bson.Raw) string { +func redactSensitiveCollections(command bson.Raw) bson.Raw { collectionName, err := getCollectionName(command) if err != nil || utility.StringSliceContains(sensitiveCollections, collectionName) { - return "" + return nil } - b, _ := bson.MarshalExtJSON(command, false, false) - return string(b) + return command } func (e *envState) initDB(ctx context.Context, settings DBSettings, tracer trace.Tracer) error { diff --git a/go.mod b/go.mod index 3df7a705260..804b903a15d 100644 --- a/go.mod +++ b/go.mod @@ -41,7 +41,7 @@ require ( github.com/mitchellh/go-homedir v1.1.0 github.com/mitchellh/mapstructure v1.5.0 github.com/mongodb/amboy v0.0.0-20240718152556-3b1827bc7168 - github.com/mongodb/anser v0.0.0-20241029200935-fcf3befed0ea + github.com/mongodb/anser v0.0.0-20241127170517-ea9e8f6f8a85 github.com/mongodb/grip v0.0.0-20240213223901-f906268d82b9 github.com/pkg/errors v0.9.1 github.com/ravilushqa/otelgqlgen v0.15.0 diff --git a/go.sum b/go.sum index 318c8782de9..90bf6bd1307 100644 --- a/go.sum +++ b/go.sum @@ -547,8 +547,8 @@ github.com/mongodb/amboy v0.0.0-20220408184825-b2a14e2c511d/go.mod h1:pyAwlkip3M github.com/mongodb/amboy v0.0.0-20240718152556-3b1827bc7168 h1:7zT/+PDqVGZnn4KgJcIVdj/GWhpFOE4mD7U9nhQl36Q= github.com/mongodb/amboy v0.0.0-20240718152556-3b1827bc7168/go.mod h1:XtYIRjheNi0/pf4NOV1qnyjdDncEpmUqAv4lRMIfBxo= github.com/mongodb/anser v0.0.0-20220408164649-99dd61768f4a/go.mod h1:iiM0FTD1XWGSxZPdM3NkCQeZEqatn9lGqwIZy3RwtgE= -github.com/mongodb/anser v0.0.0-20241029200935-fcf3befed0ea h1:OxW95sY2iU6oD0vnDAdLqEMiJQ8abVxsfvInd6n3i1Q= -github.com/mongodb/anser v0.0.0-20241029200935-fcf3befed0ea/go.mod h1:S55HFuPbd6Fq0e6c/cRbZZlbpvaiIQ7KiS/yZFT/p1c= +github.com/mongodb/anser v0.0.0-20241127170517-ea9e8f6f8a85 h1:U46FETSU/Kwj96271zWp8eoImozOy8yzKCu+tdnZaWE= +github.com/mongodb/anser v0.0.0-20241127170517-ea9e8f6f8a85/go.mod h1:StO4IeoZVYpcnJ2rIt9A/+ulq/o39jUxO2cSbfm8sfM= github.com/mongodb/ftdc v0.0.0-20211018154918-80dd1c22e4cf/go.mod h1:qd800FxWJIh4VUqu2d9Cmzdpv1CGXMqdwkntAKbaLlY= github.com/mongodb/ftdc v0.0.0-20220401165013-13e4af55e809 h1:CQVEigRr2M/OFIPn+wQWerSadMioMY1cLp22yZX+Ygk= github.com/mongodb/ftdc v0.0.0-20220401165013-13e4af55e809/go.mod h1:zz0HHFUU4/TOxl9TW4P9t3y3Ivx+sTWS2nwnhuYYRdw=