Skip to content

Commit

Permalink
Merge pull request #739 from newrelic/develop
Browse files Browse the repository at this point in the history
Release 3.23.0
  • Loading branch information
nr-swilloughby authored Jun 20, 2023
2 parents 66bd1f8 + d850ce9 commit 45ed3ee
Show file tree
Hide file tree
Showing 68 changed files with 815 additions and 372 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
## 3.23.0
### Added
* Adds the `nrsecurityagent` integration for performing Interactive Application Security Testing (IAST) of your application.
* This action increments the version numbers of the following integrations:
* `nrgin` v1.2.0
* `nrgrpc` v1.4.0
* `nrmicro` v1.2.0
* `nrmongo` v1.2.0
* `nrsqlite3` v1.2.0

To learn how to use IAST with the New Relic Go Agent, [check out our documentation](https://docs.newrelic.com/docs/iast/use-iast/).

### Support statement

We use the latest version of the Go language. At minimum, you should be using no version of Go older than what is supported by the Go team themselves (i.e., Go versions 1.19 and later are supported).

See the [Go agent EOL Policy](https://docs.newrelic.com/docs/apm/agents/go-agent/get-started/go-agent-eol-policy/) for details about supported versions of the Go agent and third-party components.


## 3.22.1
* Corrects an error in the release process for 3.22.0.

Expand Down
11 changes: 0 additions & 11 deletions v3/go.mod
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
module github.com/newrelic/go-agent/v3

go 1.18

require (
github.com/golang/protobuf v1.5.3
google.golang.org/grpc v1.54.0
)

require (
golang.org/x/net v0.8.0 // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/text v0.8.0 // indirect
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
google.golang.org/protobuf v1.28.1 // indirect
)

retract v3.22.0 // release process error corrected in v3.22.1
2 changes: 0 additions & 2 deletions v3/integrations/logcontext-v2/logWriter/go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
module github.com/newrelic/go-agent/v3/integrations/logcontext-v2/logWriter

go 1.17

require (
github.com/newrelic/go-agent/v3 v3.19.1
github.com/newrelic/go-agent/v3/integrations/logcontext-v2/nrwriter v1.0.0
Expand Down
2 changes: 0 additions & 2 deletions v3/integrations/logcontext-v2/nrlogrus/go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
module github.com/newrelic/go-agent/v3/integrations/logcontext-v2/nrlogrus

go 1.17

require (
github.com/newrelic/go-agent/v3 v3.18.0
github.com/sirupsen/logrus v1.8.1
Expand Down
2 changes: 0 additions & 2 deletions v3/integrations/logcontext-v2/nrwriter/go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
module github.com/newrelic/go-agent/v3/integrations/logcontext-v2/nrwriter

go 1.17

require github.com/newrelic/go-agent/v3 v3.19.1
2 changes: 0 additions & 2 deletions v3/integrations/logcontext-v2/nrzap/go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
module github.com/newrelic/go-agent/v3/integrations/logcontext-v2/nrzap

go 1.18

require (
github.com/newrelic/go-agent/v3 v3.21.1
go.uber.org/zap v1.24.0
Expand Down
2 changes: 0 additions & 2 deletions v3/integrations/logcontext-v2/nrzerolog/go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
module github.com/newrelic/go-agent/v3/integrations/logcontext-v2/nrzerolog

go 1.17

require (
github.com/newrelic/go-agent/v3 v3.18.0
github.com/rs/zerolog v1.26.1
Expand Down
2 changes: 0 additions & 2 deletions v3/integrations/logcontext-v2/zerologWriter/go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
module github.com/newrelic/go-agent/v3/integrations/logcontext-v2/zerologWriter

go 1.17

require (
github.com/newrelic/go-agent/v3 v3.19.1
github.com/newrelic/go-agent/v3/integrations/logcontext-v2/nrwriter v1.0.0
Expand Down
3 changes: 0 additions & 3 deletions v3/integrations/logcontext/nrlogrusplugin/go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
module github.com/newrelic/go-agent/v3/integrations/logcontext/nrlogrusplugin

// As of Dec 2019, the logrus go.mod file uses 1.13:
// https://github.com/sirupsen/logrus/blob/master/go.mod
go 1.13

require (
github.com/newrelic/go-agent/v3 v3.17.0
// v1.4.0 is required for for the log.WithContext.
github.com/sirupsen/logrus v1.4.0
golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e // indirect
)
2 changes: 0 additions & 2 deletions v3/integrations/nrawssdk-v1/go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
module github.com/newrelic/go-agent/v3/integrations/nrawssdk-v1

// As of Dec 2019, aws-sdk-go's go.mod does not specify a Go version. 1.6 is
// the earliest version of Go tested by aws-sdk-go's CI:
// https://github.com/aws/aws-sdk-go/blob/master/.travis.yml
go 1.7

require (
// v1.15.0 is the first aws-sdk-go version with module support.
github.com/aws/aws-sdk-go v1.34.0
Expand Down
2 changes: 0 additions & 2 deletions v3/integrations/nrawssdk-v2/go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
module github.com/newrelic/go-agent/v3/integrations/nrawssdk-v2

// As of May 2021, the aws-sdk-go-v2 go.mod file uses 1.15:
// https://github.com/aws/aws-sdk-go-v2/blob/master/go.mod
go 1.17

require (
github.com/aws/aws-sdk-go-v2 v1.16.15
github.com/aws/aws-sdk-go-v2/config v1.17.6
Expand Down
2 changes: 2 additions & 0 deletions v3/integrations/nrb3/go.mod
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module github.com/newrelic/go-agent/v3/integrations/nrb3
go 1.19
require github.com/newrelic/go-agent/v3 v3.21.1
3 changes: 0 additions & 3 deletions v3/integrations/nrecho-v3/go.mod
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
module github.com/newrelic/go-agent/v3/integrations/nrecho-v3

// 1.7 is the earliest version of Go tested by v3.1.0:
// https://github.com/labstack/echo/blob/v3.1.0/.travis.yml
go 1.7

require (
// v3.1.0 is the earliest v3 version of Echo that works with modules due
// to the github.com/rsc/letsencrypt import of v3.0.0.
github.com/labstack/echo v3.1.0+incompatible
github.com/labstack/gommon v0.3.0 // indirect
github.com/newrelic/go-agent/v3 v3.17.0
)
2 changes: 0 additions & 2 deletions v3/integrations/nrecho-v4/go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
module github.com/newrelic/go-agent/v3/integrations/nrecho-v4

// As of Jun 2022, the echo go.mod file uses 1.17:
// https://github.com/labstack/echo/blob/master/go.mod
go 1.17

require (
github.com/labstack/echo/v4 v4.9.0
github.com/newrelic/go-agent/v3 v3.18.2
Expand Down
2 changes: 0 additions & 2 deletions v3/integrations/nrelasticsearch-v7/go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
module github.com/newrelic/go-agent/v3/integrations/nrelasticsearch-v7

// As of Jan 2020, the v7 elasticsearch go.mod uses 1.11:
// https://github.com/elastic/go-elasticsearch/blob/7.x/go.mod
go 1.11

require (
github.com/elastic/go-elasticsearch/v7 v7.17.0
github.com/newrelic/go-agent/v3 v3.17.0
Expand Down
7 changes: 3 additions & 4 deletions v3/integrations/nrgin/go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
module github.com/newrelic/go-agent/v3/integrations/nrgin

// As of Dec 2019, the gin go.mod file uses 1.12:
// https://github.com/gin-gonic/gin/blob/master/go.mod
go 1.12

go 1.19
require (
github.com/gin-gonic/gin v1.9.0
github.com/newrelic/go-agent/v3 v3.18.2
github.com/newrelic/go-agent/v3 v3.23.0
)
replace github.com/newrelic/go-agent/v3 => ../..
8 changes: 7 additions & 1 deletion v3/integrations/nrgin/nrgin.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (

"github.com/gin-gonic/gin"
"github.com/newrelic/go-agent/v3/internal"
newrelic "github.com/newrelic/go-agent/v3/newrelic"
"github.com/newrelic/go-agent/v3/newrelic"
)

func init() { internal.TrackUsage("integration", "framework", "gin", "v1") }
Expand Down Expand Up @@ -60,11 +60,17 @@ func (w *replacementResponseWriter) WriteHeader(code int) {

func (w *replacementResponseWriter) Write(data []byte) (int, error) {
w.flushHeader()
if newrelic.IsSecurityAgentPresent() {
w.replacement.Write(data)
}
return w.ResponseWriter.Write(data)
}

func (w *replacementResponseWriter) WriteString(s string) (int, error) {
w.flushHeader()
if newrelic.IsSecurityAgentPresent() {
w.replacement.Write([]byte(s))
}
return w.ResponseWriter.WriteString(s)
}

Expand Down
2 changes: 0 additions & 2 deletions v3/integrations/nrgorilla/go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
module github.com/newrelic/go-agent/v3/integrations/nrgorilla

// As of Dec 2019, the gorilla/mux go.mod file uses 1.12:
// https://github.com/gorilla/mux/blob/master/go.mod
go 1.12

require (
// v1.7.0 is the earliest version of Gorilla using modules.
github.com/gorilla/mux v1.7.0
Expand Down
2 changes: 0 additions & 2 deletions v3/integrations/nrgraphgophers/go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
module github.com/newrelic/go-agent/v3/integrations/nrgraphgophers

// As of Jan 2020, the graphql-go go.mod file uses 1.13:
// https://github.com/graph-gophers/graphql-go/blob/master/go.mod
go 1.13

require (
// graphql-go has no tagged releases as of Jan 2020.
github.com/graph-gophers/graphql-go v0.0.0-20200207002730-8334863f2c8b
Expand Down
4 changes: 0 additions & 4 deletions v3/integrations/nrgraphqlgo/example/go.mod
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
module github.com/newrelic/go-agent/v3/integrations/nrgraphqlgo/example

go 1.13

require (
github.com/graphql-go/graphql v0.7.9
github.com/graphql-go/graphql-go-handler v0.2.3
github.com/newrelic/go-agent/v3 v3.3.0
github.com/newrelic/go-agent/v3/integrations/nrgraphqlgo v1.0.0
)

replace github.com/newrelic/go-agent/v3 => ../../../

replace github.com/newrelic/go-agent/v3/integrations/nrgraphqlgo => ../
2 changes: 0 additions & 2 deletions v3/integrations/nrgraphqlgo/go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
module github.com/newrelic/go-agent/v3/integrations/nrgraphqlgo

go 1.13

require (
github.com/graphql-go/graphql v0.7.9
github.com/newrelic/go-agent/v3 v3.17.0
Expand Down
21 changes: 5 additions & 16 deletions v3/integrations/nrgrpc/go.mod
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
module github.com/newrelic/go-agent/v3/integrations/nrgrpc

// As of Dec 2019, the grpc go.mod file uses 1.11:
// https://github.com/grpc/grpc-go/blob/master/go.mod
go 1.17

go 1.19
require (
// protobuf v1.3.0 is the earliest version using modules, we use v1.3.1
// because all dependencies were removed in this version.
github.com/golang/protobuf v1.5.2
github.com/newrelic/go-agent/v3 v3.18.2
github.com/golang/protobuf v1.5.3
github.com/newrelic/go-agent/v3 v3.23.0
// v1.15.0 is the earliest version of grpc using modules.
google.golang.org/grpc v1.49.0
)

require (
golang.org/x/net v0.7.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect
google.golang.org/protobuf v1.27.1 // indirect
google.golang.org/grpc v1.54.0
)
replace github.com/newrelic/go-agent/v3 => ../..
25 changes: 22 additions & 3 deletions v3/integrations/nrgrpc/nrgrpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"net/url"
"strings"

newrelic "github.com/newrelic/go-agent/v3/newrelic"
"github.com/newrelic/go-agent/v3/newrelic"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
)
Expand All @@ -32,12 +32,24 @@ func getURL(method, target string) *url.URL {
}
}

func getDummyRequest(method, target string) (request *http.Request) {
request = &http.Request{}
request.URL = getURL(method, target)
request.Header = http.Header{}
return request
}

// startClientSegment starts an ExternalSegment and adds Distributed Trace
// headers to the outgoing grpc metadata in the context.
func startClientSegment(ctx context.Context, method, target string) (*newrelic.ExternalSegment, context.Context) {
var seg *newrelic.ExternalSegment
if txn := newrelic.FromContext(ctx); nil != txn {
seg = newrelic.StartExternalSegment(txn, nil)
var req *http.Request

if txn := newrelic.FromContext(ctx); txn != nil {
if newrelic.IsSecurityAgentPresent() {
req = getDummyRequest(method, target)
}
seg = newrelic.StartExternalSegment(txn, req)

method = strings.TrimPrefix(method, "/")
seg.Host = getURL(method, target).Host
Expand All @@ -56,6 +68,13 @@ func startClientSegment(ctx context.Context, method, target string) (*newrelic.E
md.Set(k, v)
}
}
if newrelic.IsSecurityAgentPresent() {
for k := range req.Header {
if v := req.Header.Get(k); v != "" {
md.Set(k, v)
}
}
}
ctx = metadata.NewOutgoingContext(ctx, md)
}
}
Expand Down
15 changes: 11 additions & 4 deletions v3/integrations/nrgrpc/nrgrpc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func startTransaction(ctx context.Context, app *newrelic.Application, fullMethod
URL: url,
Method: method,
Transport: newrelic.TransportHTTP,
Type: "gRPC",
}
txn := app.StartTransaction(method)
txn.SetWebRequest(webReq)
Expand Down Expand Up @@ -293,7 +294,7 @@ func reportInterceptorStatus(ctx context.Context, txn *newrelic.Transaction, han
//
func UnaryServerInterceptor(app *newrelic.Application, options ...HandlerOption) grpc.UnaryServerInterceptor {
if app == nil {
return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
return func(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (any, error) {
return handler(ctx, req)
}
}
Expand All @@ -306,8 +307,9 @@ func UnaryServerInterceptor(app *newrelic.Application, options ...HandlerOption)
option(localHandlerMap)
}

return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) {
return func(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp any, err error) {
txn := startTransaction(ctx, app, info.FullMethod)
newrelic.GetSecurityAgentInterface().SendEvent("GRPC", req)
defer txn.End()

ctx = newrelic.NewContext(ctx, txn)
Expand All @@ -327,6 +329,11 @@ func (s wrappedServerStream) Context() context.Context {
return newrelic.NewContext(ctx, s.txn)
}

func (s wrappedServerStream) RecvMsg(msg any) error {
newrelic.GetSecurityAgentInterface().SendEvent("GRPC", msg)
return s.ServerStream.RecvMsg(msg)
}

func newWrappedServerStream(stream grpc.ServerStream, txn *newrelic.Transaction) grpc.ServerStream {
return wrappedServerStream{
ServerStream: stream,
Expand All @@ -346,7 +353,7 @@ func newWrappedServerStream(stream grpc.ServerStream, txn *newrelic.Transaction)
//
func StreamServerInterceptor(app *newrelic.Application, options ...HandlerOption) grpc.StreamServerInterceptor {
if app == nil {
return func(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
return func(srv any, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
return handler(srv, ss)
}
}
Expand All @@ -359,7 +366,7 @@ func StreamServerInterceptor(app *newrelic.Application, options ...HandlerOption
option(localHandlerMap)
}

return func(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
return func(srv any, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
txn := startTransaction(ss.Context(), app, info.FullMethod)
defer txn.End()

Expand Down
2 changes: 0 additions & 2 deletions v3/integrations/nrhttprouter/go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
module github.com/newrelic/go-agent/v3/integrations/nrhttprouter

// As of Dec 2019, the httprouter go.mod file uses 1.7:
// https://github.com/julienschmidt/httprouter/blob/master/go.mod
go 1.7

require (
// v1.3.0 is the earliest version of httprouter using modules.
github.com/julienschmidt/httprouter v1.3.0
Expand Down
2 changes: 0 additions & 2 deletions v3/integrations/nrlambda/go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
module github.com/newrelic/go-agent/v3/integrations/nrlambda

go 1.18

require (
github.com/aws/aws-lambda-go v1.41.0
github.com/newrelic/go-agent/v3 v3.21.1
Expand Down
Loading

0 comments on commit 45ed3ee

Please sign in to comment.