From 203404c8438fdd2995a5d49570460e906ad1212e Mon Sep 17 00:00:00 2001 From: Julio Guerra Date: Tue, 12 Feb 2019 10:38:07 +0100 Subject: [PATCH 01/25] agent: move the internals into a hidden package Move the content of the existing `agent` package into a new sub-package named `internal` so that it is no longer possible to import it from other packages. Only the parent package `agent` will be able to import it. --- agent/{ => internal}/agent.go | 0 agent/{ => internal}/app/runtime.go | 0 agent/{ => internal}/backend/api/api.pb.go | 0 agent/{ => internal}/backend/api/api.proto | 0 agent/{ => internal}/backend/api/api_suite_test.go | 0 agent/{ => internal}/backend/api/dep.go | 0 agent/{ => internal}/backend/api/jsonpb.go | 0 agent/{ => internal}/backend/api/jsonpb_test.go | 0 agent/{ => internal}/backend/backend_suite_test.go | 0 agent/{ => internal}/backend/client.go | 0 agent/{ => internal}/backend/client_test.go | 0 agent/{ => internal}/backend/error.go | 0 agent/{ => internal}/client.go | 0 agent/{ => internal}/config/config.go | 0 agent/{ => internal}/config/config_suite_test.go | 0 agent/{ => internal}/config/config_test.go | 0 agent/{ => internal}/metrics.go | 0 agent/{ => internal}/plog/plog.go | 0 agent/{ => internal}/plog/plog_suite_test.go | 0 agent/{ => internal}/plog/plog_test.go | 0 agent/{ => internal}/request.go | 0 agent/{ => internal}/version.go | 0 22 files changed, 0 insertions(+), 0 deletions(-) rename agent/{ => internal}/agent.go (100%) rename agent/{ => internal}/app/runtime.go (100%) rename agent/{ => internal}/backend/api/api.pb.go (100%) rename agent/{ => internal}/backend/api/api.proto (100%) rename agent/{ => internal}/backend/api/api_suite_test.go (100%) rename agent/{ => internal}/backend/api/dep.go (100%) rename agent/{ => internal}/backend/api/jsonpb.go (100%) rename agent/{ => internal}/backend/api/jsonpb_test.go (100%) rename agent/{ => internal}/backend/backend_suite_test.go (100%) rename agent/{ => internal}/backend/client.go (100%) rename agent/{ => internal}/backend/client_test.go (100%) rename agent/{ => internal}/backend/error.go (100%) rename agent/{ => internal}/client.go (100%) rename agent/{ => internal}/config/config.go (100%) rename agent/{ => internal}/config/config_suite_test.go (100%) rename agent/{ => internal}/config/config_test.go (100%) rename agent/{ => internal}/metrics.go (100%) rename agent/{ => internal}/plog/plog.go (100%) rename agent/{ => internal}/plog/plog_suite_test.go (100%) rename agent/{ => internal}/plog/plog_test.go (100%) rename agent/{ => internal}/request.go (100%) rename agent/{ => internal}/version.go (100%) diff --git a/agent/agent.go b/agent/internal/agent.go similarity index 100% rename from agent/agent.go rename to agent/internal/agent.go diff --git a/agent/app/runtime.go b/agent/internal/app/runtime.go similarity index 100% rename from agent/app/runtime.go rename to agent/internal/app/runtime.go diff --git a/agent/backend/api/api.pb.go b/agent/internal/backend/api/api.pb.go similarity index 100% rename from agent/backend/api/api.pb.go rename to agent/internal/backend/api/api.pb.go diff --git a/agent/backend/api/api.proto b/agent/internal/backend/api/api.proto similarity index 100% rename from agent/backend/api/api.proto rename to agent/internal/backend/api/api.proto diff --git a/agent/backend/api/api_suite_test.go b/agent/internal/backend/api/api_suite_test.go similarity index 100% rename from agent/backend/api/api_suite_test.go rename to agent/internal/backend/api/api_suite_test.go diff --git a/agent/backend/api/dep.go b/agent/internal/backend/api/dep.go similarity index 100% rename from agent/backend/api/dep.go rename to agent/internal/backend/api/dep.go diff --git a/agent/backend/api/jsonpb.go b/agent/internal/backend/api/jsonpb.go similarity index 100% rename from agent/backend/api/jsonpb.go rename to agent/internal/backend/api/jsonpb.go diff --git a/agent/backend/api/jsonpb_test.go b/agent/internal/backend/api/jsonpb_test.go similarity index 100% rename from agent/backend/api/jsonpb_test.go rename to agent/internal/backend/api/jsonpb_test.go diff --git a/agent/backend/backend_suite_test.go b/agent/internal/backend/backend_suite_test.go similarity index 100% rename from agent/backend/backend_suite_test.go rename to agent/internal/backend/backend_suite_test.go diff --git a/agent/backend/client.go b/agent/internal/backend/client.go similarity index 100% rename from agent/backend/client.go rename to agent/internal/backend/client.go diff --git a/agent/backend/client_test.go b/agent/internal/backend/client_test.go similarity index 100% rename from agent/backend/client_test.go rename to agent/internal/backend/client_test.go diff --git a/agent/backend/error.go b/agent/internal/backend/error.go similarity index 100% rename from agent/backend/error.go rename to agent/internal/backend/error.go diff --git a/agent/client.go b/agent/internal/client.go similarity index 100% rename from agent/client.go rename to agent/internal/client.go diff --git a/agent/config/config.go b/agent/internal/config/config.go similarity index 100% rename from agent/config/config.go rename to agent/internal/config/config.go diff --git a/agent/config/config_suite_test.go b/agent/internal/config/config_suite_test.go similarity index 100% rename from agent/config/config_suite_test.go rename to agent/internal/config/config_suite_test.go diff --git a/agent/config/config_test.go b/agent/internal/config/config_test.go similarity index 100% rename from agent/config/config_test.go rename to agent/internal/config/config_test.go diff --git a/agent/metrics.go b/agent/internal/metrics.go similarity index 100% rename from agent/metrics.go rename to agent/internal/metrics.go diff --git a/agent/plog/plog.go b/agent/internal/plog/plog.go similarity index 100% rename from agent/plog/plog.go rename to agent/internal/plog/plog.go diff --git a/agent/plog/plog_suite_test.go b/agent/internal/plog/plog_suite_test.go similarity index 100% rename from agent/plog/plog_suite_test.go rename to agent/internal/plog/plog_suite_test.go diff --git a/agent/plog/plog_test.go b/agent/internal/plog/plog_test.go similarity index 100% rename from agent/plog/plog_test.go rename to agent/internal/plog/plog_test.go diff --git a/agent/request.go b/agent/internal/request.go similarity index 100% rename from agent/request.go rename to agent/internal/request.go diff --git a/agent/version.go b/agent/internal/version.go similarity index 100% rename from agent/version.go rename to agent/internal/version.go From 651c53126f7a1097fa37a7019368380f51cfe41c Mon Sep 17 00:00:00 2001 From: Julio Guerra Date: Wed, 13 Feb 2019 17:41:33 +0100 Subject: [PATCH 02/25] sdk: define and use an abstract agent interface Now the agent internals are strictly private and cannot be imported anymore, we need to define the interface the SDK expects so that it no longer imports the agent but rather its interface. This interface is defined in `agent/types` which will be from now the package exporting the public types of the agent. It is therefore possible to implement a "disabled agent" in the SDK, implementing this interface as noops, so that it is disabled until the agent is initialized. --- agent/agent.go | 14 +++++++++++ agent/types/types.go | 34 +++++++++++++++++++++++++++ sdk/agent.go | 56 +++++++++++++++++++++++++++++++++++++++++++- sdk/event.go | 19 ++++----------- sdk/record.go | 23 ++++++------------ sdk/user.go | 25 +++++++------------- 6 files changed, 123 insertions(+), 48 deletions(-) create mode 100644 agent/agent.go create mode 100644 agent/types/types.go diff --git a/agent/agent.go b/agent/agent.go new file mode 100644 index 00000000..ae3be06d --- /dev/null +++ b/agent/agent.go @@ -0,0 +1,14 @@ +package agent + +import ( + "github.com/sqreen/go-agent/agent/internal" + "github.com/sqreen/go-agent/sdk" +) + +var agent *internal.Agent + +func init() { + agent = internal.New() + sdk.SetAgent(agent) + agent.Start() +} diff --git a/agent/types/types.go b/agent/types/types.go new file mode 100644 index 00000000..27f0fd45 --- /dev/null +++ b/agent/types/types.go @@ -0,0 +1,34 @@ +// This package is the contract between the agent and the SDK. It allows to +// strictly separate the SDK from the agent package since the agent does not +// export its internals. + +package types + +import ( + "net/http" + "time" +) + +type Agent interface { + NewRequestRecord(req *http.Request) RequestRecord + GracefulStop() +} + +type RequestRecord interface { + // NewCustomEvent creates a new custom event and adds it to the request record. + NewCustomEvent(event string) CustomEvent + // NewUserSignup creates a new user signup event and adds it to the request record. + NewUserSignup(id map[string]string) + // NewUserAuth creates a new user auth event and adds it to the request record. + NewUserAuth(id map[string]string, success bool) + // Identify associates the given user identifiers to the request. + Identify(id map[string]string) + // Close needs to be called when the request is done. + Close() +} + +type CustomEvent interface { + WithTimestamp(t time.Time) + WithProperties(props map[string]string) + WithUserIdentifiers(id map[string]string) +} diff --git a/sdk/agent.go b/sdk/agent.go index 70d557f4..cdb134a2 100644 --- a/sdk/agent.go +++ b/sdk/agent.go @@ -1,7 +1,61 @@ package sdk -import "github.com/sqreen/go-agent/agent" +import ( + "net/http" + "time" + + "github.com/sqreen/go-agent/agent/types" +) + +// The agent entrypoints are disabled by default. It must set its entrypoints on +// initialization using SetAgent(). +var agent types.Agent = disabledAgent{} + +// SetAgent allows the agent to set its SDK entrypoints. It is automatically set +// by the agent when it intializes itself. +func SetAgent(a types.Agent) { + agent = a +} func GracefulStop() { agent.GracefulStop() } + +type disabledAgent struct { +} + +func (_ disabledAgent) GracefulStop() { +} + +func (a disabledAgent) NewRequestRecord(_ *http.Request) types.RequestRecord { + // Return itself as long as it can both implement RequestRecord and Agent + // interfaces without conflicting thanks to distinct method signatures. + return a +} + +func (_ disabledAgent) Close() { +} + +func (a disabledAgent) NewCustomEvent(_ string) types.CustomEvent { + // Return itself as long as it can both implement RequestRecord and Event + // interfaces without conflicting thanks to distinct method signatures. + return a +} + +func (_ disabledAgent) NewUserAuth(_ map[string]string, _ bool) { +} + +func (_ disabledAgent) NewUserSignup(_ map[string]string) { +} + +func (_ disabledAgent) Identify(_ map[string]string) { +} + +func (_ disabledAgent) WithTimestamp(_ time.Time) { +} + +func (_ disabledAgent) WithProperties(_ map[string]string) { +} + +func (_ disabledAgent) WithUserIdentifiers(_ map[string]string) { +} diff --git a/sdk/event.go b/sdk/event.go index de1a7f45..9877e7d5 100644 --- a/sdk/event.go +++ b/sdk/event.go @@ -3,7 +3,7 @@ package sdk import ( "time" - "github.com/sqreen/go-agent/agent" + "github.com/sqreen/go-agent/agent/types" ) // EventPropertyMap is the type used to represent extra custom event properties. @@ -20,7 +20,7 @@ type EventPropertyMap map[string]string // options further specifying the event, such as a unique user identifier, extra // properties, etc. type HTTPRequestEvent struct { - impl *agent.HTTPRequestEvent + impl types.CustomEvent } // WithTimestamp adds a custom timestamp to the event. By default, the timestamp @@ -29,9 +29,6 @@ type HTTPRequestEvent struct { // sdk.FromContext(ctx).TrackEvent("my.event").WithTimestamp(yourTimestamp) // func (e *HTTPRequestEvent) WithTimestamp(t time.Time) *HTTPRequestEvent { - if e == nil { - return nil - } e.impl.WithTimestamp(t) return e } @@ -45,10 +42,7 @@ func (e *HTTPRequestEvent) WithTimestamp(t time.Time) *HTTPRequestEvent { // sdk.FromContext(ctx).TrackEvent("my.event").WithProperties(prop) // func (e *HTTPRequestEvent) WithProperties(p EventPropertyMap) *HTTPRequestEvent { - if e == nil { - return nil - } - e.impl.WithProperties(agent.EventPropertyMap(p)) + e.impl.WithProperties(p) return e } @@ -59,10 +53,7 @@ func (e *HTTPRequestEvent) WithProperties(p EventPropertyMap) *HTTPRequestEvent // sdk.FromContext(ctx).Identify(uid) // func (e *HTTPRequestEvent) WithUserIdentifiers(id EventUserIdentifiersMap) *HTTPRequestEvent { - if e == nil || len(id) == 0 { - return nil - } - e.impl.WithUserIdentifier(agent.EventUserIdentifiersMap(id)) + e.impl.WithUserIdentifiers(id) return e } @@ -70,7 +61,7 @@ func (e *HTTPRequestEvent) WithUserIdentifiers(id EventUserIdentifiersMap) *HTTP // add options further specifying the event, such as a unique user identifier, // extra properties, etc. type UserHTTPRequestEvent struct { - impl *HTTPRequestEvent + impl HTTPRequestEvent } // WithTimestamp adds a custom timestamp to the event. By default, the timestamp diff --git a/sdk/record.go b/sdk/record.go index b0169fdb..8f0e7917 100644 --- a/sdk/record.go +++ b/sdk/record.go @@ -4,13 +4,13 @@ import ( "context" "net/http" - "github.com/sqreen/go-agent/agent" + "github.com/sqreen/go-agent/agent/types" ) // HTTPRequestRecord is the SDK record associated to a HTTP request. Its methods // allow request handlers to track custom security events. type HTTPRequestRecord struct { - ctx *agent.HTTPRequestRecord + record types.RequestRecord } // EventUserIdentifiersMap is the type used to represent user identifiers in @@ -27,7 +27,7 @@ type EventUserIdentifiersMap map[string]string // request. func NewHTTPRequestRecord(req *http.Request) *HTTPRequestRecord { return &HTTPRequestRecord{ - ctx: agent.NewHTTPRequestRecord(req), + record: agent.NewRequestRecord(req), } } @@ -64,10 +64,7 @@ func FromContext(ctx context.Context) *HTTPRequestRecord { // Close the request record to signal the HTTP request handling is now done. func (ctx *HTTPRequestRecord) Close() { - if ctx == nil { - return - } - ctx.ctx.Close() + ctx.record.Close() } // TrackEvent allows to track a custom security-related event having the given @@ -81,10 +78,7 @@ func (ctx *HTTPRequestRecord) Close() { // sqreen.TrackEvent("my.event").WithUserIdentifiers(uid).WithProperties(props) // func (ctx *HTTPRequestRecord) TrackEvent(event string) *HTTPRequestEvent { - if ctx == nil { - return nil - } - return &HTTPRequestEvent{ctx.ctx.TrackEvent(event)} + return &HTTPRequestEvent{ctx.record.NewCustomEvent(event)} } // ForUser returns a new SDK context for the given user uniquely identified by @@ -98,11 +92,8 @@ func (ctx *HTTPRequestRecord) TrackEvent(event string) *HTTPRequestEvent { // sqUser.TrackEvent("my.event.one").WithProperties(props) // func (ctx *HTTPRequestRecord) ForUser(id EventUserIdentifiersMap) *UserHTTPRequestRecord { - if ctx == nil || len(id) == 0 { - return nil - } return &UserHTTPRequestRecord{ - ctx: ctx.ctx, - id: id, + record: ctx.record, + id: id, } } diff --git a/sdk/user.go b/sdk/user.go index 12494365..8b2986de 100644 --- a/sdk/user.go +++ b/sdk/user.go @@ -1,14 +1,14 @@ package sdk -import "github.com/sqreen/go-agent/agent" +import "github.com/sqreen/go-agent/agent/types" // UserHTTPRequestRecord is the SDK record associated to a HTTP request for a // given user. Its methods allow request handlers to signal security events // related to the given user. It allows to send security events related to a // single user. type UserHTTPRequestRecord struct { - ctx *agent.HTTPRequestRecord - id EventUserIdentifiersMap + record types.RequestRecord + id EventUserIdentifiersMap } // TrackAuth allows to track a user authentication. The boolean value @@ -20,10 +20,7 @@ type UserHTTPRequestRecord struct { // sqUser.TrackAuthSuccess() // func (ctx *UserHTTPRequestRecord) TrackAuth(loginSuccess bool) *UserHTTPRequestRecord { - if ctx == nil { - return nil - } - ctx.ctx.TrackAuth(loginSuccess, agent.EventUserIdentifiersMap(ctx.id)) + ctx.record.NewUserAuth(ctx.id, loginSuccess) return ctx } @@ -45,10 +42,7 @@ func (ctx *UserHTTPRequestRecord) TrackAuthFailure() *UserHTTPRequestRecord { // sqUser.TrackSignup() // func (ctx *UserHTTPRequestRecord) TrackSignup() *UserHTTPRequestRecord { - if ctx == nil { - return nil - } - ctx.ctx.TrackSignup(agent.EventUserIdentifiersMap(ctx.id)) + ctx.record.NewUserSignup(ctx.id) return ctx } @@ -64,11 +58,8 @@ func (ctx *UserHTTPRequestRecord) TrackSignup() *UserHTTPRequestRecord { // sqUser.TrackEvent("my.event") // func (ctx *UserHTTPRequestRecord) TrackEvent(event string) *UserHTTPRequestEvent { - if ctx == nil { - return nil - } - ctx.ctx.TrackIdentify(agent.EventUserIdentifiersMap(ctx.id)) - return &UserHTTPRequestEvent{&HTTPRequestEvent{ctx.ctx.TrackEvent(event)}} + ctx.record.Identify(ctx.id) + return &UserHTTPRequestEvent{HTTPRequestEvent{ctx.record.NewCustomEvent(event)}} } // Identify associates the user to current request so that Sqreen can apply @@ -83,6 +74,6 @@ func (ctx *UserHTTPRequestRecord) Identify() *UserHTTPRequestRecord { if ctx == nil { return nil } - ctx.ctx.TrackIdentify(agent.EventUserIdentifiersMap(ctx.id)) + ctx.record.Identify(ctx.id) return ctx } From b4dd89122fccb81862ce5fb5b9b18611051f7fbe Mon Sep 17 00:00:00 2001 From: Julio Guerra Date: Fri, 15 Feb 2019 18:34:31 +0100 Subject: [PATCH 03/25] sdk: reach 100% statement coverage Now that we have an abstract interface, it is now simple to reach the 100% statement coverage of the `sdk` layer, by simply implementing the agent interface as a mockup. --- go.mod | 3 +- sdk/sdk_suite_test.go | 13 -- sdk/sdk_test.go | 363 +++++++++++++++++++++++++++++++++++------- 3 files changed, 308 insertions(+), 71 deletions(-) delete mode 100644 sdk/sdk_suite_test.go diff --git a/go.mod b/go.mod index f4d9d695..25668e02 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,8 @@ require ( github.com/onsi/ginkgo v1.7.0 github.com/onsi/gomega v1.4.3 github.com/spf13/viper v1.3.1 - github.com/stretchr/testify v1.2.2 + github.com/stretchr/objx v0.1.1 // indirect + github.com/stretchr/testify v1.3.0 github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasttemplate v0.0.0-20170224212429-dcecefd839c4 // indirect golang.org/x/net v0.0.0-20181220203305-927f97764cc3 diff --git a/sdk/sdk_suite_test.go b/sdk/sdk_suite_test.go deleted file mode 100644 index f5536e4b..00000000 --- a/sdk/sdk_suite_test.go +++ /dev/null @@ -1,13 +0,0 @@ -package sdk_test - -import ( - "testing" - - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" -) - -func TestMiddleware(t *testing.T) { - RegisterFailHandler(Fail) - RunSpecs(t, "SDK Suite") -} diff --git a/sdk/sdk_test.go b/sdk/sdk_test.go index c2613ad5..4dc533a9 100644 --- a/sdk/sdk_test.go +++ b/sdk/sdk_test.go @@ -1,85 +1,334 @@ -package sdk +package sdk_test import ( + "context" "net/http" "testing" "time" + "github.com/sqreen/go-agent/agent/types" + "github.com/sqreen/go-agent/sdk" "github.com/sqreen/go-agent/tools/testlib" + "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" ) -func newFakeRequest() *http.Request { - req, _ := http.NewRequest("GET", "https://sqreen.com", nil) - return req +type SDKTestSuite struct { + suite.Suite + agent *agentMockup } -func TestSDK(t *testing.T) { - t.Run("Disabled", func(t *testing.T) { - testDisabledSDKCalls(t, nil) +func (suite *SDKTestSuite) SetupTest() { + suite.agent = &agentMockup{} + sdk.SetAgent(suite.agent) +} + +func (suite *SDKTestSuite) TearDownTest() { + suite.agent.AssertExpectations(suite.T()) +} + +func (suite *SDKTestSuite) TestFromContext() { + require := require.New(suite.T()) + + req := newTestRequest() + suite.agent.ExpectNewRequestRecord(req).Once() + + sqreen := sdk.NewHTTPRequestRecord(req) + require.NotNil(sqreen) + + ctx := context.WithValue(context.Background(), sdk.HTTPRequestRecordContextKey, sqreen) + + got := sdk.FromContext(ctx) + require.Equal(got, sqreen) +} + +func (suite *SDKTestSuite) TestGracefulStop() { + suite.agent.ExpectGracefulStop().Once() + sdk.GracefulStop() +} + +func (suite *SDKTestSuite) TestTrackEvent() { + require := require.New(suite.T()) + + req := newTestRequest() + suite.agent.ExpectNewRequestRecord(req).Once() + + sqreen := sdk.NewHTTPRequestRecord(req) + require.NotNil(sqreen) + + eventID := testlib.RandString(2, 50) + suite.agent.ExpectTrackEvent(eventID).Once() + sqEvent := sqreen.TrackEvent(eventID) + require.NotNil(sqEvent) + + suite.Run("with user identifiers", func() { + userID := sdk.EventUserIdentifiersMap{testlib.RandString(2, 50): testlib.RandString(2, 50)} + suite.agent.ExpectWithUserIdentifiers(userID).Once() + sqEvent = sqEvent.WithUserIdentifiers(userID) + require.NotNil(sqEvent) + + suite.Run("chain with properties", func() { + props := sdk.EventPropertyMap{testlib.RandString(2, 50): testlib.RandString(2, 50)} + suite.agent.ExpectWithProperties(props).Once() + sqEvent = sqEvent.WithProperties(props) + require.NotNil(sqEvent) + }) + + suite.Run("chain with timestamp", func() { + t := time.Now() + suite.agent.ExpectWithTimestamp(t).Once() + sqEvent = sqEvent.WithTimestamp(t) + require.NotNil(sqEvent) + }) + }) + + suite.Run("with properties", func() { + props := sdk.EventPropertyMap{testlib.RandString(2, 50): testlib.RandString(2, 50)} + suite.agent.ExpectWithProperties(props).Once() + sqEvent = sqEvent.WithProperties(props) + require.NotNil(sqEvent) + + suite.Run("chain with user identifiers", func() { + userID := sdk.EventUserIdentifiersMap{testlib.RandString(2, 50): testlib.RandString(2, 50)} + suite.agent.ExpectWithUserIdentifiers(userID).Once() + sqEvent = sqEvent.WithUserIdentifiers(userID) + require.NotNil(sqEvent) + }) + + suite.Run("chain with timestamp", func() { + t := time.Now() + suite.agent.ExpectWithTimestamp(t).Once() + sqEvent = sqEvent.WithTimestamp(t) + require.NotNil(sqEvent) + }) }) - t.Run("Track", func(t *testing.T) { - ctx := NewHTTPRequestRecord(newFakeRequest()) - eventId := testlib.RandString(2, 50) - uid := testlib.RandString(2, 50) - idMap := EventUserIdentifiersMap{"uid": uid} - event := ctx.TrackEvent(eventId) - require.Equal(t, event.impl.GetName(), "track") + suite.Run("with timestamp", func() { + t := time.Now() + suite.agent.ExpectWithTimestamp(t).Once() + sqEvent = sqEvent.WithTimestamp(t) + require.NotNil(sqEvent) + + suite.Run("chain with user identifiers", func() { + userID := sdk.EventUserIdentifiersMap{testlib.RandString(2, 50): testlib.RandString(2, 50)} + suite.agent.ExpectWithUserIdentifiers(userID).Once() + sqEvent = sqEvent.WithUserIdentifiers(userID) + require.NotNil(sqEvent) + }) - t.Run("with user identifier", func(t *testing.T) { - event.WithUserIdentifiers(idMap) + suite.Run("chain with properties", func() { + props := sdk.EventPropertyMap{testlib.RandString(2, 50): testlib.RandString(2, 50)} + suite.agent.ExpectWithProperties(props).Once() + sqEvent = sqEvent.WithProperties(props) + require.NotNil(sqEvent) }) }) - t.Run("TrackAuth", func(t *testing.T) { - ctx := NewHTTPRequestRecord(newFakeRequest()) - uid := testlib.RandString(2, 50) - idMap := EventUserIdentifiersMap{"uid": uid} - success := true - ctx.ForUser(idMap).TrackAuth(success) +} + +func (suite *SDKTestSuite) TestForUser() { + require := require.New(suite.T()) + + req := newTestRequest() + suite.agent.ExpectNewRequestRecord(req) + sqreen := sdk.NewHTTPRequestRecord(req) + require.NotNil(sqreen) + + userID := sdk.EventUserIdentifiersMap{testlib.RandString(2, 50): testlib.RandString(2, 50)} + + sqUser := sqreen.ForUser(userID) + require.NotNil(sqUser) + + suite.Run("TrackAuth", func() { + suite.agent.ExpectTrackAuth(userID, true).Once() + sqUser = sqUser.TrackAuth(true) + require.NotNil(sqUser) + + suite.agent.ExpectTrackAuth(userID, false).Once() + sqUser = sqUser.TrackAuth(false) + require.NotNil(sqUser) }) - t.Run("TrackSignup", func(t *testing.T) { - ctx := NewHTTPRequestRecord(newFakeRequest()) - uid := testlib.RandString(2, 50) - idMap := EventUserIdentifiersMap{"uid": uid} - ctx.ForUser(idMap).TrackSignup() + suite.Run("TrackSignup", func() { + suite.agent.ExpectTrackSignup(userID).Once() + sqUser = sqUser.TrackSignup() + require.NotNil(sqUser) }) - t.Run("TrackEvent", func(t *testing.T) { - ctx := NewHTTPRequestRecord(newFakeRequest()) - uid := testlib.RandString(2, 50) - idMap := EventUserIdentifiersMap{"uid": uid} - ctx.ForUser(idMap).TrackEvent("my.event") + suite.Run("Identfy", func() { + suite.agent.ExpectIdentify(userID).Once() + sqUser = sqUser.Identify() + require.NotNil(sqUser) }) - t.Run("Identify", func(t *testing.T) { - ctx := NewHTTPRequestRecord(newFakeRequest()) - uid := testlib.RandString(2, 50) - idMap := EventUserIdentifiersMap{"uid": uid} - ctx.ForUser(idMap).Identify() + suite.Run("TrackEvent", func() { + eventID := testlib.RandString(2, 50) + suite.agent.ExpectTrackEvent(eventID).Once() + suite.agent.ExpectIdentify(userID).Once() + sqEvent := sqUser.TrackEvent(eventID) + require.NotNil(sqEvent) + + suite.Run("with properties", func() { + props := sdk.EventPropertyMap{testlib.RandString(2, 50): testlib.RandString(2, 50)} + suite.agent.ExpectWithProperties(props).Once() + sqEvent = sqEvent.WithProperties(props) + require.NotNil(sqEvent) + + suite.Run("chain with timestamp", func() { + t := time.Now() + suite.agent.ExpectWithTimestamp(t).Once() + sqEvent = sqEvent.WithTimestamp(t) + require.NotNil(sqEvent) + }) + }) + + suite.Run("with timestamp", func() { + t := time.Now() + suite.agent.ExpectWithTimestamp(t).Once() + sqEvent = sqEvent.WithTimestamp(t) + require.NotNil(sqEvent) + + suite.Run("chain with properties", func() { + props := sdk.EventPropertyMap{testlib.RandString(2, 50): testlib.RandString(2, 50)} + suite.agent.ExpectWithProperties(props).Once() + sqEvent = sqEvent.WithProperties(props) + require.NotNil(sqEvent) + }) + }) }) } -func testDisabledSDKCalls(t *testing.T, ctx *HTTPRequestRecord) { - event := ctx.TrackEvent(testlib.RandString(0, 50)) - require.Nil(t, event) - event = event.WithTimestamp(time.Now()) - require.Nil(t, event) - event = event.WithProperties(nil) - require.Nil(t, event) - event = ctx.TrackEvent(testlib.RandString(0, 50)) - require.Nil(t, event) - event = event.WithProperties(nil) - require.Nil(t, event) - event = event.WithTimestamp(time.Now()) - require.Nil(t, event) - uid := EventUserIdentifiersMap{"uid": "uid"} - ctx.ForUser(uid).TrackSignup().TrackAuth(true).TrackEvent("password.changed") - ctx.ForUser(uid).TrackAuthSuccess() - ctx.ForUser(uid).TrackAuthFailure() - ctx.ForUser(uid).TrackSignup() - ctx.ForUser(uid).Identify() - ctx.Close() +func TestDisabled(t *testing.T) { + require := require.New(t) + sdk.SetAgent(nil) + + useTheSDK := func(sqreen *sdk.HTTPRequestRecord) func() { + return func() { + event := sqreen.TrackEvent(testlib.RandString(0, 50)) + event = event.WithTimestamp(time.Now()) + userID := sdk.EventUserIdentifiersMap{testlib.RandString(2, 30): testlib.RandString(2, 30)} + event = event.WithUserIdentifiers(userID) + props := sdk.EventPropertyMap{testlib.RandString(2, 30): testlib.RandString(2, 30)} + event = event.WithProperties(props) + uid := sdk.EventUserIdentifiersMap{testlib.RandString(2, 30): testlib.RandString(2, 30)} + sqUser := sqreen.ForUser(uid) + sqUser = sqUser.TrackSignup() + sqUser = sqUser.TrackAuth(true) + sqUser = sqUser.TrackAuthSuccess() + sqUser = sqUser.TrackAuthFailure() + sqUser = sqUser.Identify() + sqUserEvent := sqUser.TrackEvent(testlib.RandString(0, 50)) + sqUserEvent = sqUserEvent.WithProperties(props) + sqUserEvent = sqUserEvent.WithTimestamp(time.Now()) + sqreen.Close() + } + } + + // Using the SDK shouldn't fail. + + // When getting the SDK context out of a bare Go context, ie. without sqreen's + // middleware modifications. + sqreen := sdk.FromContext(context.Background()) + require.NotPanics(useTheSDK(sqreen)) + + // When creating the request record ourselves. + sqreen = sdk.NewHTTPRequestRecord(newTestRequest()) + require.NotPanics(useTheSDK(sqreen)) + + // When not even following the SDK requirements. + require.NotPanics(useTheSDK(nil)) +} + +func TestSDK(t *testing.T) { + suite.Run(t, new(SDKTestSuite)) +} + +func newTestRequest() *http.Request { + req, _ := http.NewRequest("GET", "https://sqreen.com", nil) + return req +} + +type agentMockup struct { + mock.Mock +} + +func (a *agentMockup) GracefulStop() { + a.Called() +} + +func (a *agentMockup) ExpectGracefulStop() *mock.Call { + return a.On("GracefulStop") +} + +func (a *agentMockup) NewRequestRecord(req *http.Request) types.RequestRecord { + a.Called(req) + return a +} + +func (a *agentMockup) ExpectNewRequestRecord(req *http.Request) *mock.Call { + return a.On("NewRequestRecord", req) +} + +func (a *agentMockup) Close() { + a.Called() +} + +func (a *agentMockup) NewCustomEvent(event string) types.CustomEvent { + // Return itself as long as it can both implement RequestRecord and Event + // interfaces without conflicting thanks to distinct method signatures. + a.Called(event) + return a +} + +func (a *agentMockup) ExpectTrackEvent(event string) *mock.Call { + return a.On("NewCustomEvent", event) +} + +func (a *agentMockup) NewUserAuth(id map[string]string, success bool) { + a.Called(id, success) +} + +func (a *agentMockup) ExpectTrackAuth(id map[string]string, success bool) *mock.Call { + return a.On("NewUserAuth", id, success) +} + +func (a *agentMockup) NewUserSignup(id map[string]string) { + a.Called(id) +} + +func (a *agentMockup) ExpectTrackSignup(id map[string]string) *mock.Call { + return a.On("NewUserSignup", id) +} + +func (a *agentMockup) Identify(id map[string]string) { + a.Called(id) +} + +func (a *agentMockup) ExpectIdentify(id map[string]string) *mock.Call { + return a.On("Identify", id) +} + +func (a *agentMockup) WithTimestamp(t time.Time) { + a.Called(t) +} + +func (a *agentMockup) ExpectWithTimestamp(t time.Time) *mock.Call { + return a.On("WithTimestamp", t) +} + +func (a *agentMockup) WithProperties(props map[string]string) { + a.Called(props) +} + +func (a *agentMockup) ExpectWithProperties(props map[string]string) *mock.Call { + return a.On("WithProperties", props) +} + +func (a *agentMockup) WithUserIdentifiers(id map[string]string) { + a.Called(id) +} + +func (a *agentMockup) ExpectWithUserIdentifiers(id map[string]string) *mock.Call { + return a.On("WithUserIdentifiers", id) } From 7f6e8b85eca07a226f80be660f177006ddd106b3 Mon Sep 17 00:00:00 2001 From: Julio Guerra Date: Fri, 15 Feb 2019 18:38:17 +0100 Subject: [PATCH 04/25] sdk: allow using the SDK with nil pointer receivers Fix the SDK so that it is possible to use it with nil pointer receivers. Note that this is unlikely to happen because it is only possible because of a programming mistake. --- sdk/agent.go | 4 ++++ sdk/event.go | 9 +++++++++ sdk/record.go | 9 +++++++++ sdk/user.go | 15 +++++++++++++++ 4 files changed, 37 insertions(+) diff --git a/sdk/agent.go b/sdk/agent.go index cdb134a2..7af597be 100644 --- a/sdk/agent.go +++ b/sdk/agent.go @@ -14,6 +14,10 @@ var agent types.Agent = disabledAgent{} // SetAgent allows the agent to set its SDK entrypoints. It is automatically set // by the agent when it intializes itself. func SetAgent(a types.Agent) { + if a == nil { + agent = disabledAgent{} + return + } agent = a } diff --git a/sdk/event.go b/sdk/event.go index 9877e7d5..c9df71b6 100644 --- a/sdk/event.go +++ b/sdk/event.go @@ -29,6 +29,9 @@ type HTTPRequestEvent struct { // sdk.FromContext(ctx).TrackEvent("my.event").WithTimestamp(yourTimestamp) // func (e *HTTPRequestEvent) WithTimestamp(t time.Time) *HTTPRequestEvent { + if e == nil { + return nil + } e.impl.WithTimestamp(t) return e } @@ -42,6 +45,9 @@ func (e *HTTPRequestEvent) WithTimestamp(t time.Time) *HTTPRequestEvent { // sdk.FromContext(ctx).TrackEvent("my.event").WithProperties(prop) // func (e *HTTPRequestEvent) WithProperties(p EventPropertyMap) *HTTPRequestEvent { + if e == nil { + return nil + } e.impl.WithProperties(p) return e } @@ -53,6 +59,9 @@ func (e *HTTPRequestEvent) WithProperties(p EventPropertyMap) *HTTPRequestEvent // sdk.FromContext(ctx).Identify(uid) // func (e *HTTPRequestEvent) WithUserIdentifiers(id EventUserIdentifiersMap) *HTTPRequestEvent { + if e == nil { + return nil + } e.impl.WithUserIdentifiers(id) return e } diff --git a/sdk/record.go b/sdk/record.go index 8f0e7917..d81c9672 100644 --- a/sdk/record.go +++ b/sdk/record.go @@ -64,6 +64,9 @@ func FromContext(ctx context.Context) *HTTPRequestRecord { // Close the request record to signal the HTTP request handling is now done. func (ctx *HTTPRequestRecord) Close() { + if ctx == nil { + return + } ctx.record.Close() } @@ -78,6 +81,9 @@ func (ctx *HTTPRequestRecord) Close() { // sqreen.TrackEvent("my.event").WithUserIdentifiers(uid).WithProperties(props) // func (ctx *HTTPRequestRecord) TrackEvent(event string) *HTTPRequestEvent { + if ctx == nil { + return nil + } return &HTTPRequestEvent{ctx.record.NewCustomEvent(event)} } @@ -92,6 +98,9 @@ func (ctx *HTTPRequestRecord) TrackEvent(event string) *HTTPRequestEvent { // sqUser.TrackEvent("my.event.one").WithProperties(props) // func (ctx *HTTPRequestRecord) ForUser(id EventUserIdentifiersMap) *UserHTTPRequestRecord { + if ctx == nil { + return nil + } return &UserHTTPRequestRecord{ record: ctx.record, id: id, diff --git a/sdk/user.go b/sdk/user.go index 8b2986de..ceb8012b 100644 --- a/sdk/user.go +++ b/sdk/user.go @@ -20,17 +20,26 @@ type UserHTTPRequestRecord struct { // sqUser.TrackAuthSuccess() // func (ctx *UserHTTPRequestRecord) TrackAuth(loginSuccess bool) *UserHTTPRequestRecord { + if ctx == nil { + return nil + } ctx.record.NewUserAuth(ctx.id, loginSuccess) return ctx } // TrackAuthSuccess is equivalent to `TrackAuth(true)`. func (ctx *UserHTTPRequestRecord) TrackAuthSuccess() *UserHTTPRequestRecord { + if ctx == nil { + return nil + } return ctx.TrackAuth(true) } // TrackAuthFailure is equivalent to `TrackAuth(false)`. func (ctx *UserHTTPRequestRecord) TrackAuthFailure() *UserHTTPRequestRecord { + if ctx == nil { + return nil + } return ctx.TrackAuth(false) } @@ -42,6 +51,9 @@ func (ctx *UserHTTPRequestRecord) TrackAuthFailure() *UserHTTPRequestRecord { // sqUser.TrackSignup() // func (ctx *UserHTTPRequestRecord) TrackSignup() *UserHTTPRequestRecord { + if ctx == nil { + return nil + } ctx.record.NewUserSignup(ctx.id) return ctx } @@ -58,6 +70,9 @@ func (ctx *UserHTTPRequestRecord) TrackSignup() *UserHTTPRequestRecord { // sqUser.TrackEvent("my.event") // func (ctx *UserHTTPRequestRecord) TrackEvent(event string) *UserHTTPRequestEvent { + if ctx == nil { + return nil + } ctx.record.Identify(ctx.id) return &UserHTTPRequestEvent{HTTPRequestEvent{ctx.record.NewCustomEvent(event)}} } From 552ca6099ba141f11dd4afd4e8d697ea44706c96 Mon Sep 17 00:00:00 2001 From: Julio Guerra Date: Mon, 18 Feb 2019 17:42:06 +0100 Subject: [PATCH 05/25] agent/internal: rename package names into internal --- agent/internal/agent.go | 11 ++++++----- agent/internal/app/runtime.go | 4 ++-- agent/internal/backend/api/api.pb.go | 2 +- agent/internal/backend/api/jsonpb_test.go | 2 +- agent/internal/backend/client.go | 6 +++--- agent/internal/backend/client_test.go | 6 +++--- agent/internal/client.go | 10 +++++----- agent/internal/config/config.go | 2 +- agent/internal/metrics.go | 6 +++--- agent/internal/plog/plog_test.go | 2 +- agent/internal/request.go | 7 ++++--- agent/internal/version.go | 2 +- 12 files changed, 31 insertions(+), 29 deletions(-) diff --git a/agent/internal/agent.go b/agent/internal/agent.go index 064ae7c2..e50c0baf 100644 --- a/agent/internal/agent.go +++ b/agent/internal/agent.go @@ -1,4 +1,4 @@ -package agent +package internal import ( "context" @@ -6,10 +6,11 @@ import ( "sync" "time" - "github.com/sqreen/go-agent/agent/backend" - "github.com/sqreen/go-agent/agent/backend/api" - "github.com/sqreen/go-agent/agent/config" - "github.com/sqreen/go-agent/agent/plog" + "github.com/sqreen/go-agent/agent/internal/backend" + "github.com/sqreen/go-agent/agent/internal/backend/api" + "github.com/sqreen/go-agent/agent/internal/config" + "github.com/sqreen/go-agent/agent/internal/plog" + "github.com/sqreen/go-agent/agent/types" ) func init() { diff --git a/agent/internal/app/runtime.go b/agent/internal/app/runtime.go index 26d23744..a14ba441 100644 --- a/agent/internal/app/runtime.go +++ b/agent/internal/app/runtime.go @@ -10,8 +10,8 @@ import ( "time" "github.com/gogo/protobuf/proto" - "github.com/sqreen/go-agent/agent/backend/api" - "github.com/sqreen/go-agent/agent/plog" + "github.com/sqreen/go-agent/agent/internal/backend/api" + "github.com/sqreen/go-agent/agent/internal/plog" ) type Dependency struct { diff --git a/agent/internal/backend/api/api.pb.go b/agent/internal/backend/api/api.pb.go index 2bda044b..5fb1a2f7 100644 --- a/agent/internal/backend/api/api.pb.go +++ b/agent/internal/backend/api/api.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: agent/backend/api/api.proto +// source: agent/internal/backend/api/api.proto package api diff --git a/agent/internal/backend/api/jsonpb_test.go b/agent/internal/backend/api/jsonpb_test.go index 8406304b..c404666d 100644 --- a/agent/internal/backend/api/jsonpb_test.go +++ b/agent/internal/backend/api/jsonpb_test.go @@ -4,7 +4,7 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "github.com/sqreen/go-agent/agent/backend/api" + "github.com/sqreen/go-agent/agent/internal/backend/api" ) var _ = Describe("API", func() { diff --git a/agent/internal/backend/client.go b/agent/internal/backend/client.go index 81bf94b5..2c8c4398 100644 --- a/agent/internal/backend/client.go +++ b/agent/internal/backend/client.go @@ -10,9 +10,9 @@ import ( "github.com/gogo/protobuf/jsonpb" "github.com/gogo/protobuf/proto" - "github.com/sqreen/go-agent/agent/backend/api" - "github.com/sqreen/go-agent/agent/config" - "github.com/sqreen/go-agent/agent/plog" + "github.com/sqreen/go-agent/agent/internal/backend/api" + "github.com/sqreen/go-agent/agent/internal/config" + "github.com/sqreen/go-agent/agent/internal/plog" "golang.org/x/net/http/httpproxy" ) diff --git a/agent/internal/backend/client_test.go b/agent/internal/backend/client_test.go index d6dbb2b8..509b8b8b 100644 --- a/agent/internal/backend/client_test.go +++ b/agent/internal/backend/client_test.go @@ -13,9 +13,9 @@ import ( "github.com/gogo/protobuf/proto" . "github.com/onsi/gomega" "github.com/onsi/gomega/ghttp" - "github.com/sqreen/go-agent/agent/backend" - "github.com/sqreen/go-agent/agent/backend/api" - "github.com/sqreen/go-agent/agent/config" + "github.com/sqreen/go-agent/agent/internal/backend" + "github.com/sqreen/go-agent/agent/internal/backend/api" + "github.com/sqreen/go-agent/agent/internal/config" "github.com/sqreen/go-agent/tools/testlib" "github.com/stretchr/testify/require" ) diff --git a/agent/internal/client.go b/agent/internal/client.go index e677176b..e16a3940 100644 --- a/agent/internal/client.go +++ b/agent/internal/client.go @@ -1,4 +1,4 @@ -package agent +package internal import ( "context" @@ -6,10 +6,10 @@ import ( "strings" "time" - "github.com/sqreen/go-agent/agent/app" - "github.com/sqreen/go-agent/agent/backend" - "github.com/sqreen/go-agent/agent/backend/api" - "github.com/sqreen/go-agent/agent/config" + "github.com/sqreen/go-agent/agent/internal/app" + "github.com/sqreen/go-agent/agent/internal/backend" + "github.com/sqreen/go-agent/agent/internal/backend/api" + "github.com/sqreen/go-agent/agent/internal/config" ) var ( diff --git a/agent/internal/config/config.go b/agent/internal/config/config.go index 66f6101f..934a9066 100644 --- a/agent/internal/config/config.go +++ b/agent/internal/config/config.go @@ -13,7 +13,7 @@ import ( "strings" "time" - "github.com/sqreen/go-agent/agent/plog" + "github.com/sqreen/go-agent/agent/internal/plog" "github.com/spf13/viper" ) diff --git a/agent/internal/metrics.go b/agent/internal/metrics.go index 808f81dd..f60e1ff6 100644 --- a/agent/internal/metrics.go +++ b/agent/internal/metrics.go @@ -1,4 +1,4 @@ -package agent +package internal import ( "context" @@ -7,8 +7,8 @@ import ( "sync/atomic" "time" - "github.com/sqreen/go-agent/agent/backend/api" - "github.com/sqreen/go-agent/agent/config" + "github.com/sqreen/go-agent/agent/internal/backend/api" + "github.com/sqreen/go-agent/agent/internal/config" ) type metricsManager struct { diff --git a/agent/internal/plog/plog_test.go b/agent/internal/plog/plog_test.go index db7f7c2d..2f3ee2e5 100644 --- a/agent/internal/plog/plog_test.go +++ b/agent/internal/plog/plog_test.go @@ -8,7 +8,7 @@ import ( . "github.com/onsi/gomega" "github.com/onsi/gomega/gbytes" - "github.com/sqreen/go-agent/agent/plog" + "github.com/sqreen/go-agent/agent/internal/plog" ) var _ = Describe("plog", func() { diff --git a/agent/internal/request.go b/agent/internal/request.go index 908f293b..f451e012 100644 --- a/agent/internal/request.go +++ b/agent/internal/request.go @@ -1,4 +1,4 @@ -package agent +package internal import ( "encoding/hex" @@ -11,8 +11,9 @@ import ( "github.com/gogo/protobuf/proto" "github.com/google/uuid" - "github.com/sqreen/go-agent/agent/backend/api" - "github.com/sqreen/go-agent/agent/config" + "github.com/sqreen/go-agent/agent/internal/backend/api" + "github.com/sqreen/go-agent/agent/internal/config" + "github.com/sqreen/go-agent/agent/types" ) type HTTPRequestRecord struct { diff --git a/agent/internal/version.go b/agent/internal/version.go index 982402c4..5c99ceb8 100644 --- a/agent/internal/version.go +++ b/agent/internal/version.go @@ -1,3 +1,3 @@ -package agent +package internal const version = "0.1.0-beta.2" From e4b8c69ec44ca57be997c38af59a88c971d6236f Mon Sep 17 00:00:00 2001 From: Julio Guerra Date: Mon, 18 Feb 2019 18:06:04 +0100 Subject: [PATCH 06/25] agent/internal: implement the new interface expected by the SDK Simply adapt the existing internal agent API to the new one. Only renaming here. --- agent/internal/agent.go | 30 ++- agent/internal/backend/api/api.pb.go | 308 ++++++++++++++------------- agent/internal/request.go | 23 +- 3 files changed, 184 insertions(+), 177 deletions(-) diff --git a/agent/internal/agent.go b/agent/internal/agent.go index e50c0baf..44bf6b0b 100644 --- a/agent/internal/agent.go +++ b/agent/internal/agent.go @@ -2,6 +2,7 @@ package internal import ( "context" + "net/http" "os" "sync" "time" @@ -13,24 +14,31 @@ import ( "github.com/sqreen/go-agent/agent/types" ) -func init() { - start() +var ( + logger = plog.NewLogger("sqreen/agent") + eventMng *eventManager + metricsMng *metricsManager + cancel context.CancelFunc + isDone chan struct{} +) + +type Agent struct { +} + +func New() *Agent { + return &Agent{} } -func start() { +func (a *Agent) Start() { if config.Disable() { return } go agent() } -var ( - logger = plog.NewLogger("sqreen/agent") - eventMng *eventManager - metricsMng *metricsManager - cancel context.CancelFunc - isDone chan struct{} -) +func (a *Agent) NewRequestRecord(req *http.Request) types.RequestRecord { + return NewHTTPRequestRecord(req) +} func agent() { defer func() { @@ -119,7 +127,7 @@ func agent() { } } -func GracefulStop() { +func (_ *Agent) GracefulStop() { if config.Disable() { return } diff --git a/agent/internal/backend/api/api.pb.go b/agent/internal/backend/api/api.pb.go index 5fb1a2f7..da3d23f5 100644 --- a/agent/internal/backend/api/api.pb.go +++ b/agent/internal/backend/api/api.pb.go @@ -47,7 +47,7 @@ func (m *AppLoginRequest) Reset() { *m = AppLoginRequest{} } func (m *AppLoginRequest) String() string { return proto.CompactTextString(m) } func (*AppLoginRequest) ProtoMessage() {} func (*AppLoginRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_128e40d1f7699e73, []int{0} + return fileDescriptor_aa33db9090833f07, []int{0} } func (m *AppLoginRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AppLoginRequest.Unmarshal(m, b) @@ -85,7 +85,7 @@ func (m *AppLoginRequest_VariousInfos) Reset() { *m = AppLoginRequest_Va func (m *AppLoginRequest_VariousInfos) String() string { return proto.CompactTextString(m) } func (*AppLoginRequest_VariousInfos) ProtoMessage() {} func (*AppLoginRequest_VariousInfos) Descriptor() ([]byte, []int) { - return fileDescriptor_128e40d1f7699e73, []int{0, 0} + return fileDescriptor_aa33db9090833f07, []int{0, 0} } func (m *AppLoginRequest_VariousInfos) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AppLoginRequest_VariousInfos.Unmarshal(m, b) @@ -121,7 +121,7 @@ func (m *AppLoginResponse) Reset() { *m = AppLoginResponse{} } func (m *AppLoginResponse) String() string { return proto.CompactTextString(m) } func (*AppLoginResponse) ProtoMessage() {} func (*AppLoginResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_128e40d1f7699e73, []int{1} + return fileDescriptor_aa33db9090833f07, []int{1} } func (m *AppLoginResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AppLoginResponse.Unmarshal(m, b) @@ -154,7 +154,7 @@ func (m *AppLoginResponse_Feature) Reset() { *m = AppLoginResponse_Featu func (m *AppLoginResponse_Feature) String() string { return proto.CompactTextString(m) } func (*AppLoginResponse_Feature) ProtoMessage() {} func (*AppLoginResponse_Feature) Descriptor() ([]byte, []int) { - return fileDescriptor_128e40d1f7699e73, []int{1, 0} + return fileDescriptor_aa33db9090833f07, []int{1, 0} } func (m *AppLoginResponse_Feature) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AppLoginResponse_Feature.Unmarshal(m, b) @@ -187,7 +187,7 @@ func (m *CommandRequest) Reset() { *m = CommandRequest{} } func (m *CommandRequest) String() string { return proto.CompactTextString(m) } func (*CommandRequest) ProtoMessage() {} func (*CommandRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_128e40d1f7699e73, []int{2} + return fileDescriptor_aa33db9090833f07, []int{2} } func (m *CommandRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CommandRequest.Unmarshal(m, b) @@ -217,7 +217,7 @@ func (m *CommandResponse) Reset() { *m = CommandResponse{} } func (m *CommandResponse) String() string { return proto.CompactTextString(m) } func (*CommandResponse) ProtoMessage() {} func (*CommandResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_128e40d1f7699e73, []int{3} + return fileDescriptor_aa33db9090833f07, []int{3} } func (m *CommandResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CommandResponse.Unmarshal(m, b) @@ -251,7 +251,7 @@ func (m *MetricResponse) Reset() { *m = MetricResponse{} } func (m *MetricResponse) String() string { return proto.CompactTextString(m) } func (*MetricResponse) ProtoMessage() {} func (*MetricResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_128e40d1f7699e73, []int{4} + return fileDescriptor_aa33db9090833f07, []int{4} } func (m *MetricResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_MetricResponse.Unmarshal(m, b) @@ -283,7 +283,7 @@ func (m *AppBeatRequest) Reset() { *m = AppBeatRequest{} } func (m *AppBeatRequest) String() string { return proto.CompactTextString(m) } func (*AppBeatRequest) ProtoMessage() {} func (*AppBeatRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_128e40d1f7699e73, []int{5} + return fileDescriptor_aa33db9090833f07, []int{5} } func (m *AppBeatRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AppBeatRequest.Unmarshal(m, b) @@ -315,7 +315,7 @@ func (m *AppBeatResponse) Reset() { *m = AppBeatResponse{} } func (m *AppBeatResponse) String() string { return proto.CompactTextString(m) } func (*AppBeatResponse) ProtoMessage() {} func (*AppBeatResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_128e40d1f7699e73, []int{6} + return fileDescriptor_aa33db9090833f07, []int{6} } func (m *AppBeatResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AppBeatResponse.Unmarshal(m, b) @@ -346,7 +346,7 @@ func (m *BatchRequest) Reset() { *m = BatchRequest{} } func (m *BatchRequest) String() string { return proto.CompactTextString(m) } func (*BatchRequest) ProtoMessage() {} func (*BatchRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_128e40d1f7699e73, []int{7} + return fileDescriptor_aa33db9090833f07, []int{7} } func (m *BatchRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_BatchRequest.Unmarshal(m, b) @@ -378,7 +378,7 @@ func (m *BatchRequest_Event) Reset() { *m = BatchRequest_Event{} } func (m *BatchRequest_Event) String() string { return proto.CompactTextString(m) } func (*BatchRequest_Event) ProtoMessage() {} func (*BatchRequest_Event) Descriptor() ([]byte, []int) { - return fileDescriptor_128e40d1f7699e73, []int{7, 0} + return fileDescriptor_aa33db9090833f07, []int{7, 0} } func (m *BatchRequest_Event) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_BatchRequest_Event.Unmarshal(m, b) @@ -408,7 +408,7 @@ func (m *Rule) Reset() { *m = Rule{} } func (m *Rule) String() string { return proto.CompactTextString(m) } func (*Rule) ProtoMessage() {} func (*Rule) Descriptor() ([]byte, []int) { - return fileDescriptor_128e40d1f7699e73, []int{8} + return fileDescriptor_aa33db9090833f07, []int{8} } func (m *Rule) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Rule.Unmarshal(m, b) @@ -442,7 +442,7 @@ func (m *Dependency) Reset() { *m = Dependency{} } func (m *Dependency) String() string { return proto.CompactTextString(m) } func (*Dependency) ProtoMessage() {} func (*Dependency) Descriptor() ([]byte, []int) { - return fileDescriptor_128e40d1f7699e73, []int{9} + return fileDescriptor_aa33db9090833f07, []int{9} } func (m *Dependency) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Dependency.Unmarshal(m, b) @@ -474,7 +474,7 @@ func (m *Dependency_Source) Reset() { *m = Dependency_Source{} } func (m *Dependency_Source) String() string { return proto.CompactTextString(m) } func (*Dependency_Source) ProtoMessage() {} func (*Dependency_Source) Descriptor() ([]byte, []int) { - return fileDescriptor_128e40d1f7699e73, []int{9, 0} + return fileDescriptor_aa33db9090833f07, []int{9, 0} } func (m *Dependency_Source) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Dependency_Source.Unmarshal(m, b) @@ -510,7 +510,7 @@ func (m *RequestRecord) Reset() { *m = RequestRecord{} } func (m *RequestRecord) String() string { return proto.CompactTextString(m) } func (*RequestRecord) ProtoMessage() {} func (*RequestRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_128e40d1f7699e73, []int{10} + return fileDescriptor_aa33db9090833f07, []int{10} } func (m *RequestRecord) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RequestRecord.Unmarshal(m, b) @@ -553,7 +553,7 @@ func (m *RequestRecord_Request) Reset() { *m = RequestRecord_Request{} } func (m *RequestRecord_Request) String() string { return proto.CompactTextString(m) } func (*RequestRecord_Request) ProtoMessage() {} func (*RequestRecord_Request) Descriptor() ([]byte, []int) { - return fileDescriptor_128e40d1f7699e73, []int{10, 0} + return fileDescriptor_aa33db9090833f07, []int{10, 0} } func (m *RequestRecord_Request) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RequestRecord_Request.Unmarshal(m, b) @@ -585,7 +585,7 @@ func (m *RequestRecord_Request_Header) Reset() { *m = RequestRecord_Requ func (m *RequestRecord_Request_Header) String() string { return proto.CompactTextString(m) } func (*RequestRecord_Request_Header) ProtoMessage() {} func (*RequestRecord_Request_Header) Descriptor() ([]byte, []int) { - return fileDescriptor_128e40d1f7699e73, []int{10, 0, 0} + return fileDescriptor_aa33db9090833f07, []int{10, 0, 0} } func (m *RequestRecord_Request_Header) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RequestRecord_Request_Header.Unmarshal(m, b) @@ -615,7 +615,7 @@ func (m *RequestRecord_Request_Params) Reset() { *m = RequestRecord_Requ func (m *RequestRecord_Request_Params) String() string { return proto.CompactTextString(m) } func (*RequestRecord_Request_Params) ProtoMessage() {} func (*RequestRecord_Request_Params) Descriptor() ([]byte, []int) { - return fileDescriptor_128e40d1f7699e73, []int{10, 0, 1} + return fileDescriptor_aa33db9090833f07, []int{10, 0, 1} } func (m *RequestRecord_Request_Params) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RequestRecord_Request_Params.Unmarshal(m, b) @@ -648,7 +648,7 @@ func (m *RequestRecord_Response) Reset() { *m = RequestRecord_Response{} func (m *RequestRecord_Response) String() string { return proto.CompactTextString(m) } func (*RequestRecord_Response) ProtoMessage() {} func (*RequestRecord_Response) Descriptor() ([]byte, []int) { - return fileDescriptor_128e40d1f7699e73, []int{10, 1} + return fileDescriptor_aa33db9090833f07, []int{10, 1} } func (m *RequestRecord_Response) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RequestRecord_Response.Unmarshal(m, b) @@ -683,7 +683,7 @@ func (m *RequestRecord_Observed) Reset() { *m = RequestRecord_Observed{} func (m *RequestRecord_Observed) String() string { return proto.CompactTextString(m) } func (*RequestRecord_Observed) ProtoMessage() {} func (*RequestRecord_Observed) Descriptor() ([]byte, []int) { - return fileDescriptor_128e40d1f7699e73, []int{10, 2} + return fileDescriptor_aa33db9090833f07, []int{10, 2} } func (m *RequestRecord_Observed) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RequestRecord_Observed.Unmarshal(m, b) @@ -719,7 +719,7 @@ func (m *RequestRecord_Observed_Attack) Reset() { *m = RequestRecord_Obs func (m *RequestRecord_Observed_Attack) String() string { return proto.CompactTextString(m) } func (*RequestRecord_Observed_Attack) ProtoMessage() {} func (*RequestRecord_Observed_Attack) Descriptor() ([]byte, []int) { - return fileDescriptor_128e40d1f7699e73, []int{10, 2, 0} + return fileDescriptor_aa33db9090833f07, []int{10, 2, 0} } func (m *RequestRecord_Observed_Attack) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RequestRecord_Observed_Attack.Unmarshal(m, b) @@ -752,7 +752,7 @@ func (m *RequestRecord_Observed_SDKEvent) Reset() { *m = RequestRecord_O func (m *RequestRecord_Observed_SDKEvent) String() string { return proto.CompactTextString(m) } func (*RequestRecord_Observed_SDKEvent) ProtoMessage() {} func (*RequestRecord_Observed_SDKEvent) Descriptor() ([]byte, []int) { - return fileDescriptor_128e40d1f7699e73, []int{10, 2, 1} + return fileDescriptor_aa33db9090833f07, []int{10, 2, 1} } func (m *RequestRecord_Observed_SDKEvent) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RequestRecord_Observed_SDKEvent.Unmarshal(m, b) @@ -788,7 +788,7 @@ func (m *RequestRecord_Observed_SDKEvent_Args) Reset() { *m = RequestRec func (m *RequestRecord_Observed_SDKEvent_Args) String() string { return proto.CompactTextString(m) } func (*RequestRecord_Observed_SDKEvent_Args) ProtoMessage() {} func (*RequestRecord_Observed_SDKEvent_Args) Descriptor() ([]byte, []int) { - return fileDescriptor_128e40d1f7699e73, []int{10, 2, 1, 0} + return fileDescriptor_aa33db9090833f07, []int{10, 2, 1, 0} } func (m *RequestRecord_Observed_SDKEvent_Args) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RequestRecord_Observed_SDKEvent_Args.Unmarshal(m, b) @@ -941,7 +941,7 @@ func (m *RequestRecord_Observed_SDKEvent_Args_Track) String() string { } func (*RequestRecord_Observed_SDKEvent_Args_Track) ProtoMessage() {} func (*RequestRecord_Observed_SDKEvent_Args_Track) Descriptor() ([]byte, []int) { - return fileDescriptor_128e40d1f7699e73, []int{10, 2, 1, 0, 0} + return fileDescriptor_aa33db9090833f07, []int{10, 2, 1, 0, 0} } func (m *RequestRecord_Observed_SDKEvent_Args_Track) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RequestRecord_Observed_SDKEvent_Args_Track.Unmarshal(m, b) @@ -977,7 +977,7 @@ func (m *RequestRecord_Observed_SDKEvent_Args_Track_Options) String() string { } func (*RequestRecord_Observed_SDKEvent_Args_Track_Options) ProtoMessage() {} func (*RequestRecord_Observed_SDKEvent_Args_Track_Options) Descriptor() ([]byte, []int) { - return fileDescriptor_128e40d1f7699e73, []int{10, 2, 1, 0, 0, 0} + return fileDescriptor_aa33db9090833f07, []int{10, 2, 1, 0, 0, 0} } func (m *RequestRecord_Observed_SDKEvent_Args_Track_Options) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RequestRecord_Observed_SDKEvent_Args_Track_Options.Unmarshal(m, b) @@ -1014,7 +1014,7 @@ func (m *RequestRecord_Observed_SDKEvent_Args_Identify) String() string { } func (*RequestRecord_Observed_SDKEvent_Args_Identify) ProtoMessage() {} func (*RequestRecord_Observed_SDKEvent_Args_Identify) Descriptor() ([]byte, []int) { - return fileDescriptor_128e40d1f7699e73, []int{10, 2, 1, 0, 1} + return fileDescriptor_aa33db9090833f07, []int{10, 2, 1, 0, 1} } func (m *RequestRecord_Observed_SDKEvent_Args_Identify) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RequestRecord_Observed_SDKEvent_Args_Identify.Unmarshal(m, b) @@ -1051,7 +1051,7 @@ func (m *RequestRecord_Observed_Exception) Reset() { *m = RequestRecord_ func (m *RequestRecord_Observed_Exception) String() string { return proto.CompactTextString(m) } func (*RequestRecord_Observed_Exception) ProtoMessage() {} func (*RequestRecord_Observed_Exception) Descriptor() ([]byte, []int) { - return fileDescriptor_128e40d1f7699e73, []int{10, 2, 2} + return fileDescriptor_aa33db9090833f07, []int{10, 2, 2} } func (m *RequestRecord_Observed_Exception) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RequestRecord_Observed_Exception.Unmarshal(m, b) @@ -1085,7 +1085,7 @@ func (m *RequestRecord_Observed_Observation) Reset() { *m = RequestRecor func (m *RequestRecord_Observed_Observation) String() string { return proto.CompactTextString(m) } func (*RequestRecord_Observed_Observation) ProtoMessage() {} func (*RequestRecord_Observed_Observation) Descriptor() ([]byte, []int) { - return fileDescriptor_128e40d1f7699e73, []int{10, 2, 3} + return fileDescriptor_aa33db9090833f07, []int{10, 2, 3} } func (m *RequestRecord_Observed_Observation) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RequestRecord_Observed_Observation.Unmarshal(m, b) @@ -1119,7 +1119,7 @@ func (m *RequestRecord_Observed_DataPoint) Reset() { *m = RequestRecord_ func (m *RequestRecord_Observed_DataPoint) String() string { return proto.CompactTextString(m) } func (*RequestRecord_Observed_DataPoint) ProtoMessage() {} func (*RequestRecord_Observed_DataPoint) Descriptor() ([]byte, []int) { - return fileDescriptor_128e40d1f7699e73, []int{10, 2, 4} + return fileDescriptor_aa33db9090833f07, []int{10, 2, 4} } func (m *RequestRecord_Observed_DataPoint) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_RequestRecord_Observed_DataPoint.Unmarshal(m, b) @@ -1172,130 +1172,132 @@ func init() { proto.RegisterType((*RequestRecord_Observed_DataPoint)(nil), "sqreen.agent.backend.api.RequestRecord.Observed.DataPoint") } -func init() { proto.RegisterFile("agent/backend/api/api.proto", fileDescriptor_128e40d1f7699e73) } - -var fileDescriptor_128e40d1f7699e73 = []byte{ - // 1907 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0x4f, 0x6f, 0x24, 0x47, - 0x15, 0x77, 0x7b, 0xfe, 0xf5, 0xbc, 0xf1, 0xd8, 0xde, 0x22, 0x62, 0x87, 0x4e, 0x58, 0x2f, 0x83, - 0x22, 0x36, 0x04, 0xda, 0x91, 0x23, 0x2d, 0xc1, 0x0a, 0x20, 0xcf, 0x7a, 0xc1, 0x43, 0x96, 0xac, - 0x69, 0x5b, 0x2b, 0x14, 0x90, 0x86, 0x9a, 0xee, 0xf2, 0x4c,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da, 0x82, 0x47, 0x71, 0xea, - 0x7a, 0xc4, 0x74, 0x73, 0xbf, 0x06, 0xe7, 0x43, 0xa3, 0x67, 0x39, 0x2d, 0x8f, 0xf7, 0xdf, 0x0a, - 0x34, 0x6c, 0x82, 0x6c, 0x43, 0x85, 0x17, 0x0d, 0x5d, 0x2d, 0xc9, 0x23, 0x68, 0x8c, 0x19, 0x8d, - 0x18, 0xb7, 0x25, 0xe7, 0xee, 0x35, 0xcd, 0xe2, 0x1f, 0xa1, 0xba, 0xb5, 0x8e, 0x21, 0x53, 0x91, - 0x32, 0x67, 0x7c, 0x68, 0xbb, 0x8b, 0x5a, 0xe3, 0x78, 0x43, 0xe5, 0xd8, 0x8c, 0x93, 0xb8, 0x26, - 0x5f, 0x02, 0x97, 0xd3, 0xc7, 0x03, 0xc4, 0x75, 0x47, 0x6e, 0x70, 0xfa, 0xf8, 0x58, 0x7d, 0x22, - 0x50, 0x55, 0x83, 0xa3, 0x19, 0x22, 0x71, 0x8d, 0x14, 0x29, 0x97, 0x66, 0x70, 0xc4, 0x35, 0x79, - 0x15, 0x9a, 0x3a, 0xe2, 0x54, 0x14, 0xe8, 0x59, 0xd1, 0xd5, 0x40, 0x3f, 0x23, 0x3b, 0xd0, 0x32, - 0x1f, 0x51, 0x4f, 0x4f, 0x3e, 0xa0, 0xa1, 0x63, 0xa5, 0xad, 0x8a, 0x4b, 0x38, 0x66, 0x33, 0x66, - 0x86, 0x42, 0x23, 0xa9, 0xc4, 0xcf, 0x05, 0xe3, 0x03, 0x34, 0x83, 0x99, 0x04, 0x9b, 0x0a, 0x39, - 0x50, 0x80, 0x8e, 0xfa, 0x33, 0xc6, 0x19, 0xef, 0x6c, 0x98, 0x6b, 0x6b, 0x91, 0x9c, 0x16, 0xfd, - 0xb6, 0xfd, 0x59, 0x83, 0xfb, 0xe5, 0x06, 0x3d, 0x46, 0x6d, 0x63, 0x50, 0xc3, 0xe5, 0xbd, 0x05, - 0x75, 0x6d, 0xe8, 0x4b,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, 0xa7, 0xb7, 0x9c, 0xff, 0x3c, 0xbd, 0xe5, 0x7c, 0x50, 0xa1, 0x59, - 0x3c, 0xac, 0x23, 0xd9, 0xdb, 0xff, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x8f, 0x4e, 0x03, 0xe9, 0x73, - 0x15, 0x00, 0x00, +func init() { + proto.RegisterFile("agent/internal/backend/api/api.proto", fileDescriptor_aa33db9090833f07) +} + +var fileDescriptor_aa33db9090833f07 = []byte{ + // 1914 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0x4f, 0x6f, 0x23, 0x49, + 0x15, 0x4f, 0xc7, 0xff, 0xda, 0xcf, 0x71, 0x92, 0x29, 0x56, 0x8c, 0x69, 0x96, 0xc9, 0x60, 0x58, + 0x31, 0xcb, 0x42, 0x67, 0x95, 0x95, 0x86, 0x25, 0x5a, 0x40, 0xf1, 0x64, 0x20, 0x66, 0x87, 0x9d, + 0xd0, 0x89, 0x46, 0x68, 0x41, 0x32, 0xe5, 0xee, 0x8a, 0xdd, 0xb2, 0xdd, 0xdd, 0x5b, 0x55, 0xed, + 0x99, 0xec, 0x57, 0xe0, 0x82, 0xc4, 0x11, 0x09, 0x71, 0x02, 0x24, 0x4e, 0x1c, 0x90, 0xb8, 0x20, + 0xae, 0x7b, 0xe2, 0xc2, 0x6d, 0x0f, 0x41, 0x73, 0x83, 0xfd, 0x04, 0xdc, 0x40, 0xf5, 0xaa, 0xaa, + 0xdd, 0x1e, 0xe2, 0xd9, 0x64, 0x66, 0x0f, 0x91, 0xea, 0xfd, 0xba, 0xde, 0xaf, 0xaa, 0xde, 0x7f, + 0x07, 0xbe, 0x4a, 0x47, 0x2c, 0x91, 0xbb, 0x71, 0x22, 0x19, 0x4f, 0xe8, 0x74, 0x77, 0x48, 0xc3, + 0x09, 0x4b, 0xa2, 0x5d, 0x9a, 0xc5, 0xea, 0xcf, 0xcf,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, 0x8e, 0x14, 0x9b, 0xda, 0xd6, 0xd0, 0x6c, 0xb9, 0x46, 0xd4, 0x26, 0x57, + 0x23, 0x23, 0xad, 0x87, 0x6e, 0xd1, 0x86, 0xc2, 0x75, 0xf7, 0x2f, 0x15, 0xd8, 0x5e, 0x04, 0x90, + 0xc8, 0xd2, 0x44, 0x30, 0x15, 0x20, 0x82, 0x09, 0x65, 0x92, 0x41, 0x1c, 0x99, 0x40, 0x6d, 0x1a, + 0xa4, 0x1f, 0x91, 0xcf, 0x43, 0x5d, 0x48, 0x2a, 0x73, 0x1d, 0x9b, 0x6e, 0x60, 0x24, 0xf2, 0x43, + 0x70, 0xc3, 0x74, 0x36, 0xa3, 0x49, 0x24, 0x3a, 0x95, 0xdb, 0x95, 0x3b, 0xad, 0xbd, 0x3b, 0xab, + 0xa3, 0xf6, 0x9e, 0xde, 0x69, 0x82, 0xd6, 0xc4, 0x69, 0xa1, 0x4f, 0x4e, 0xc1, 0x3d, 0x63, 0x98, + 0x11, 0x02, 0xed, 0xd1, 0xda, 0xdb, 0xbb, 0x4a, 0x06, 0xe8, 0x07, 0xf8, 0xdf, 0xd7, 0xaa, 0x96, + 0xd5, 0x32, 0xa9, 0xa8, 0xcd, 0x68, 0x38, 0x19, 0x18, 0x83, 0x36, 0x83, 0xba, 0x12, 0xfb, 0x11, + 0xd9, 0x87, 0x1a, 0xcf, 0xa7, 0x4c, 0x74, 0xea, 0x78, 0xef, 0x5b, 0xab, 0xcf, 0x0a, 0xf2, 0xa9, + 0xe5, 0xd5, 0x2a, 0xde, 0x1c, 0x1a, 0xe6, 0x3c, 0x65, 0xb8, 0x21, 0x95, 0xe1, 0x78, 0x20, 0xe2, + 0x0f, 0x75, 0x4c, 0xb4, 0x83, 0x26, 0x22, 0x27, 0xf1, 0x87, 0x98, 0x59, 0x33, 0xfa, 0x64, 0x20, + 0x24, 0x9d, 0xb2, 0x84, 0x09, 0x6d, 0xbf, 0x76, 0xb0, 0x31, 0xa3, 0x4f, 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xd9, 0x3f, 0x40, 0xfd, 0xc0, 0xf2, 0x90, 0x77, 0xa1, + 0x22, 0xa2, 0x89, 0x89, 0xd6, 0x6f, 0x5f, 0x9b, 0xee, 0xe4, 0xf0, 0x5d, 0xac, 0xec, 0x81, 0x62, + 0x21, 0x23, 0xb8, 0xa1, 0x09, 0x06, 0xec, 0x49, 0xc8, 0x32, 0x35, 0x05, 0xd8, 0xd1, 0x75, 0xff, + 0xda, 0xd4, 0xf7, 0x2d, 0x45, 0xb0, 0xad, 0x55, 0x0b, 0x40, 0x90, 0x9f, 0xc3, 0x46, 0x69, 0xd2, + 0x50, 0x23, 0xed, 0xa7, 0x0c, 0x11, 0x2b, 0xce, 0x78, 0xb8, 0x20, 0x09, 0x96, 0x18, 0xc9, 0x4f, + 0xa1, 0x15, 0x51, 0x49, 0x07, 0x59, 0x1a, 0x27, 0x52, 0x74, 0x6a, 0x2f, 0xf8, 0x88, 0x43, 0x2a, + 0xe9, 0xb1, 0xa2, 0x08, 0x20, 0xb2, 0x4b, 0xe1, 0xfd, 0xd5, 0x81, 0xba, 0x76, 0x04, 0xa6, 0x5b, + 0x3e, 0x65, 0x83, 0x52, 0x23, 0x70, 0x15, 0xf0, 0x9e, 0x6a, 0x06, 0x04, 0xaa, 0x52, 0x95, 0x58, + 0xdd, 0xa8, 0x71, 0xad, 0xc2, 0x53, 0xff, 0x90, 0xd5, 0xc1, 0xa2, 0x05, 0xf2, 0x2a, 0x34, 0xd5, + 0x6d, 0x24, 0xa7, 0xd8, 0x9c, 0x54, 0xe3, 0x58, 0x00, 0xc5, 0xaf, 0xaa, 0xda, 0xb5, 0x7f, 0x55, + 0xbd, 0x02, 0xb5, 0xe1, 0x34, 0x0d, 0x27, 0x58, 0x36, 0xdc, 0x40, 0x0b, 0xde, 0xaf, 0xea, 0xe0, + 0x5a, 0xcf, 0xbf, 0xc4, 0x4f, 0x36, 0xdb, 0xff, 0xd6, 0x4b, 0xfd, 0xef, 0x27, 0x50, 0xa5, 0x7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 0xb9, 0xda, 0x0c, 0xb4, 0xb0, 0x5c, 0x08, 0x2a, 0x2b, 0x0a, + 0x41, 0xf5, 0xb2, 0x42, 0x50, 0x5b, 0x59, 0x08, 0xea, 0xab, 0x0a, 0x41, 0xe3, 0xba, 0xb9, 0xea, + 0xfd, 0xc2, 0x81, 0x56, 0xa9, 0x5a, 0xaa, 0x31, 0x39, 0xa4, 0x92, 0x8d, 0x52, 0x6e, 0x9b, 0x67, + 0x21, 0xdb, 0x9e, 0xba, 0x7e, 0x49, 0x4f, 0xad, 0x94, 0x7a, 0x6a, 0x71, 0x9b, 0xea, 0xb5, 0x6f, + 0xf3, 0x6b, 0x07, 0x9a, 0x45, 0x69, 0xd5, 0xff, 0x07, 0x2b, 0x4d, 0xbb, 0x8e, 0xfd, 0x3f, 0xd8, + 0x62, 0xb6, 0x5d, 0xb2, 0xee, 0xfa, 0x33, 0xd6, 0xb5, 0xf7, 0xa8, 0xbc, 0x48, 0x79, 0xd4, 0x3e, + 0xa8, 0x96, 0x7c, 0xd0, 0xbb, 0xf1, 0xd1, 0xd3, 0x5b, 0x6b, 0xff, 0x7a, 0x7a, 0xcb, 0xf9, 0xcf, + 0xd3, 0x5b, 0xce, 0xfb, 0x15, 0x9a, 0xc5, 0xc3, 0x3a, 0x92, 0xbd, 0xf5, 0xbf, 0x00, 0x00, 0x00, + 0xff, 0xff, 0x34, 0x53, 0xc3, 0x57, 0x7c, 0x15, 0x00, 0x00, } type AppLoginRequestFace interface { diff --git a/agent/internal/request.go b/agent/internal/request.go index f451e012..457e8906 100644 --- a/agent/internal/request.go +++ b/agent/internal/request.go @@ -109,7 +109,7 @@ const ( sdkMethodTrack = "track" ) -func (ctx *HTTPRequestRecord) TrackEvent(event string) *HTTPRequestEvent { +func (ctx *HTTPRequestRecord) NewCustomEvent(event string) types.CustomEvent { evt := &HTTPRequestEvent{ method: sdkMethodTrack, event: event, @@ -119,7 +119,7 @@ func (ctx *HTTPRequestRecord) TrackEvent(event string) *HTTPRequestEvent { return evt } -func (ctx *HTTPRequestRecord) TrackIdentify(id EventUserIdentifiersMap) { +func (ctx *HTTPRequestRecord) Identify(id map[string]string) { ctx.identifyOnce.Do(func() { evt := &HTTPRequestEvent{ method: sdkMethodIdentify, @@ -130,7 +130,7 @@ func (ctx *HTTPRequestRecord) TrackIdentify(id EventUserIdentifiersMap) { }) } -func (ctx *HTTPRequestRecord) TrackAuth(loginSuccess bool, id EventUserIdentifiersMap) { +func (ctx *HTTPRequestRecord) NewUserAuth(id map[string]string, loginSuccess bool) { if len(id) == 0 { logger.Warn("TrackAuth(): user id is nil or empty") return @@ -147,7 +147,7 @@ func (ctx *HTTPRequestRecord) TrackAuth(loginSuccess bool, id EventUserIdentifie ctx.addUserEvent(event) } -func (ctx *HTTPRequestRecord) TrackSignup(id EventUserIdentifiersMap) { +func (ctx *HTTPRequestRecord) NewUserSignup(id map[string]string) { if len(id) == 0 { logger.Warn("TrackSignup(): user id is nil or empty") return @@ -177,28 +177,25 @@ func (ctx *HTTPRequestRecord) addUserEvent(event userEventFace) { addUserEvent(event) } -func (e *HTTPRequestEvent) WithTimestamp(t time.Time) *HTTPRequestEvent { +func (e *HTTPRequestEvent) WithTimestamp(t time.Time) { if e == nil { - return nil + return } e.timestamp = t - return e } -func (e *HTTPRequestEvent) WithProperties(p EventPropertyMap) *HTTPRequestEvent { +func (e *HTTPRequestEvent) WithProperties(p map[string]string) { if e == nil { - return nil + return } e.properties = p - return e } -func (e *HTTPRequestEvent) WithUserIdentifier(id EventUserIdentifiersMap) *HTTPRequestEvent { +func (e *HTTPRequestEvent) WithUserIdentifiers(id map[string]string) { if e == nil { - return nil + return } e.userIdentifiers = id - return e } func (e *HTTPRequestEvent) GetTime() time.Time { From 7f1e24a4cf16928b4f5d81e5379a1883fac3af9a Mon Sep 17 00:00:00 2001 From: Julio Guerra Date: Wed, 20 Feb 2019 10:24:18 +0100 Subject: [PATCH 07/25] agent: move globals into struct members In order to be able to properly quit, restart or stop the agent, remove every global variable. Now store them as structure members, whose life-cycle is derived from the agent's: when the agent is initialized/deinitialization, he is now responsible of each data initialization/deinitialization, and the same applies to sub-layers of the agent. Another benefit will be better testing, as every dependency is now exposed in the interfaces. --- agent/agent.go | 4 +- agent/internal/agent.go | 122 ++++++++++++++------------ agent/internal/app/runtime.go | 67 ++++++++------ agent/internal/backend/client.go | 12 +-- agent/internal/backend/client_test.go | 17 ++-- agent/internal/client.go | 9 +- agent/internal/config/config.go | 46 +++++----- agent/internal/config/config_test.go | 42 +++++---- agent/internal/metrics.go | 34 +++---- agent/internal/plog/plog.go | 13 ++- agent/internal/plog/plog_test.go | 2 +- agent/internal/request.go | 26 +++--- 12 files changed, 221 insertions(+), 173 deletions(-) diff --git a/agent/agent.go b/agent/agent.go index ae3be06d..f4d1d52f 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -10,5 +10,7 @@ var agent *internal.Agent func init() { agent = internal.New() sdk.SetAgent(agent) - agent.Start() + if agent != nil { + agent.Start() + } } diff --git a/agent/internal/agent.go b/agent/internal/agent.go index 44bf6b0b..375e95e2 100644 --- a/agent/internal/agent.go +++ b/agent/internal/agent.go @@ -7,6 +7,7 @@ import ( "sync" "time" + "github.com/sqreen/go-agent/agent/internal/app" "github.com/sqreen/go-agent/agent/internal/backend" "github.com/sqreen/go-agent/agent/internal/backend/api" "github.com/sqreen/go-agent/agent/internal/config" @@ -14,61 +15,72 @@ import ( "github.com/sqreen/go-agent/agent/types" ) -var ( - logger = plog.NewLogger("sqreen/agent") +type Agent struct { + logger *plog.Logger eventMng *eventManager metricsMng *metricsManager + ctx context.Context cancel context.CancelFunc isDone chan struct{} -) - -type Agent struct { + config *config.Config + appInfo *app.Info } func New() *Agent { - return &Agent{} + logger := plog.NewLogger("agent", nil) + + cfg := config.New(logger) + + if cfg.Disable() { + return nil + } + + // Agent graceful stopping using context cancelation. + ctx, cancel := context.WithCancel(context.Background()) + + return &Agent{ + logger: logger, + isDone: make(chan struct{}), + metricsMng: newMetricsManager(ctx, logger), + ctx: ctx, + cancel: cancel, + config: cfg, + appInfo: app.NewInfo(logger), + } } func (a *Agent) Start() { - if config.Disable() { - return - } - go agent() + go a.start() } func (a *Agent) NewRequestRecord(req *http.Request) types.RequestRecord { - return NewHTTPRequestRecord(req) -} + return a.newHTTPRequestRecord(req) -func agent() { +} +func (a *Agent) start() { defer func() { err := recover() if err != nil { - logger.Error("agent stopped: ", err) + a.logger.Error("agent stopped: ", err) } else { - logger.Info("agent successfully stopped") + a.logger.Info("agent successfully stopped") } // Signal we are done - close(isDone) + close(a.isDone) }() - plog.SetLevelFromString(config.LogLevel()) + plog.SetLevelFromString(a.config.LogLevel()) plog.SetOutput(os.Stderr) - // Agent stopping using context cancelation externally called through the SDK. - var ctx context.Context - ctx, cancel = context.WithCancel(context.Background()) - isDone = make(chan struct{}) - - client, err := backend.NewClient(config.BackendHTTPAPIBaseURL()) - if checkErr(err) { + client, err := backend.NewClient(a.config.BackendHTTPAPIBaseURL(), a.config, a.logger) + if checkErr(err, a.logger) { return } - token := config.BackendHTTPAPIToken() - appName := config.AppName() - appLoginRes, err := appLogin(ctx, client, token, appName) - if checkErr(err) { + token := a.config.BackendHTTPAPIToken() + appName := a.config.AppName() + appLoginRes, err := appLogin(a.ctx, a.logger, client, token, appName, a.appInfo) + if checkErr(err, a.logger) { return } @@ -77,7 +89,7 @@ func agent() { heartbeat = config.BackendHTTPAPIDefaultHeartbeatDelay } - logger.Info("up and running - heartbeat set to ", heartbeat) + a.logger.Info("up and running - heartbeat set to ", heartbeat) ticker := time.Tick(heartbeat) sessionID := appLoginRes.SessionId rulespackId := appLoginRes.PackId @@ -90,52 +102,51 @@ func agent() { maxStaleness = config.EventBatchMaxStaleness } - eventMng = newEventManager(rulespackId, batchSize, maxStaleness) // Start the event manager's loop - go eventMng.Loop(ctx, client, sessionID) - - metricsMng = newMetricsManager(ctx) + a.eventMng = newEventManager(a, rulespackId, batchSize, maxStaleness) + go a.eventMng.Loop(a.ctx, client, sessionID) // Start the heartbeat's loop for { select { case <-ticker: - logger.Debug("heartbeat") + a.logger.Debug("heartbeat") - metrics := metricsMng.getObservations() + metrics := a.metricsMng.getObservations() appBeatReq := api.AppBeatRequest{ Metrics: metrics, } _, err := client.AppBeat(&appBeatReq, sessionID) if err != nil { - logger.Error("heartbeat failed: ", err) + a.logger.Error("heartbeat failed: ", err) continue } - case <-ctx.Done(): + case <-a.ctx.Done(): // The context was canceled because of a interrupt signal, logout and // return. err := client.AppLogout(sessionID) if err != nil { - logger.Error("logout failed: ", err) + a.logger.Error("logout failed: ", err) return } - logger.Debug("successfully logged out") + a.logger.Debug("successfully logged out") return } } } -func (_ *Agent) GracefulStop() { - if config.Disable() { +func (a *Agent) GracefulStop() { + if a.config.Disable() { return } - cancel() - <-isDone + a.cancel() + <-a.isDone } type eventManager struct { + agent *Agent req api.BatchRequest rulespackID string count int @@ -144,8 +155,9 @@ type eventManager struct { maxStaleness time.Duration } -func newEventManager(rulespackID string, count int, maxStaleness time.Duration) *eventManager { +func newEventManager(agent *Agent, rulespackID string, count int, maxStaleness time.Duration) *eventManager { return &eventManager{ + agent: agent, eventsChan: make(chan (*httpRequestRecord), count), count: count, rulespackID: rulespackID, @@ -159,7 +171,7 @@ func (m *eventManager) add(r *httpRequestRecord) { return default: // The channel buffer is full - drop this new event - logger.Debug("event channel is full, dropping the event") + m.agent.logger.Debug("event channel is full, dropping the event") } } @@ -170,7 +182,7 @@ func (m *eventManager) Loop(ctx context.Context, client *backend.Client, session case <-ctx.Done(): return case event := <-m.eventsChan: - logger.Debug("new event") + m.agent.logger.Debug("new event") event.SetRulespackId(m.rulespackID) m.reqLock.Lock() m.req.Batch = append(m.req.Batch, api.BatchRequest_Event{ @@ -183,19 +195,19 @@ func (m *eventManager) Loop(ctx context.Context, client *backend.Client, session // First event of this batch. // Given the amount of external events, it is easier to create a // goroutine to select{} one of them. - logger.Debug("batching event data for ", m.maxStaleness) + m.agent.logger.Debug("batching event data for ", m.maxStaleness) isFull = make(chan struct{}) isSent = make(chan struct{}, 1) go func() { select { case <-ctx.Done(): case <-time.After(m.maxStaleness): - logger.Debug("event batch data staleness reached") + m.agent.logger.Debug("event batch data staleness reached") case <-isFull: - logger.Debug("event batch is full") + m.agent.logger.Debug("event batch is full") } m.send(client, sessionID) - logger.Debug("event batch sent") + m.agent.logger.Debug("event batch sent") close(isSent) }() } else if batchLen >= m.count { @@ -216,23 +228,23 @@ func (m *eventManager) send(client *backend.Client, sessionID string) { defer m.reqLock.Unlock() // Send the batch. if err := client.Batch(&m.req, sessionID); err != nil { - logger.Error("could not send an event batch: ", err) + m.agent.logger.Error("could not send an event batch: ", err) // drop it } m.req.Batch = m.req.Batch[0:0] } -func addTrackEvent(r *httpRequestRecord) { - if config.Disable() || eventMng == nil { +func (a *Agent) addTrackEvent(r *httpRequestRecord) { + if a.config.Disable() || a.eventMng == nil { // Disabled or not yet initialized agent return } - eventMng.add(r) + a.eventMng.add(r) } // Helper function returning true when having to exit the agent and panic-ing // when the error is something else than context cancelation. -func checkErr(err error) (exit bool) { +func checkErr(err error, logger *plog.Logger) (exit bool) { if err != nil { if err != context.Canceled { logger.Panic(err) diff --git a/agent/internal/app/runtime.go b/agent/internal/app/runtime.go index a14ba441..4914483f 100644 --- a/agent/internal/app/runtime.go +++ b/agent/internal/app/runtime.go @@ -14,10 +14,32 @@ import ( "github.com/sqreen/go-agent/agent/internal/plog" ) -type Dependency struct { +type Info struct { + logger *plog.Logger + hostname string + processInfo ProcessInfo +} + +func NewInfo(logger *plog.Logger) *Info { + logger = plog.NewLogger("app/info", logger) + return &Info{ + logger: logger, + processInfo: ProcessInfo{ + name: executable(logger), + time: time.Now(), + pid: uint32(os.Getpid()), + ppid: uint32(os.Getppid()), + euid: uint32(os.Geteuid()), + egid: uint32(os.Getegid()), + uid: uint32(os.Getuid()), + gid: uint32(os.Getgid()), + }, + } + } -var logger = plog.NewLogger("agent/app") +type Dependency struct { +} type ProcessInfo struct { name string @@ -25,19 +47,8 @@ type ProcessInfo struct { pid, ppid, euid, egid, uid, gid uint32 } -var processInfo = ProcessInfo{ - name: executable(), - time: time.Now(), - pid: uint32(os.Getpid()), - ppid: uint32(os.Getppid()), - euid: uint32(os.Geteuid()), - egid: uint32(os.Getegid()), - uid: uint32(os.Getuid()), - gid: uint32(os.Getgid()), -} - -func GetProcessInfo() *ProcessInfo { - return &processInfo +func (i *Info) GetProcessInfo() *ProcessInfo { + return &i.processInfo } func (p *ProcessInfo) GetName() string { @@ -86,24 +97,22 @@ func GoBuildTarget() string { return goBuildTarget } -var hostname string - -func Hostname() string { - if hostname == "" { +func (a *Info) Hostname() string { + if a.hostname == "" { var err error - hostname, err = os.Hostname() + a.hostname, err = os.Hostname() if err != nil { - logger.Error(err) - hostname = "" + a.logger.Error(err) + a.hostname = "" } } - return hostname + return a.hostname } -func Dependencies() ([]*Dependency, error) { - executable := processInfo.GetName() +func (i *Info) Dependencies() ([]*Dependency, error) { + executable := i.processInfo.GetName() - logger.Debug("reading ELF file ", executable) + i.logger.Debug("reading ELF file ", executable) exe, err := elf.Open(executable) if err != nil { return nil, err @@ -114,7 +123,7 @@ func Dependencies() ([]*Dependency, error) { if sec := exe.Section(".gopclntab"); sec != nil { pclndat, err = sec.Data() if err != nil { - logger.Error("cannot read .gopclntab section: ", err) + i.logger.Error("cannot read .gopclntab section: ", err) return nil, err } } @@ -127,7 +136,7 @@ func Dependencies() ([]*Dependency, error) { pcln := gosym.NewLineTable(pclndat, exe.Section(".text").Addr) symTab, err := gosym.NewTable(symTabRaw, pcln) if err != nil { - logger.Error("cannot create the Go synbol table: ", err) + i.logger.Error("cannot create the Go synbol table: ", err) return nil, err } @@ -181,7 +190,7 @@ func packageName(symbol string) string { return symbol[:pathend+i] } -func executable() string { +func executable(logger *plog.Logger) string { name, err := os.Executable() if err != nil { logger.Error("could not read the executable name ", err) diff --git a/agent/internal/backend/client.go b/agent/internal/backend/client.go index 2c8c4398..678a2634 100644 --- a/agent/internal/backend/client.go +++ b/agent/internal/backend/client.go @@ -16,17 +16,16 @@ import ( "golang.org/x/net/http/httpproxy" ) -var logger = plog.NewLogger("agent/backend") - type Client struct { client *http.Client backendURL string pbMarshaler jsonpb.Marshaler + logger *plog.Logger } -func NewClient(backendURL string) (*Client, error) { +func NewClient(backendURL string, cfg *config.Config, logger *plog.Logger) (*Client, error) { var transport *http.Transport - if proxySettings := config.BackendHTTPAPIProxy(); proxySettings == "" { + if proxySettings := cfg.BackendHTTPAPIProxy(); proxySettings == "" { // No user settings. The default transport uses standard global proxy // settings *_PROXY environment variables. logger.Info("using proxy settings as indicated by the environment variables HTTP_PROXY, HTTPS_PROXY and NO_PROXY (or the lowercase versions)") @@ -54,6 +53,7 @@ func NewClient(backendURL string) (*Client, error) { }, backendURL: backendURL, pbMarshaler: api.DefaultJSONPBMarshaler, + logger: plog.NewLogger("client", logger), } return client, nil @@ -125,7 +125,7 @@ func (c *Client) Do(req *http.Request, pbs ...proto.Message) error { req.ContentLength = int64(buf.Len()) dumpReq, _ := httputil.DumpRequestOut(req, true) - logger.Debugf("sending request\n%s", dumpReq) + c.logger.Debugf("sending request\n%s", dumpReq) res, err := c.client.Do(req) if err != nil { @@ -133,7 +133,7 @@ func (c *Client) Do(req *http.Request, pbs ...proto.Message) error { } dumpRes, _ := httputil.DumpResponse(res, true) - logger.Debugf("received response\n%s", dumpRes) + c.logger.Debugf("received response\n%s", dumpRes) // As documented (https://golang.org/pkg/net/http/#Response), connections are // reused iif the response body was fully drained. The following chunk thus diff --git a/agent/internal/backend/client_test.go b/agent/internal/backend/client_test.go index 509b8b8b..5ec3cc59 100644 --- a/agent/internal/backend/client_test.go +++ b/agent/internal/backend/client_test.go @@ -16,13 +16,16 @@ import ( "github.com/sqreen/go-agent/agent/internal/backend" "github.com/sqreen/go-agent/agent/internal/backend/api" "github.com/sqreen/go-agent/agent/internal/config" + "github.com/sqreen/go-agent/agent/internal/plog" "github.com/sqreen/go-agent/tools/testlib" "github.com/stretchr/testify/require" ) var ( - seed = time.Now().UnixNano() - popr = math_rand.New(math_rand.NewSource(seed)) + logger = plog.NewLogger("test", nil) + cfg = config.New(logger) + seed = time.Now().UnixNano() + popr = math_rand.New(math_rand.NewSource(seed)) ) func TestClient(t *testing.T) { @@ -53,7 +56,7 @@ func TestClient(t *testing.T) { server := initFakeServer(endpointCfg, request, response, statusCode, headers) defer server.Close() - client, err := backend.NewClient(server.URL()) + client, err := backend.NewClient(server.URL(), cfg, logger) g.Expect(err).NotTo(HaveOccurred()) res, err := client.AppLogin(request, token, appName) @@ -85,7 +88,7 @@ func TestClient(t *testing.T) { server := initFakeServer(endpointCfg, request, response, statusCode, headers) defer server.Close() - client, err := backend.NewClient(server.URL()) + client, err := backend.NewClient(server.URL(), cfg, logger) g.Expect(err).NotTo(HaveOccurred()) res, err := client.AppBeat(request, session) @@ -114,7 +117,7 @@ func TestClient(t *testing.T) { server := initFakeServer(endpointCfg, request, nil, statusCode, headers) defer server.Close() - client, err := backend.NewClient(server.URL()) + client, err := backend.NewClient(server.URL(), cfg, logger) g.Expect(err).NotTo(HaveOccurred()) err = client.Batch(request, session) @@ -137,7 +140,7 @@ func TestClient(t *testing.T) { server := initFakeServer(endpointCfg, nil, nil, statusCode, headers) defer server.Close() - client, err := backend.NewClient(server.URL()) + client, err := backend.NewClient(server.URL(), cfg, logger) g.Expect(err).NotTo(HaveOccurred()) err = client.AppLogout(session) @@ -265,7 +268,7 @@ func testProxy(t *testing.T, envVar string) { require.Equal(t, os.Getenv(envVar), proxy.URL()) // The new client should take the proxy into account. - client, err := backend.NewClient(config.BackendHTTPAPIBaseURL()) + client, err := backend.NewClient(cfg.BackendHTTPAPIBaseURL(), cfg, logger) require.Equal(t, err, nil) // Perform a request that should go through the proxy. request := api.NewPopulatedAppLoginRequest(popr, false) diff --git a/agent/internal/client.go b/agent/internal/client.go index e16a3940..c07de25f 100644 --- a/agent/internal/client.go +++ b/agent/internal/client.go @@ -10,6 +10,7 @@ import ( "github.com/sqreen/go-agent/agent/internal/backend" "github.com/sqreen/go-agent/agent/internal/backend/api" "github.com/sqreen/go-agent/agent/internal/config" + "github.com/sqreen/go-agent/agent/internal/plog" ) var ( @@ -19,12 +20,12 @@ var ( // Login to the backend. When the API request fails, retry for ever and after // sleeping some time. -func appLogin(ctx context.Context, client *backend.Client, token string, appName string) (*api.AppLoginResponse, error) { +func appLogin(ctx context.Context, logger *plog.Logger, client *backend.Client, token string, appName string, appInfo *app.Info) (*api.AppLoginResponse, error) { if err := validateToken(token, appName); err != nil { return nil, err } - procInfo := app.GetProcessInfo() + procInfo := appInfo.GetProcessInfo() appLoginReq := api.AppLoginRequest{ VariousInfos: *api.NewAppLoginRequest_VariousInfosFromFace(procInfo), @@ -32,7 +33,7 @@ func appLogin(ctx context.Context, client *backend.Client, token string, appName AgentType: "golang", AgentVersion: version, OsType: app.GoBuildTarget(), - Hostname: app.Hostname(), + Hostname: appInfo.Hostname(), RuntimeVersion: app.GoVersion(), } @@ -51,6 +52,7 @@ func appLogin(ctx context.Context, client *backend.Client, token string, appName if err != nil { logger.Error(err) appLoginRes = nil + logger.Debugf("retrying the request in %s (number of failures: %d)", backoff.duration, backoff.fails) backoff.sleep() } } @@ -77,7 +79,6 @@ func (b *backoff) next() { func (b *backoff) sleep() { b.next() - logger.Debugf("retrying the request in %s (number of failures: %d)", b.duration, b.fails) time.Sleep(b.duration) } diff --git a/agent/internal/config/config.go b/agent/internal/config/config.go index 934a9066..3f0bab73 100644 --- a/agent/internal/config/config.go +++ b/agent/internal/config/config.go @@ -18,7 +18,9 @@ import ( "github.com/spf13/viper" ) -var manager *viper.Viper +type Config struct { + *viper.Viper +} type HTTPAPIEndpoint struct { Method, URL string @@ -192,14 +194,10 @@ const ( configDefaultLogLevel = `warn` ) -func init() { - New() -} - -func New() { - logger := plog.NewLogger("sqreen/agent/config") +func New(logger *plog.Logger) *Config { + logger = plog.NewLogger("agent/config", logger) - manager = viper.New() + manager := viper.New() manager.SetEnvPrefix(configEnvPrefix) manager.AutomaticEnv() manager.SetConfigName(configFileBasename) @@ -235,42 +233,44 @@ func New() { if err != nil { logger.Error("could not read the configuration file: ", err) } + + return &Config{manager} } // BackendHTTPAPIBaseURL returns the base URL of the backend HTTP API. -func BackendHTTPAPIBaseURL() string { - return sanitizeString(manager.GetString(configKeyBackendHTTPAPIBaseURL)) +func (c *Config) BackendHTTPAPIBaseURL() string { + return sanitizeString(c.GetString(configKeyBackendHTTPAPIBaseURL)) } // BackendHTTPAPIToken returns the access token to the backend API. -func BackendHTTPAPIToken() string { - return sanitizeString(manager.GetString(configKeyBackendHTTPAPIToken)) +func (c *Config) BackendHTTPAPIToken() string { + return sanitizeString(c.GetString(configKeyBackendHTTPAPIToken)) } // LogLevel returns the log level. -func LogLevel() string { - return sanitizeString(manager.GetString(configKeyLogLevel)) +func (c *Config) LogLevel() string { + return sanitizeString(c.GetString(configKeyLogLevel)) } // AppName returns the app name. -func AppName() string { - return sanitizeString(manager.GetString(configKeyAppName)) +func (c *Config) AppName() string { + return sanitizeString(c.GetString(configKeyAppName)) } // HTTPClientIPHeader IPHeader returns the header to first lookup to find the client ip of a HTTP request. -func HTTPClientIPHeader() string { - return sanitizeString(manager.GetString(configKeyHTTPClientIPHeader)) +func (c *Config) HTTPClientIPHeader() string { + return sanitizeString(c.GetString(configKeyHTTPClientIPHeader)) } // Proxy returns the proxy configuration to use for backend HTTP calls. -func BackendHTTPAPIProxy() string { - return sanitizeString(manager.GetString(configKeyBackendHTTPAPIProxy)) +func (c *Config) BackendHTTPAPIProxy() string { + return sanitizeString(c.GetString(configKeyBackendHTTPAPIProxy)) } // Disable returns true when the agent should be disabled, false otherwise. -func Disable() bool { - disable := sanitizeString(manager.GetString(configKeyDisable)) - return disable != "" || BackendHTTPAPIToken() == "" +func (c *Config) Disable() bool { + disable := sanitizeString(c.GetString(configKeyDisable)) + return disable != "" || c.BackendHTTPAPIToken() == "" } func sanitizeString(s string) string { diff --git a/agent/internal/config/config_test.go b/agent/internal/config/config_test.go index 1e3e6fe2..5faacb21 100644 --- a/agent/internal/config/config_test.go +++ b/agent/internal/config/config_test.go @@ -6,11 +6,15 @@ import ( "strings" "testing" + "github.com/sqreen/go-agent/agent/internal/plog" "github.com/sqreen/go-agent/tools/testlib" "github.com/stretchr/testify/require" ) func TestUserConfig(t *testing.T) { + logger := plog.NewLogger("test", nil) + cfg := New(logger) + stringValueTests := []struct { Name string GetCfgValue func() string @@ -20,53 +24,53 @@ func TestUserConfig(t *testing.T) { }{ { Name: "Backend HTTP API Base URL", - GetCfgValue: BackendHTTPAPIBaseURL, + GetCfgValue: cfg.BackendHTTPAPIBaseURL, ConfigKey: configKeyBackendHTTPAPIBaseURL, DefaultValue: configDefaultBackendHTTPAPIBaseURL, SomeValue: "https://" + testlib.RandString(2, 50) + ":80806/is/cool", }, { Name: "Backend HTTP API Token", - GetCfgValue: BackendHTTPAPIToken, + GetCfgValue: cfg.BackendHTTPAPIToken, ConfigKey: configKeyBackendHTTPAPIToken, SomeValue: testlib.RandString(2, 30), }, { Name: "Log Level", - GetCfgValue: LogLevel, + GetCfgValue: cfg.LogLevel, ConfigKey: configKeyLogLevel, DefaultValue: configDefaultLogLevel, SomeValue: testlib.RandString(2, 30), }, { Name: "App Name", - GetCfgValue: AppName, + GetCfgValue: cfg.AppName, ConfigKey: configKeyAppName, SomeValue: testlib.RandString(2, 30), }, { Name: "IP Header", - GetCfgValue: HTTPClientIPHeader, + GetCfgValue: cfg.HTTPClientIPHeader, ConfigKey: configKeyHTTPClientIPHeader, SomeValue: testlib.RandString(2, 30), }, { Name: "Backend HTTP API Proxy", - GetCfgValue: BackendHTTPAPIProxy, + GetCfgValue: cfg.BackendHTTPAPIProxy, ConfigKey: configKeyBackendHTTPAPIProxy, SomeValue: testlib.RandString(2, 30), }, } for _, tc := range stringValueTests { - testStringValue(t, tc.Name, tc.GetCfgValue, tc.ConfigKey, tc.DefaultValue, tc.SomeValue) + testStringValue(t, cfg, tc.Name, tc.GetCfgValue, tc.ConfigKey, tc.DefaultValue, tc.SomeValue) } t.Run("Disable", func(t *testing.T) { os.Setenv("SQREEN_TOKEN", testlib.RandString(2, 30)) defer os.Unsetenv("SQREEN_TOKEN") - getCfgValue := Disable + getCfgValue := cfg.Disable defaultValue := false envKey := configKeyDisable someValue := testlib.RandString(2, 30) @@ -85,7 +89,7 @@ func TestUserConfig(t *testing.T) { t.Run("Set through configuration file", func(t *testing.T) { filename := newCfgFile(t, ".", envKey+`: `+someValue) defer os.Remove(filename) - manager.ReadInConfig() + cfg.ReadInConfig() require.Equal(t, getCfgValue(), !defaultValue) }) }) @@ -100,16 +104,16 @@ func TestUserConfig(t *testing.T) { binDirFile := newCfgFile(t, binDir, `token: `+binDirToken) defer os.Remove(binDirFile) - New() - token := BackendHTTPAPIToken() + cfg := New(logger) + token := cfg.BackendHTTPAPIToken() require.Equal(binDirToken, token) cwdToken := "cwd-token" cwdFile := newCfgFile(t, ".", `token: `+cwdToken) defer os.Remove(cwdFile) - New() - token = BackendHTTPAPIToken() + cfg = New(logger) + token = cfg.BackendHTTPAPIToken() require.Equal(cwdToken, token) tmpToken := "tmp-token" @@ -117,18 +121,18 @@ func TestUserConfig(t *testing.T) { tmpFile := newCfgFile(t, tmpDir, `token: `+tmpToken) defer os.Remove(tmpFile) os.Setenv("SQREEN_CONFIG_FILE", tmpFile) - New() - token = BackendHTTPAPIToken() + cfg = New(logger) + token = cfg.BackendHTTPAPIToken() require.Equal(tmpToken, token) os.Unsetenv("SQREEN_CONFIG_FILE") - New() - token = BackendHTTPAPIToken() + cfg = New(logger) + token = cfg.BackendHTTPAPIToken() require.Equal(cwdToken, token) }) } -func testStringValue(t *testing.T, name string, getCfgValue func() string, envKey, defaultValue, someValue string) { +func testStringValue(t *testing.T, cfg *Config, name string, getCfgValue func() string, envKey, defaultValue, someValue string) { t.Run(name, func(t *testing.T) { t.Run("Default value", func(t *testing.T) { require.Equal(t, getCfgValue(), defaultValue) @@ -144,7 +148,7 @@ func testStringValue(t *testing.T, name string, getCfgValue func() string, envKe t.Run("Set through configuration file", func(t *testing.T) { filename := newCfgFile(t, ".", envKey+`: `+someValue) defer os.Remove(filename) - manager.ReadInConfig() + cfg.ReadInConfig() require.Equal(t, getCfgValue(), someValue) }) }) diff --git a/agent/internal/metrics.go b/agent/internal/metrics.go index f60e1ff6..2a8f5078 100644 --- a/agent/internal/metrics.go +++ b/agent/internal/metrics.go @@ -8,19 +8,21 @@ import ( "time" "github.com/sqreen/go-agent/agent/internal/backend/api" - "github.com/sqreen/go-agent/agent/internal/config" + "github.com/sqreen/go-agent/agent/internal/plog" ) type metricsManager struct { ctx context.Context + logger *plog.Logger metrics sync.Map readyLock sync.Mutex ready []api.MetricResponse } -func newMetricsManager(ctx context.Context) *metricsManager { +func newMetricsManager(ctx context.Context, logger *plog.Logger) *metricsManager { return &metricsManager{ - ctx: ctx, + ctx: ctx, + logger: logger, } } @@ -31,6 +33,7 @@ type metricsStore struct { once sync.Once swapLock sync.RWMutex expired bool + logger *plog.Logger } type metricEntry interface { @@ -40,10 +43,11 @@ type metricEntry interface { func (m *metricsManager) get(name string) *metricsStore { store := &metricsStore{ + logger: m.logger, period: time.Minute, done: func(start, finish time.Time, observations sync.Map) { m.metrics.Delete(name) - logger.Debug("metrics ", name, " ready") + m.logger.Debug("metrics ", name, " ready") m.addObservations(name, start, finish, observations) }, } @@ -52,7 +56,7 @@ func (m *metricsManager) get(name string) *metricsStore { store = actual.(*metricsStore) store.once.Do(func() { go func() { - logger.Debug("bookkeeping metrics ", name, " with period ", store.period) + m.logger.Debug("bookkeeping metrics ", name, " with period ", store.period) store.monitor(m.ctx, time.Now()) }() }) @@ -65,13 +69,13 @@ func (m *metricsManager) addObservations(name string, start, finish time.Time, o observations.Range(func(k, v interface{}) bool { key, ok := k.(string) if !ok { - logger.Panic(errors.New("unexpected metric key type")) + m.logger.Panic(errors.New("unexpected metric key type")) return true } value, ok := v.(*uint64) if !ok { - logger.Panic(errors.New("unexpected metric value type")) + m.logger.Panic(errors.New("unexpected metric value type")) return true } @@ -112,15 +116,15 @@ func (s *metricsStore) add(e metricEntry) { var n uint64 = 1 key, err := e.bucketID() if err != nil { - logger.Error("could not compute the bucket id of the metric key:", err) + s.logger.Error("could not compute the bucket id of the metric key:", err) return } actual, loaded := s.entries.LoadOrStore(key, &n) if loaded { newVal := atomic.AddUint64(actual.(*uint64), 1) - logger.Debug("metric store ", key, " set to ", newVal) + s.logger.Debug("metric store ", key, " set to ", newVal) } else { - logger.Debug("metric store ", key, " set to ", n) + s.logger.Debug("metric store ", key, " set to ", n) } } @@ -141,8 +145,8 @@ func (s *metricsStore) monitor(ctx context.Context, start time.Time) { s.done(start, finish, entries) } -func addUserEvent(event userEventFace) { - if config.Disable() || metricsMng == nil { +func (a *Agent) addUserEvent(event userEventFace) { + if a.config.Disable() || a.metricsMng == nil { // Disabled or not yet initialized agent return } @@ -151,12 +155,12 @@ func addUserEvent(event userEventFace) { switch actual := event.(type) { case *authUserEvent: if actual.loginSuccess { - store = metricsMng.get("sdk-login-success") + store = a.metricsMng.get("sdk-login-success") } else { - store = metricsMng.get("sdk-login-fail") + store = a.metricsMng.get("sdk-login-fail") } case *signupUserEvent: - store = metricsMng.get("sdk-signup") + store = a.metricsMng.get("sdk-signup") } store.add(event) diff --git a/agent/internal/plog/plog.go b/agent/internal/plog/plog.go index ac30fbcb..491260d8 100644 --- a/agent/internal/plog/plog.go +++ b/agent/internal/plog/plog.go @@ -113,7 +113,8 @@ type OutputSetter interface { // NewLogger returns a Logger instance wrapping one logger instance per level. // They can thus be individually enabled or disabled. -func NewLogger(namespace string) *Logger { +func NewLogger(namespace string, parent *Logger) *Logger { + namespace = canonicalNamespace(namespace, parent) logger := &Logger{ PanicLogger: disabledLogger{}, ErrorLogger: disabledLogger{}, @@ -126,6 +127,16 @@ func NewLogger(namespace string) *Logger { return logger } +func canonicalNamespace(namespace string, parent *Logger) string { + var fullNS string + if parent == nil { + fullNS = "sqreen/" + namespace + } else { + fullNS = parent.namespace + "/" + namespace + } + return fullNS +} + // SetOutput sets the output of all loggers created so far. func SetOutput(output io.Writer) { for _, l := range loggers { diff --git a/agent/internal/plog/plog_test.go b/agent/internal/plog/plog_test.go index 2f3ee2e5..13629688 100644 --- a/agent/internal/plog/plog_test.go +++ b/agent/internal/plog/plog_test.go @@ -19,7 +19,7 @@ var _ = Describe("plog", func() { ) JustBeforeEach(func() { - logger = plog.NewLogger("ns") + logger = plog.NewLogger("ns", nil) }) Context("setting its output", func() { diff --git a/agent/internal/request.go b/agent/internal/request.go index 457e8906..1c9463cd 100644 --- a/agent/internal/request.go +++ b/agent/internal/request.go @@ -23,11 +23,13 @@ type HTTPRequestRecord struct { eventsLock sync.Mutex events []*HTTPRequestEvent identifyOnce sync.Once + agent *Agent } -func NewHTTPRequestRecord(req *http.Request) *HTTPRequestRecord { +func (a *Agent) newHTTPRequestRecord(req *http.Request) *HTTPRequestRecord { return &HTTPRequestRecord{ request: req, + agent: a, } } @@ -132,14 +134,14 @@ func (ctx *HTTPRequestRecord) Identify(id map[string]string) { func (ctx *HTTPRequestRecord) NewUserAuth(id map[string]string, loginSuccess bool) { if len(id) == 0 { - logger.Warn("TrackAuth(): user id is nil or empty") + ctx.agent.logger.Warn("TrackAuth(): user id is nil or empty") return } event := &authUserEvent{ loginSuccess: loginSuccess, userEvent: &userEvent{ - ip: getClientIP(ctx.request), + ip: getClientIP(ctx.request, ctx.agent.config), userIdentifiers: id, timestamp: time.Now(), }, @@ -149,13 +151,13 @@ func (ctx *HTTPRequestRecord) NewUserAuth(id map[string]string, loginSuccess boo func (ctx *HTTPRequestRecord) NewUserSignup(id map[string]string) { if len(id) == 0 { - logger.Warn("TrackSignup(): user id is nil or empty") + ctx.agent.logger.Warn("TrackSignup(): user id is nil or empty") return } event := &signupUserEvent{ userEvent: &userEvent{ - ip: getClientIP(ctx.request), + ip: getClientIP(ctx.request, ctx.agent.config), userIdentifiers: id, timestamp: time.Now(), }, @@ -164,7 +166,7 @@ func (ctx *HTTPRequestRecord) NewUserSignup(id map[string]string) { } func (ctx *HTTPRequestRecord) Close() { - addTrackEvent(newHTTPRequestRecord(ctx)) + ctx.agent.addTrackEvent(newHTTPRequestRecord(ctx)) } func (ctx *HTTPRequestRecord) addEvent(event *HTTPRequestEvent) { @@ -174,7 +176,7 @@ func (ctx *HTTPRequestRecord) addEvent(event *HTTPRequestEvent) { } func (ctx *HTTPRequestRecord) addUserEvent(event userEventFace) { - addUserEvent(event) + ctx.agent.addUserEvent(event) } func (e *HTTPRequestEvent) WithTimestamp(t time.Time) { @@ -265,10 +267,10 @@ func (r *httpRequestRecord) SetRulespackId(rulespackId string) { } func (r *httpRequestRecord) GetClientIp() string { - return getClientIP(r.ctx.request) + return getClientIP(r.ctx.request, r.ctx.agent.config) } -func getClientIP(req *http.Request) string { +func getClientIP(req *http.Request, cfg *config.Config) string { var privateIP net.IP check := func(value string) net.IP { for _, ip := range strings.Split(value, ",") { @@ -289,7 +291,7 @@ func getClientIP(req *http.Request) string { return nil } - if prioritizedHeader := config.HTTPClientIPHeader(); prioritizedHeader != "" { + if prioritizedHeader := cfg.HTTPClientIPHeader(); prioritizedHeader != "" { if value := req.Header.Get(prioritizedHeader); value != "" { if ip := check(value); ip != nil { return ip.String() @@ -322,7 +324,7 @@ func (r *httpRequestRecord) GetRequest() api.RequestRecord_Request { req := r.ctx.request trackedHeaders := config.TrackedHTTPHeaders - if extraHeader := config.HTTPClientIPHeader(); extraHeader != "" { + if extraHeader := r.ctx.agent.config.HTTPClientIPHeader(); extraHeader != "" { trackedHeaders = append(trackedHeaders, extraHeader) } headers := make([]api.RequestRecord_Request_Header, 0, len(req.Header)) @@ -349,7 +351,7 @@ func (r *httpRequestRecord) GetRequest() api.RequestRecord_Request { if requestId == "" { uuid, err := uuid.NewRandom() if err != nil { - logger.Error("could not generate a request id ", err) + r.ctx.agent.logger.Error("could not generate a request id ", err) requestId = "" } requestId = hex.EncodeToString(uuid[:]) From 6cb0946b3043b17db6a07f89006e5c14d8b8f207 Mon Sep 17 00:00:00 2001 From: Julio Guerra Date: Wed, 20 Feb 2019 17:55:01 +0100 Subject: [PATCH 08/25] agent/command: add remote command manager Implement the remote command manager which simply associates command names to methods calling back agent entrypoints. --- agent/internal/backend/api/api.pb.go | 331 ++++++++++++++------------- agent/internal/backend/api/api.proto | 6 +- agent/internal/command.go | 80 +++++++ agent/internal/command_test.go | 163 +++++++++++++ tools/testlib/rand.go | 22 ++ 5 files changed, 443 insertions(+), 159 deletions(-) create mode 100644 agent/internal/command.go create mode 100644 agent/internal/command_test.go diff --git a/agent/internal/backend/api/api.pb.go b/agent/internal/backend/api/api.pb.go index da3d23f5..3de3139e 100644 --- a/agent/internal/backend/api/api.pb.go +++ b/agent/internal/backend/api/api.pb.go @@ -207,35 +207,37 @@ func (m *CommandRequest) XXX_DiscardUnknown() { var xxx_messageInfo_CommandRequest proto.InternalMessageInfo -type CommandResponse struct { +type CommandResult struct { + Output string `protobuf:"bytes,1,opt,name=output,proto3" json:"output,omitempty"` + Status bool `protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` } -func (m *CommandResponse) Reset() { *m = CommandResponse{} } -func (m *CommandResponse) String() string { return proto.CompactTextString(m) } -func (*CommandResponse) ProtoMessage() {} -func (*CommandResponse) Descriptor() ([]byte, []int) { +func (m *CommandResult) Reset() { *m = CommandResult{} } +func (m *CommandResult) String() string { return proto.CompactTextString(m) } +func (*CommandResult) ProtoMessage() {} +func (*CommandResult) Descriptor() ([]byte, []int) { return fileDescriptor_aa33db9090833f07, []int{3} } -func (m *CommandResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CommandResponse.Unmarshal(m, b) +func (m *CommandResult) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CommandResult.Unmarshal(m, b) } -func (m *CommandResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CommandResponse.Marshal(b, m, deterministic) +func (m *CommandResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CommandResult.Marshal(b, m, deterministic) } -func (m *CommandResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_CommandResponse.Merge(m, src) +func (m *CommandResult) XXX_Merge(src proto.Message) { + xxx_messageInfo_CommandResult.Merge(m, src) } -func (m *CommandResponse) XXX_Size() int { - return xxx_messageInfo_CommandResponse.Size(m) +func (m *CommandResult) XXX_Size() int { + return xxx_messageInfo_CommandResult.Size(m) } -func (m *CommandResponse) XXX_DiscardUnknown() { - xxx_messageInfo_CommandResponse.DiscardUnknown(m) +func (m *CommandResult) XXX_DiscardUnknown() { + xxx_messageInfo_CommandResult.DiscardUnknown(m) } -var xxx_messageInfo_CommandResponse proto.InternalMessageInfo +var xxx_messageInfo_CommandResult proto.InternalMessageInfo type MetricResponse struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` @@ -272,11 +274,11 @@ func (m *MetricResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MetricResponse proto.InternalMessageInfo type AppBeatRequest struct { - CommandResults map[string]CommandResponse `protobuf:"bytes,1,rep,name=command_results,json=commandResults,proto3" json:"command_results" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Metrics []MetricResponse `protobuf:"bytes,2,rep,name=metrics,proto3" json:"metrics"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + CommandResults map[string]CommandResult `protobuf:"bytes,1,rep,name=command_results,json=commandResults,proto3" json:"command_results" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Metrics []MetricResponse `protobuf:"bytes,2,rep,name=metrics,proto3" json:"metrics"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *AppBeatRequest) Reset() { *m = AppBeatRequest{} } @@ -1145,10 +1147,10 @@ func init() { proto.RegisterType((*AppLoginResponse)(nil), "sqreen.agent.backend.api.AppLoginResponse") proto.RegisterType((*AppLoginResponse_Feature)(nil), "sqreen.agent.backend.api.AppLoginResponse.Feature") proto.RegisterType((*CommandRequest)(nil), "sqreen.agent.backend.api.CommandRequest") - proto.RegisterType((*CommandResponse)(nil), "sqreen.agent.backend.api.CommandResponse") + proto.RegisterType((*CommandResult)(nil), "sqreen.agent.backend.api.CommandResult") proto.RegisterType((*MetricResponse)(nil), "sqreen.agent.backend.api.MetricResponse") proto.RegisterType((*AppBeatRequest)(nil), "sqreen.agent.backend.api.AppBeatRequest") - proto.RegisterMapType((map[string]CommandResponse)(nil), "sqreen.agent.backend.api.AppBeatRequest.CommandResultsEntry") + proto.RegisterMapType((map[string]CommandResult)(nil), "sqreen.agent.backend.api.AppBeatRequest.CommandResultsEntry") proto.RegisterType((*AppBeatResponse)(nil), "sqreen.agent.backend.api.AppBeatResponse") proto.RegisterType((*BatchRequest)(nil), "sqreen.agent.backend.api.BatchRequest") proto.RegisterType((*BatchRequest_Event)(nil), "sqreen.agent.backend.api.BatchRequest.Event") @@ -1177,127 +1179,128 @@ func init() { } var fileDescriptor_aa33db9090833f07 = []byte{ - // 1914 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0x4f, 0x6f, 0x23, 0x49, - 0x15, 0x4f, 0xc7, 0xff, 0xda, 0xcf, 0x71, 0x92, 0x29, 0x56, 0x8c, 0x69, 0x96, 0xc9, 0x60, 0x58, - 0x31, 0xcb, 0x42, 0x67, 0x95, 0x95, 0x86, 0x25, 0x5a, 0x40, 0xf1, 0x64, 0x20, 0x66, 0x87, 0x9d, - 0xd0, 0x89, 0x46, 0x68, 0x41, 0x32, 0xe5, 0xee, 0x8a, 0xdd, 0xb2, 0xdd, 0xdd, 0x5b, 0x55, 0xed, - 0x99, 0xec, 0x57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 0x68, 0x38, 0x19, 0x18, 0x83, 0x36, 0x83, 0xba, 0x12, 0xfb, 0x11, - 0xd9, 0x87, 0x1a, 0xcf, 0xa7, 0x4c, 0x74, 0xea, 0x78, 0xef, 0x5b, 0xab, 0xcf, 0x0a, 0xf2, 0xa9, - 0xe5, 0xd5, 0x2a, 0xde, 0x1c, 0x1a, 0xe6, 0x3c, 0x65, 0xb8, 0x21, 0x95, 0xe1, 0x78, 0x20, 0xe2, - 0x0f, 0x75, 0x4c, 0xb4, 0x83, 0x26, 0x22, 0x27, 0xf1, 0x87, 0x98, 0x59, 0x33, 0xfa, 0x64, 0x20, - 0x24, 0x9d, 0xb2, 0x84, 0x09, 0x6d, 0xbf, 0x76, 0xb0, 0x31, 0xa3, 0x4f, 0x4e, 0x2c, 0xa6, 0x32, - 0x60, 0xcc, 0x28, 0x97, 0x43, 0x46, 0xe5, 0x20, 0x62, 0x53, 0x7a, 0x6e, 0x62, 0x64, 0xb3, 0x80, - 0x0f, 0x15, 0xda, 0x3d, 0x86, 0xcd, 0x65, 0x23, 0x16, 0x0e, 0x76, 0x16, 0x0e, 0x56, 0xce, 0xca, - 0x28, 0xa7, 0x33, 0x75, 0x58, 0x45, 0xbf, 0x58, 0x49, 0x6a, 0x6f, 0x9e, 0x9b, 0xf8, 0x6b, 0x06, - 0xb8, 0xee, 0xde, 0x80, 0xad, 0x82, 0x51, 0x5b, 0xb2, 0xfb, 0x6f, 0x07, 0x36, 0x7f, 0xc4, 0x24, - 0x8f, 0xc3, 0x22, 0x3a, 0x2e, 0x3b, 0x65, 0x1f, 0x6a, 0x42, 0x52, 0x2e, 0x4d, 0xb5, 0xba, 0x5a, - 0x1e, 0x68, 0x15, 0xf2, 0x0e, 0xd4, 0xcf, 0xe2, 0x24, 0x16, 0x63, 0xbc, 0xcb, 0x55, 0x95, 0x8d, - 0x0e, 0xe9, 0x43, 0x2b, 0x1d, 0x0a, 0xc6, 0xe7, 0x54, 0xda, 0x5a, 0xd5, 0xda, 0x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53, 0x98, 0x3d, 0x17, 0xea, 0x9a, 0xc9, 0x9b, 0x82, 0x5b, 0xd4, 0xe5, 0x45, 0x2d, 0xd5, - 0xc3, 0x89, 0x1d, 0xdd, 0x5e, 0x83, 0xcd, 0x30, 0x4d, 0xa4, 0x4a, 0x9b, 0x29, 0x4b, 0x46, 0x72, - 0x6c, 0x46, 0x93, 0xb6, 0x41, 0x1f, 0x20, 0xa8, 0x06, 0x78, 0xbb, 0xad, 0xf4, 0xdb, 0xa1, 0x65, - 0x30, 0x55, 0x12, 0xbd, 0x3f, 0x6d, 0x81, 0x6b, 0x83, 0x91, 0xfc, 0x18, 0x1a, 0x54, 0x4a, 0x1a, - 0x4e, 0x6c, 0x17, 0xf8, 0xd6, 0x75, 0xe3, 0xd9, 0x3f, 0x40, 0xfd, 0xc0, 0xf2, 0x90, 0x77, 0xa1, - 0x22, 0xa2, 0x89, 0x89, 0xd6, 0x6f, 0x5f, 0x9b, 0xee, 0xe4, 0xf0, 0x5d, 0xac, 0xec, 0x81, 0x62, - 0x21, 0x23, 0xb8, 0xa1, 0x09, 0x06, 0xec, 0x49, 0xc8, 0x32, 0x35, 0x05, 0xd8, 0xd1, 0x75, 0xff, - 0xda, 0xd4, 0xf7, 0x2d, 0x45, 0xb0, 0xad, 0x55, 0x0b, 0x40, 0x90, 0x9f, 0xc3, 0x46, 0x69, 0xd2, - 0x50, 0x23, 0xed, 0xa7, 0x0c, 0x11, 0x2b, 0xce, 0x78, 0xb8, 0x20, 0x09, 0x96, 0x18, 0xc9, 0x4f, - 0xa1, 0x15, 0x51, 0x49, 0x07, 0x59, 0x1a, 0x27, 0x52, 0x74, 0x6a, 0x2f, 0xf8, 0x88, 0x43, 0x2a, - 0xe9, 0xb1, 0xa2, 0x08, 0x20, 0xb2, 0x4b, 0xe1, 0xfd, 0xd5, 0x81, 0xba, 0x76, 0x04, 0xa6, 0x5b, - 0x3e, 0x65, 0x83, 0x52, 0x23, 0x70, 0x15, 0xf0, 0x9e, 0x6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15, 0x9a, 0xc5, 0xc3, 0x3a, 0x92, 0xbd, 0xf5, 0xbf, 0x00, 0x00, 0x00, - 0xff, 0xff, 0x34, 0x53, 0xc3, 0x57, 0x7c, 0x15, 0x00, 0x00, + // 1925 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0xcf, 0x6f, 0x23, 0x49, + 0xf5, 0x4f, 0xc7, 0xbf, 0xda, 0xcf, 0x71, 0x92, 0xa9, 0xef, 0xea, 0x3b, 0xa6, 0x59, 0x26, 0x83, + 0x61, 0xb5, 0x03, 0x0b, 0x9d, 0x55, 0x56, 0x1a, 0x96, 0x68, 0x17, 0x14, 0x4f, 0x06, 0x62, 0x76, + 0xd8, 0x09, 0x9d, 0x68, 0x84, 0x16, 0x24, 0x53, 0xee, 0xae, 0xd8, 0x8d, 0xed, 0xee, 0xde, 0xaa, + 0x6a, 0xcf, 0x64, 0xff, 0x05, 0x2e, 0x48, 0x1c, 0x91, 0x10, 0x27, 0x40, 0xe2, 0x84, 0xb8, 0x70, + 0x41, 0x5c, 0xf7, 0xc4, 0x85, 0xdb, 0x1e, 0x82, 0xe6, 0x06, 0xfb, 0x17, 0x70, 0x03, 0xd5, 0xab, + 0xaa, 0x76, 0x7b, 0x88, 0x67, 0x93, 0x19, 0x0e, 0x91, 0xea, 0x7d, 0xba, 0xde, 0xa7, 0xaa, 0xde, + 0x6f, 0x07, 0xbe, 0x4c, 0x47, 0x2c, 0x91, 0xbb, 0x71, 0x22, 0x19, 0x4f, 0xe8, 0x74, 0x77, 0x48, + 0xc3, 0x09, 0x4b, 0xa2, 0x5d, 0x9a, 0xc5, 0xea, 0xcf, 0xcf, 0x78, 0x2a, 0x53, 0xd2, 0x11, 0x1f, + 0x72, 0xc6, 0x12, 0x1f, 0x37, 0xfb, 0x66, 0x8f, 0x4f, 0xb3, 0xd8, 0xdb, 0x19, 0xa5, 0xe9, 0x68, + 0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15, 0xd8, 0x5e, 0x04, + 0x90, 0xc8, 0xd2, 0x44, 0x30, 0x15, 0x20, 0x82, 0x09, 0x65, 0x92, 0x41, 0x1c, 0x99, 0x40, 0x6d, + 0x1a, 0xa4, 0x1f, 0x91, 0xff, 0x87, 0xba, 0x90, 0x54, 0xe6, 0x3a, 0x36, 0xdd, 0xc0, 0x48, 0xe4, + 0x7b, 0xe0, 0x86, 0xe9, 0x6c, 0x46, 0x93, 0x48, 0x74, 0x2a, 0xb7, 0x2b, 0x77, 0x5a, 0x7b, 0x77, + 0x56, 0x47, 0xed, 0x3d, 0xbd, 0xd3, 0x04, 0xad, 0x89, 0xd3, 0x42, 0x9f, 0x9c, 0x82, 0x7b, 0xc6, + 0x30, 0x23, 0x04, 0xda, 0xa3, 0xb5, 0xb7, 0x77, 0x95, 0x0c, 0xd0, 0x0f, 0xf0, 0xbf, 0xa3, 0x55, + 0x2d, 0xab, 0x65, 0x52, 0x51, 0x9b, 0xd1, 0x70, 0x32, 0x30, 0x06, 0x6d, 0x06, 0x75, 0x25, 0xf6, + 0x23, 0xb2, 0x0f, 0x35, 0x9e, 0x4f, 0x99, 0xe8, 0xd4, 0xf1, 0xde, 0xb7, 0x56, 0x9f, 0x15, 0xe4, + 0x53, 0xcb, 0xab, 0x55, 0xbc, 0x39, 0x34, 0xcc, 0x79, 0xca, 0x70, 0x43, 0x2a, 0xc3, 0xf1, 0x40, + 0xc4, 0x1f, 0xe9, 0x98, 0x68, 0x07, 0x4d, 0x44, 0x4e, 0xe2, 0x8f, 0x30, 0xb3, 0x66, 0xf4, 0xc9, + 0x40, 0x48, 0x3a, 0x65, 0x09, 0x13, 0xda, 0x7e, 0xed, 0x60, 0x63, 0x46, 0x9f, 0x9c, 0x58, 0x4c, + 0x65, 0xc0, 0x98, 0x51, 0x2e, 0x87, 0x8c, 0xca, 0x41, 0xc4, 0xa6, 0xf4, 0xdc, 0xc4, 0xc8, 0x66, + 0x01, 0x1f, 0x2a, 0xb4, 0x7b, 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42, 0x50, 0x59, 0x51, 0x08, 0xaa, 0x97, 0x15, 0x82, + 0xda, 0xca, 0x42, 0x50, 0x5f, 0x55, 0x08, 0x1a, 0xd7, 0xcd, 0x55, 0xef, 0x67, 0x0e, 0xb4, 0x4a, + 0xd5, 0x52, 0x8d, 0xc9, 0x21, 0x95, 0x6c, 0x94, 0x72, 0xdb, 0x3c, 0x0b, 0xd9, 0xf6, 0xd4, 0xf5, + 0x4b, 0x7a, 0x6a, 0xa5, 0xd4, 0x53, 0x8b, 0xdb, 0x54, 0xaf, 0x7d, 0x9b, 0x5f, 0x3a, 0xd0, 0x2c, + 0x4a, 0xab, 0xfe, 0x9f, 0x59, 0x69, 0xda, 0x75, 0xec, 0xff, 0xcc, 0x16, 0xb3, 0xed, 0x92, 0x75, + 0xd7, 0x9f, 0xb1, 0xae, 0xbd, 0x47, 0xe5, 0x45, 0xca, 0xa3, 0xf6, 0x41, 0xb5, 0xe4, 0x83, 0xde, + 0x8d, 0x8f, 0x9f, 0xde, 0x5a, 0xfb, 0xc7, 0xd3, 0x5b, 0xce, 0xbf, 0x9e, 0xde, 0x72, 0x3e, 0xa8, + 0xd0, 0x2c, 0x1e, 0xd6, 0x91, 0xec, 0xad, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x02, 0xfa, 0xb9, + 0x2d, 0xa8, 0x15, 0x00, 0x00, } type AppLoginRequestFace interface { @@ -1571,20 +1574,32 @@ func NewCommandRequestFromFace(that CommandRequestFace) *CommandRequest { return this } -type CommandResponseFace interface { +type CommandResultFace interface { Proto() github_com_gogo_protobuf_proto.Message + GetOutput() string + GetStatus() bool } -func (this *CommandResponse) Proto() github_com_gogo_protobuf_proto.Message { +func (this *CommandResult) Proto() github_com_gogo_protobuf_proto.Message { return this } -func (this *CommandResponse) TestProto() github_com_gogo_protobuf_proto.Message { - return NewCommandResponseFromFace(this) +func (this *CommandResult) TestProto() github_com_gogo_protobuf_proto.Message { + return NewCommandResultFromFace(this) } -func NewCommandResponseFromFace(that CommandResponseFace) *CommandResponse { - this := &CommandResponse{} +func (this *CommandResult) GetOutput() string { + return this.Output +} + +func (this *CommandResult) GetStatus() bool { + return this.Status +} + +func NewCommandResultFromFace(that CommandResultFace) *CommandResult { + this := &CommandResult{} + this.Output = that.GetOutput() + this.Status = that.GetStatus() return this } @@ -1631,7 +1646,7 @@ func NewMetricResponseFromFace(that MetricResponseFace) *MetricResponse { type AppBeatRequestFace interface { Proto() github_com_gogo_protobuf_proto.Message - GetCommandResults() map[string]CommandResponse + GetCommandResults() map[string]CommandResult GetMetrics() []MetricResponse } @@ -1643,7 +1658,7 @@ func (this *AppBeatRequest) TestProto() github_com_gogo_protobuf_proto.Message { return NewAppBeatRequestFromFace(this) } -func (this *AppBeatRequest) GetCommandResults() map[string]CommandResponse { +func (this *AppBeatRequest) GetCommandResults() map[string]CommandResult { return this.CommandResults } @@ -2504,10 +2519,12 @@ func NewPopulatedCommandRequest(r randyApi, easy bool) *CommandRequest { return this } -func NewPopulatedCommandResponse(r randyApi, easy bool) *CommandResponse { - this := &CommandResponse{} +func NewPopulatedCommandResult(r randyApi, easy bool) *CommandResult { + this := &CommandResult{} + this.Output = string(randStringApi(r)) + this.Status = bool(bool(r.Intn(2) == 0)) if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedApi(r, 1) + this.XXX_unrecognized = randUnrecognizedApi(r, 3) } return this } @@ -2531,9 +2548,9 @@ func NewPopulatedAppBeatRequest(r randyApi, easy bool) *AppBeatRequest { this := &AppBeatRequest{} if r.Intn(10) != 0 { v12 := r.Intn(10) - this.CommandResults = make(map[string]CommandResponse) + this.CommandResults = make(map[string]CommandResult) for i := 0; i < v12; i++ { - this.CommandResults[randStringApi(r)] = *NewPopulatedCommandResponse(r, easy) + this.CommandResults[randStringApi(r)] = *NewPopulatedCommandResult(r, easy) } } if r.Intn(10) != 0 { diff --git a/agent/internal/backend/api/api.proto b/agent/internal/backend/api/api.proto index e4281320..facac71b 100644 --- a/agent/internal/backend/api/api.proto +++ b/agent/internal/backend/api/api.proto @@ -57,7 +57,9 @@ message CommandRequest { string uuid = 3; } -message CommandResponse { +message CommandResult { + string output = 1; + bool status = 2; } message MetricResponse { @@ -68,7 +70,7 @@ message MetricResponse { } message AppBeatRequest { - map command_results = 1 [(gogoproto.nullable) = false]; + map command_results = 1 [(gogoproto.nullable) = false]; repeated MetricResponse metrics = 2 [(gogoproto.nullable) = false]; } diff --git a/agent/internal/command.go b/agent/internal/command.go new file mode 100644 index 00000000..d55d400b --- /dev/null +++ b/agent/internal/command.go @@ -0,0 +1,80 @@ +package internal + +import ( + "github.com/sqreen/go-agent/agent/internal/backend/api" + "github.com/sqreen/go-agent/agent/internal/plog" +) + +type CommandManager struct { + logger *plog.Logger + agent CommandManagerAgent + handlers map[string]CommandHandler +} + +type CommandHandler func() api.CommandResult + +// CommandManagerAgent defines the expected agent SDK and allows to easily +// implement functional tests by mocking it up. +type CommandManagerAgent interface { + InstrumentationEnable() error + InstrumentationDisable() error +} + +func NewCommandManager(agent CommandManagerAgent, logger *plog.Logger) *CommandManager { + mng := &CommandManager{ + agent: agent, + logger: plog.NewLogger("command", logger), + } + + // Note: using Go's reflection to call methods would be slower. + mng.handlers = map[string]CommandHandler{ + "instrumentation_enable": mng.InstrumentationEnable, + "instrumentation_remove": mng.InstrumentationRemove, + } + + return mng +} + +func (m *CommandManager) Do(commands []api.CommandRequest) map[string]api.CommandResult { + if len(commands) == 0 { + return nil + } + + results := make(map[string]api.CommandResult, len(commands)) + for _, cmd := range commands { + handler, exists := m.handlers[cmd.Name] + if !exists { + m.logger.Warnf("ignoring unsupported command `%s`", cmd.Name) + continue + } + results[cmd.Uuid] = handler() + } + + if len(results) == 0 { + return nil + } + return results +} + +func (m *CommandManager) InstrumentationEnable() api.CommandResult { + err := m.agent.InstrumentationEnable() + return commandResult(err) +} + +func (m *CommandManager) InstrumentationRemove() api.CommandResult { + err := m.agent.InstrumentationDisable() + return commandResult(err) +} + +// commandResult converts an error to a command result API object. +func commandResult(err error) api.CommandResult { + if err != nil { + return api.CommandResult{ + Status: false, + Output: err.Error(), + } + } + return api.CommandResult{ + Status: true, + } +} diff --git a/agent/internal/command_test.go b/agent/internal/command_test.go new file mode 100644 index 00000000..384a2040 --- /dev/null +++ b/agent/internal/command_test.go @@ -0,0 +1,163 @@ +package internal_test + +import ( + "errors" + "testing" + + "github.com/sqreen/go-agent/agent/internal" + "github.com/sqreen/go-agent/agent/internal/backend/api" + "github.com/sqreen/go-agent/agent/internal/plog" + "github.com/sqreen/go-agent/tools/testlib" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" +) + +func TestCommandManager(t *testing.T) { + var agent agentMockup + logger := plog.NewLogger("test", nil) + mng := internal.NewCommandManager(&agent, logger) + require.NotNil(t, mng) + + t.Run("nil command list", func(t *testing.T) { + results := mng.Do(nil) + require.Nil(t, results) + }) + + t.Run("empty command list", func(t *testing.T) { + results := mng.Do([]api.CommandRequest{}) + require.Nil(t, results) + }) + + t.Run("unknown command", func(t *testing.T) { + results := mng.Do([]api.CommandRequest{ + { + Uuid: testlib.RandString(1, 50), + Name: testlib.RandString(1, 50), + }, + }) + require.Nil(t, results) + agent.AssertExpectations(t) + }) + + testCases := []struct { + Command string + AgentExpectedCall func() *mock.Call + }{ + { + Command: "instrumentation_enable", + AgentExpectedCall: agent.ExpectInstrumentationEnable, + }, + { + Command: "instrumentation_remove", + AgentExpectedCall: agent.ExpectInstrumentationDisable, + }, + } + + for _, tc := range testCases { + t.Run(tc.Command, func(t *testing.T) { + t.Run("without errors", func(t *testing.T) { + agent.Reset() + + tc.AgentExpectedCall().Return(nil).Once() + uuid := testlib.RandString(1, 126) + results := mng.Do([]api.CommandRequest{ + { + Uuid: uuid, + Name: tc.Command, + }, + }) + require.Equal(t, results, map[string]api.CommandResult{ + uuid: api.CommandResult{ + Status: true, + Output: "", + }, + }) + agent.AssertExpectations(t) + }) + + t.Run("with error", func(t *testing.T) { + agent.Reset() + + errorMsg := testlib.RandString(1, 126) + tc.AgentExpectedCall().Return(errors.New(errorMsg)).Once() + uuid := testlib.RandString(1, 126) + results := mng.Do([]api.CommandRequest{ + { + Uuid: uuid, + Name: tc.Command, + }, + }) + require.Equal(t, results, map[string]api.CommandResult{ + uuid: api.CommandResult{ + Status: false, + Output: errorMsg, + }, + }) + agent.AssertExpectations(t) + }) + }) + } + + t.Run("multiple commands", func(t *testing.T) { + agent.Reset() + + var ( + commands []api.CommandRequest + expectedResults = make(map[string]api.CommandResult) + ) + + // Generate the list of commands and the expected results + for _, tc := range testCases { + uuid := testlib.RandString(1, 126) + + commands = append(commands, api.CommandRequest{ + Uuid: uuid, + Name: tc.Command, + }) + + expectedResults[uuid] = api.CommandResult{ + Status: true, + Output: "", + } + + tc.AgentExpectedCall().Return(nil).Once() + } + + // Also include wrong commands + for n := 0; n <= int(testlib.RandUint32(1)); n++ { + commands = append(commands, api.CommandRequest{ + Uuid: testlib.RandString(1, 50), + Name: testlib.RandString(1, 50), + }) + } + + results := mng.Do(commands) + require.Equal(t, results, expectedResults) + }) +} + +type agentMockup struct { + mock.Mock +} + +func (a *agentMockup) Reset() { + a.Mock = mock.Mock{} +} + +func (a *agentMockup) InstrumentationEnable() error { + ret := a.Called() + return ret.Error(0) +} + +func (a *agentMockup) InstrumentationDisable() error { + ret := a.Called() + return ret.Error(0) +} + +func (a *agentMockup) ExpectInstrumentationEnable() *mock.Call { + return a.On("InstrumentationEnable") +} + +func (a *agentMockup) ExpectInstrumentationDisable() *mock.Call { + return a.On("InstrumentationDisable") +} diff --git a/tools/testlib/rand.go b/tools/testlib/rand.go index a1b7c247..01717046 100644 --- a/tools/testlib/rand.go +++ b/tools/testlib/rand.go @@ -19,3 +19,25 @@ func RandString(size ...int) string { } return string(b) } + +func RandUint32(boundaries ...uint32) uint32 { + rand := rand.Uint32() + + switch len(boundaries) { + case 0: + return rand + + case 1: + // At least + return boundaries[0] + rand + + case 2: + // Between boundaries + min := boundaries[0] + max := boundaries[1] + return min + (rand % (max - min)) + + default: + panic("unexpected arguments") + } +} From 88f93fb2cfc4b87be70735a460a50599bea530ca Mon Sep 17 00:00:00 2001 From: Julio Guerra Date: Wed, 20 Feb 2019 18:02:31 +0100 Subject: [PATCH 09/25] agent: remote commands Add remote commands management in the agent loop: 1. Read them from the login response. 2. Send results in the heartbeat loop. 3. Receive new ones in the heartbeat response. --- agent/internal/agent.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/agent/internal/agent.go b/agent/internal/agent.go index 375e95e2..bdeaff67 100644 --- a/agent/internal/agent.go +++ b/agent/internal/agent.go @@ -84,6 +84,11 @@ func (a *Agent) start() { return } + // Create the command manager to process backend commands + commandMng := NewCommandManager(a, a.logger) + // Process commands that may have been received on login. + commandResults := commandMng.Do(appLoginRes.Commands) + heartbeat := time.Duration(appLoginRes.Features.HeartbeatDelay) * time.Second if heartbeat == 0 { heartbeat = config.BackendHTTPAPIDefaultHeartbeatDelay @@ -114,15 +119,19 @@ func (a *Agent) start() { metrics := a.metricsMng.getObservations() appBeatReq := api.AppBeatRequest{ - Metrics: metrics, + Metrics: metrics, + CommandResults: commandResults, } - _, err := client.AppBeat(&appBeatReq, sessionID) + appBeatRes, err := client.AppBeat(&appBeatReq, sessionID) if err != nil { a.logger.Error("heartbeat failed: ", err) continue } + // Perform commands that may be requested. + commandResults = commandMng.Do(appBeatRes.Commands) + case <-a.ctx.Done(): // The context was canceled because of a interrupt signal, logout and // return. From a95a9525f9f3208932edb0ccac9bf15cadae2cbc Mon Sep 17 00:00:00 2001 From: Julio Guerra Date: Wed, 20 Feb 2019 18:05:47 +0100 Subject: [PATCH 10/25] agent: instrumentation enable/disable commands Implement instrumentation enable/disable agent methods, expected by the command manager. For now, it only enables/disables the SDK as nothing else is yet supported. The SDK is therefore no longer enabled by default, but rather enabled by the applogin response which commands to enable instrumentation and thus the SDK events. --- agent/agent.go | 2 -- agent/internal/agent.go | 17 ++++++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/agent/agent.go b/agent/agent.go index f4d1d52f..85920f83 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -2,14 +2,12 @@ package agent import ( "github.com/sqreen/go-agent/agent/internal" - "github.com/sqreen/go-agent/sdk" ) var agent *internal.Agent func init() { agent = internal.New() - sdk.SetAgent(agent) if agent != nil { agent.Start() } diff --git a/agent/internal/agent.go b/agent/internal/agent.go index bdeaff67..9b36c000 100644 --- a/agent/internal/agent.go +++ b/agent/internal/agent.go @@ -13,6 +13,7 @@ import ( "github.com/sqreen/go-agent/agent/internal/config" "github.com/sqreen/go-agent/agent/internal/plog" "github.com/sqreen/go-agent/agent/types" + "github.com/sqreen/go-agent/sdk" ) type Agent struct { @@ -55,8 +56,8 @@ func (a *Agent) Start() { func (a *Agent) NewRequestRecord(req *http.Request) types.RequestRecord { return a.newHTTPRequestRecord(req) - } + func (a *Agent) start() { defer func() { err := recover() @@ -146,6 +147,20 @@ func (a *Agent) start() { } } +func (a *Agent) InstrumentationEnable() error { + sdk.SetAgent(a) + a.logger.Info("instrumentation enabled") + return nil +} + +// InstrumentationDisable disables the agent instrumentation, which includes for +// now the SDK. +func (a *Agent) InstrumentationDisable() error { + sdk.SetAgent(nil) + a.logger.Info("instrumentation disabled") + return nil +} + func (a *Agent) GracefulStop() { if a.config.Disable() { return From 0903966d0d7fb7763db5da1626a9c0cbdd03a546 Mon Sep 17 00:00:00 2001 From: Julio Guerra Date: Thu, 21 Feb 2019 18:47:13 +0100 Subject: [PATCH 11/25] agent/command: unknown command result Do not ignore unknown commands but rather create a result whose status is `false` and stating it in the result output field. --- agent/internal/command.go | 14 ++++++++++---- agent/internal/command_test.go | 15 ++++++++++++--- agent/internal/config/config.go | 5 +++++ 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/agent/internal/command.go b/agent/internal/command.go index d55d400b..994e63d2 100644 --- a/agent/internal/command.go +++ b/agent/internal/command.go @@ -2,6 +2,7 @@ package internal import ( "github.com/sqreen/go-agent/agent/internal/backend/api" + "github.com/sqreen/go-agent/agent/internal/config" "github.com/sqreen/go-agent/agent/internal/plog" ) @@ -43,11 +44,16 @@ func (m *CommandManager) Do(commands []api.CommandRequest) map[string]api.Comman results := make(map[string]api.CommandResult, len(commands)) for _, cmd := range commands { handler, exists := m.handlers[cmd.Name] - if !exists { - m.logger.Warnf("ignoring unsupported command `%s`", cmd.Name) - continue + var result api.CommandResult + if exists { + result = handler() + } else { + result = api.CommandResult{ + Status: false, + Output: config.ErrorMessage_UnsupportedCommand, + } } - results[cmd.Uuid] = handler() + results[cmd.Uuid] = result } if len(results) == 0 { diff --git a/agent/internal/command_test.go b/agent/internal/command_test.go index 384a2040..fc43dafb 100644 --- a/agent/internal/command_test.go +++ b/agent/internal/command_test.go @@ -6,6 +6,7 @@ import ( "github.com/sqreen/go-agent/agent/internal" "github.com/sqreen/go-agent/agent/internal/backend/api" + "github.com/sqreen/go-agent/agent/internal/config" "github.com/sqreen/go-agent/agent/internal/plog" "github.com/sqreen/go-agent/tools/testlib" "github.com/stretchr/testify/mock" @@ -29,13 +30,14 @@ func TestCommandManager(t *testing.T) { }) t.Run("unknown command", func(t *testing.T) { + uuid := testlib.RandString(1, 126) results := mng.Do([]api.CommandRequest{ { - Uuid: testlib.RandString(1, 50), + Uuid: uuid, Name: testlib.RandString(1, 50), }, }) - require.Nil(t, results) + require.False(t, results[uuid].Status) agent.AssertExpectations(t) }) @@ -125,10 +127,17 @@ func TestCommandManager(t *testing.T) { // Also include wrong commands for n := 0; n <= int(testlib.RandUint32(1)); n++ { + uuid := testlib.RandString(1, 126) + commands = append(commands, api.CommandRequest{ - Uuid: testlib.RandString(1, 50), + Uuid: uuid, Name: testlib.RandString(1, 50), }) + + expectedResults[uuid] = api.CommandResult{ + Status: false, + Output: config.ErrorMessage_UnsupportedCommand, + } } results := mng.Do(commands) diff --git a/agent/internal/config/config.go b/agent/internal/config/config.go index 3f0bab73..b0ed703b 100644 --- a/agent/internal/config/config.go +++ b/agent/internal/config/config.go @@ -22,6 +22,11 @@ type Config struct { *viper.Viper } +// Error messages. +const ( + ErrorMessage_UnsupportedCommand = "command is not supported" +) + type HTTPAPIEndpoint struct { Method, URL string } From acc18f06960552b7fd200358bfed69289f0f54a0 Mon Sep 17 00:00:00 2001 From: Julio Guerra Date: Thu, 21 Feb 2019 18:13:10 +0100 Subject: [PATCH 12/25] agent/backend/api: remove unused code Remove protobuf methods for now as they are not used nor tested, which kills the average coverage of the agent. --- Makefile | 2 +- agent/internal/app/runtime.go | 6 - agent/internal/backend/api/api.go | 1121 ++++++++ agent/internal/backend/api/api.pb.go | 2979 --------------------- agent/internal/backend/api/jsonpb.go | 55 +- agent/internal/backend/api/jsonpb_test.go | 18 +- agent/internal/backend/client.go | 28 +- agent/internal/backend/client_test.go | 123 +- agent/internal/request.go | 9 - go.mod | 1 + 10 files changed, 1201 insertions(+), 3141 deletions(-) create mode 100644 agent/internal/backend/api/api.go delete mode 100644 agent/internal/backend/api/api.pb.go diff --git a/Makefile b/Makefile index 6bdf6368..e26c6a45 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,7 @@ dev-container := .cache/docker/dev/run dev-image := .cache/docker/dev/build needs-dev-container := $(if $(shell $(lib/docker/is_in_container) && echo y),,$(dev-container)) needs-dev-image := $(if $(shell $(lib/docker/is_in_container) && echo y),,$(dev-image)) -needs-protobufs := $(protobufs) +needs-protobufs := needs-vendors := .cache/go/vendor #----------------------------------------------------------------------------- diff --git a/agent/internal/app/runtime.go b/agent/internal/app/runtime.go index 4914483f..b08246f4 100644 --- a/agent/internal/app/runtime.go +++ b/agent/internal/app/runtime.go @@ -9,8 +9,6 @@ import ( "strings" "time" - "github.com/gogo/protobuf/proto" - "github.com/sqreen/go-agent/agent/internal/backend/api" "github.com/sqreen/go-agent/agent/internal/plog" ) @@ -83,10 +81,6 @@ func (p *ProcessInfo) GetGid() uint32 { return p.gid } -func (p *ProcessInfo) Proto() proto.Message { - return api.NewAppLoginRequest_VariousInfosFromFace(p) -} - func GoVersion() string { return runtime.Version() } diff --git a/agent/internal/backend/api/api.go b/agent/internal/backend/api/api.go new file mode 100644 index 00000000..e7e9b91a --- /dev/null +++ b/agent/internal/backend/api/api.go @@ -0,0 +1,1121 @@ +package api + +import ( + "time" + // _ "github.com/gogo/protobuf/gogoproto" + github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" + fuzz "github.com/google/gofuzz" + // _ "github.com/gogo/protobuf/types" +) + +type AppLoginRequest struct { + BundleSignature string `protobuf:"bytes,1,opt,name=bundle_signature,json=bundleSignature,proto3" json:"bundle_signature,omitempty"` + VariousInfos AppLoginRequest_VariousInfos `protobuf:"bytes,2,opt,name=various_infos,json=variousInfos,proto3" json:"various_infos"` + AgentType string `protobuf:"bytes,3,opt,name=agent_type,json=agentType,proto3" json:"agent_type,omitempty"` + AgentVersion string `protobuf:"bytes,4,opt,name=agent_version,json=agentVersion,proto3" json:"agent_version,omitempty"` + OsType string `protobuf:"bytes,5,opt,name=os_type,json=osType,proto3" json:"os_type,omitempty"` + Hostname string `protobuf:"bytes,6,opt,name=hostname,proto3" json:"hostname,omitempty"` + RuntimeType string `protobuf:"bytes,7,opt,name=runtime_type,json=runtimeType,proto3" json:"runtime_type,omitempty"` + RuntimeVersion string `protobuf:"bytes,8,opt,name=runtime_version,json=runtimeVersion,proto3" json:"runtime_version,omitempty"` + FrameworkType string `protobuf:"bytes,9,opt,name=framework_type,json=frameworkType,proto3" json:"framework_type,omitempty"` + FrameworkVersion string `protobuf:"bytes,10,opt,name=framework_version,json=frameworkVersion,proto3" json:"framework_version,omitempty"` + Environment string `protobuf:"bytes,11,opt,name=environment,proto3" json:"environment,omitempty"` +} + +type AppLoginRequest_VariousInfos struct { + Time time.Time `protobuf:"bytes,1,opt,name=time,proto3,stdtime" json:"time"` + Pid uint32 `protobuf:"varint,3,opt,name=pid,proto3" json:"pid,omitempty"` + Ppid uint32 `protobuf:"varint,4,opt,name=ppid,proto3" json:"ppid,omitempty"` + Euid uint32 `protobuf:"varint,5,opt,name=euid,proto3" json:"euid,omitempty"` + Egid uint32 `protobuf:"varint,6,opt,name=egid,proto3" json:"egid,omitempty"` + Uid uint32 `protobuf:"varint,7,opt,name=uid,proto3" json:"uid,omitempty"` + Gid uint32 `protobuf:"varint,8,opt,name=gid,proto3" json:"gid,omitempty"` + Name string `protobuf:"bytes,9,opt,name=name,proto3" json:"name,omitempty"` +} + +type AppLoginResponse struct { + SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` + Status bool `protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"` + Commands []CommandRequest `protobuf:"bytes,3,rep,name=commands,proto3" json:"commands"` + Features AppLoginResponse_Feature `protobuf:"bytes,4,opt,name=features,proto3" json:"features"` + PackId string `protobuf:"bytes,5,opt,name=pack_id,json=packId,proto3" json:"pack_id,omitempty"` + Rules []Rule `protobuf:"bytes,6,rep,name=rules,proto3" json:"rules"` +} + +type AppLoginResponse_Feature struct { + BatchSize uint32 `protobuf:"varint,1,opt,name=batch_size,json=batchSize,proto3" json:"batch_size,omitempty"` + MaxStaleness uint32 `protobuf:"varint,2,opt,name=max_staleness,json=maxStaleness,proto3" json:"max_staleness,omitempty"` + HeartbeatDelay uint32 `protobuf:"varint,3,opt,name=heartbeat_delay,json=heartbeatDelay,proto3" json:"heartbeat_delay,omitempty"` +} + +type CommandRequest struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Params []string `protobuf:"bytes,2,rep,name=params,proto3" json:"params,omitempty"` + Uuid string `protobuf:"bytes,3,opt,name=uuid,proto3" json:"uuid,omitempty"` +} + +type CommandResult struct { + Output string `protobuf:"bytes,1,opt,name=output,proto3" json:"output,omitempty"` + Status bool `protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"` +} + +type MetricResponse struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Start time.Time `protobuf:"bytes,2,opt,name=start,proto3,stdtime" json:"start"` + Finish time.Time `protobuf:"bytes,3,opt,name=finish,proto3,stdtime" json:"finish"` + Observation Struct `protobuf:"bytes,4,opt,name=observation,proto3,customtype=Struct" json:"observation"` +} + +type AppBeatRequest struct { + CommandResults map[string]CommandResult `protobuf:"bytes,1,rep,name=command_results,json=commandResults,proto3" json:"command_results" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Metrics []MetricResponse `protobuf:"bytes,2,rep,name=metrics,proto3" json:"metrics"` +} + +type AppBeatResponse struct { + Commands []CommandRequest `protobuf:"bytes,1,rep,name=commands,proto3" json:"commands"` + Status bool `protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"` +} + +type BatchRequest struct { + Batch []BatchRequest_Event `protobuf:"bytes,1,rep,name=batch,proto3" json:"batch"` +} + +type BatchRequest_Event struct { + EventType string `protobuf:"bytes,1,opt,name=event_type,json=eventType,proto3" json:"event_type,omitempty"` + Event Struct `protobuf:"bytes,2,opt,name=event,proto3,customtype=Struct" json:"event"` +} + +type Rule struct { +} + +type Dependency struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` + Homepage string `protobuf:"bytes,3,opt,name=homepage,proto3" json:"homepage,omitempty"` + Source *Dependency_Source `protobuf:"bytes,4,opt,name=source,proto3" json:"source,omitempty"` +} + +type Dependency_Source struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Remotes []string `protobuf:"bytes,2,rep,name=remotes,proto3" json:"remotes,omitempty"` +} + +type RequestRecord struct { + Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + RulespackId string `protobuf:"bytes,2,opt,name=rulespack_id,json=rulespackId,proto3" json:"rulespack_id"` + ClientIp string `protobuf:"bytes,3,opt,name=client_ip,json=clientIp,proto3" json:"client_ip"` + Request RequestRecord_Request `protobuf:"bytes,4,opt,name=request,proto3" json:"request"` + Response RequestRecord_Response `protobuf:"bytes,5,opt,name=response,proto3" json:"response"` + Observed RequestRecord_Observed `protobuf:"bytes,6,opt,name=observed,proto3" json:"observed"` +} + +type RequestRecord_Request struct { + Rid string `protobuf:"bytes,1,opt,name=rid,proto3" json:"rid,omitempty"` + Headers []RequestRecord_Request_Header `protobuf:"bytes,2,rep,name=headers,proto3" json:"headers"` + Verb string `protobuf:"bytes,3,opt,name=verb,proto3" json:"verb,omitempty"` + Path string `protobuf:"bytes,4,opt,name=path,proto3" json:"path,omitempty"` + RawPath string `protobuf:"bytes,5,opt,name=raw_path,json=rawPath,proto3" json:"raw_path,omitempty"` + Host string `protobuf:"bytes,6,opt,name=host,proto3" json:"host,omitempty"` + Port string `protobuf:"bytes,7,opt,name=port,proto3" json:"port,omitempty"` + RemoteIp string `protobuf:"bytes,8,opt,name=remote_ip,json=remoteIp,proto3" json:"remote_ip,omitempty"` + RemotePort string `protobuf:"bytes,9,opt,name=remote_port,json=remotePort,proto3" json:"remote_port,omitempty"` + Scheme string `protobuf:"bytes,10,opt,name=scheme,proto3" json:"scheme,omitempty"` + UserAgent string `protobuf:"bytes,11,opt,name=user_agent,json=userAgent,proto3" json:"user_agent,omitempty"` + Referer string `protobuf:"bytes,12,opt,name=referer,proto3" json:"referer,omitempty"` + Params RequestRecord_Request_Params `protobuf:"bytes,13,opt,name=params,proto3" json:"params"` +} + +type RequestRecord_Request_Header struct { + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` +} + +type RequestRecord_Request_Params struct { +} + +type RequestRecord_Response struct { + Status uint32 `protobuf:"varint,1,opt,name=status,proto3" json:"status,omitempty"` + ContentLength uint32 `protobuf:"varint,2,opt,name=content_length,json=contentLength,proto3" json:"content_length,omitempty"` + ContentType string `protobuf:"bytes,3,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"` +} + +type RequestRecord_Observed struct { + Attacks []*RequestRecord_Observed_Attack `protobuf:"bytes,1,rep,name=attacks,proto3" json:"attacks,omitempty"` + Sdk []*RequestRecord_Observed_SDKEvent `protobuf:"bytes,2,rep,name=sdk,proto3" json:"sdk,omitempty"` + SqreenExceptions []*RequestRecord_Observed_Exception `protobuf:"bytes,3,rep,name=sqreen_exceptions,json=sqreenExceptions,proto3" json:"sqreen_exceptions,omitempty"` + Observations []*RequestRecord_Observed_Observation `protobuf:"bytes,4,rep,name=observations,proto3" json:"observations,omitempty"` + DataPoints []*RequestRecord_Observed_DataPoint `protobuf:"bytes,5,rep,name=data_points,json=dataPoints,proto3" json:"data_points,omitempty"` +} + +type RequestRecord_Observed_Attack struct { + RuleName string `protobuf:"bytes,1,opt,name=rule_name,json=ruleName,proto3" json:"rule_name,omitempty"` + Test bool `protobuf:"varint,2,opt,name=test,proto3" json:"test,omitempty"` + Infos string `protobuf:"bytes,3,opt,name=infos,proto3" json:"infos,omitempty"` + Backtrace []string `protobuf:"bytes,4,rep,name=backtrace,proto3" json:"backtrace,omitempty"` + Time time.Time `protobuf:"bytes,5,opt,name=time,proto3,stdtime" json:"time"` + Block bool `protobuf:"varint,6,opt,name=block,proto3" json:"block,omitempty"` +} + +type RequestRecord_Observed_SDKEvent struct { + Time time.Time `protobuf:"bytes,1,opt,name=time,proto3,stdtime" json:"time"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Args RequestRecord_Observed_SDKEvent_Args `protobuf:"bytes,3,opt,name=args,proto3" json:"args"` +} + +// Helper message type to disable the face extension only on it and not in +// the entire SDKEvent message type. oneof + face is not supported. +type RequestRecord_Observed_SDKEvent_Args struct { + // Types that are valid to be assigned to Args: + // *RequestRecord_Observed_SDKEvent_Args_Track_ + // *RequestRecord_Observed_SDKEvent_Args_Identify_ + Args isRequestRecord_Observed_SDKEvent_Args_Args `protobuf_oneof:"args"` +} + +type isRequestRecord_Observed_SDKEvent_Args_Args interface { + isRequestRecord_Observed_SDKEvent_Args_Args() +} + +type RequestRecord_Observed_SDKEvent_Args_Track_ struct { + Track *RequestRecord_Observed_SDKEvent_Args_Track `protobuf:"bytes,1,opt,name=track,proto3,oneof"` +} +type RequestRecord_Observed_SDKEvent_Args_Identify_ struct { + Identify *RequestRecord_Observed_SDKEvent_Args_Identify `protobuf:"bytes,2,opt,name=identify,proto3,oneof"` +} + +func (*RequestRecord_Observed_SDKEvent_Args_Track_) isRequestRecord_Observed_SDKEvent_Args_Args() {} +func (pb *RequestRecord_Observed_SDKEvent_Args_Track_) Fuzz(c fuzz.Continue) { + c.Fuzz(pb) +} +func (*RequestRecord_Observed_SDKEvent_Args_Identify_) isRequestRecord_Observed_SDKEvent_Args_Args() {} +func (pb *RequestRecord_Observed_SDKEvent_Args_Identify_) Fuzz(c fuzz.Continue) { + c.Fuzz(pb) +} + +func (m *RequestRecord_Observed_SDKEvent_Args) GetArgs() isRequestRecord_Observed_SDKEvent_Args_Args { + if m != nil { + return m.Args + } + return nil +} + +func (m *RequestRecord_Observed_SDKEvent_Args) GetTrack() *RequestRecord_Observed_SDKEvent_Args_Track { + if x, ok := m.GetArgs().(*RequestRecord_Observed_SDKEvent_Args_Track_); ok { + return x.Track + } + return nil +} + +func (m *RequestRecord_Observed_SDKEvent_Args) GetIdentify() *RequestRecord_Observed_SDKEvent_Args_Identify { + if x, ok := m.GetArgs().(*RequestRecord_Observed_SDKEvent_Args_Identify_); ok { + return x.Identify + } + return nil +} + +// Serialized into: +// [ +// "", +// { +// "user_identifiers": , +// "properties": +// } +// ] +type RequestRecord_Observed_SDKEvent_Args_Track struct { + Event string `protobuf:"bytes,1,opt,name=event,proto3" json:"event,omitempty"` + Options *RequestRecord_Observed_SDKEvent_Args_Track_Options `protobuf:"bytes,2,opt,name=options,proto3" json:"options,omitempty"` +} + +type RequestRecord_Observed_SDKEvent_Args_Track_Options struct { + Properties *Struct `protobuf:"bytes,1,opt,name=properties,proto3,customtype=Struct" json:"properties,omitempty"` + UserIdentifiers *Struct `protobuf:"bytes,2,opt,name=user_identifiers,json=userIdentifiers,proto3,customtype=Struct" json:"user_identifiers,omitempty"` +} + +// Serialized into: +// [ ] +type RequestRecord_Observed_SDKEvent_Args_Identify struct { + UserIdentifiers *Struct `protobuf:"bytes,1,opt,name=user_identifiers,json=userIdentifiers,proto3,customtype=Struct" json:"user_identifiers,omitempty"` +} + +type RequestRecord_Observed_Exception struct { + Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` + Klass string `protobuf:"bytes,2,opt,name=klass,proto3" json:"klass,omitempty"` + RuleName string `protobuf:"bytes,3,opt,name=rule_name,json=ruleName,proto3" json:"rule_name,omitempty"` + Test bool `protobuf:"varint,4,opt,name=test,proto3" json:"test,omitempty"` + Infos string `protobuf:"bytes,5,opt,name=infos,proto3" json:"infos,omitempty"` + Backtrace []string `protobuf:"bytes,6,rep,name=backtrace,proto3" json:"backtrace,omitempty"` + Time time.Time `protobuf:"bytes,7,opt,name=time,proto3,stdtime" json:"time"` +} + +type RequestRecord_Observed_Observation struct { + Category string `protobuf:"bytes,1,opt,name=category,proto3" json:"category,omitempty"` + Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` + Time time.Time `protobuf:"bytes,4,opt,name=time,proto3,stdtime" json:"time"` +} + +type RequestRecord_Observed_DataPoint struct { + RulespackId string `protobuf:"bytes,1,opt,name=rulespack_id,json=rulespackId,proto3" json:"rulespack_id,omitempty"` + RuleName string `protobuf:"bytes,2,opt,name=rule_name,json=ruleName,proto3" json:"rule_name,omitempty"` + Time time.Time `protobuf:"bytes,3,opt,name=time,proto3,stdtime" json:"time"` + Infos string `protobuf:"bytes,4,opt,name=infos,proto3" json:"infos,omitempty"` +} + +type AppLoginRequestFace interface { + GetBundleSignature() string + GetVariousInfos() AppLoginRequest_VariousInfos + GetAgentType() string + GetAgentVersion() string + GetOsType() string + GetHostname() string + GetRuntimeType() string + GetRuntimeVersion() string + GetFrameworkType() string + GetFrameworkVersion() string + GetEnvironment() string +} + +func (this *AppLoginRequest) GetBundleSignature() string { + return this.BundleSignature +} + +func (this *AppLoginRequest) GetVariousInfos() AppLoginRequest_VariousInfos { + return this.VariousInfos +} + +func (this *AppLoginRequest) GetAgentType() string { + return this.AgentType +} + +func (this *AppLoginRequest) GetAgentVersion() string { + return this.AgentVersion +} + +func (this *AppLoginRequest) GetOsType() string { + return this.OsType +} + +func (this *AppLoginRequest) GetHostname() string { + return this.Hostname +} + +func (this *AppLoginRequest) GetRuntimeType() string { + return this.RuntimeType +} + +func (this *AppLoginRequest) GetRuntimeVersion() string { + return this.RuntimeVersion +} + +func (this *AppLoginRequest) GetFrameworkType() string { + return this.FrameworkType +} + +func (this *AppLoginRequest) GetFrameworkVersion() string { + return this.FrameworkVersion +} + +func (this *AppLoginRequest) GetEnvironment() string { + return this.Environment +} + +func NewAppLoginRequestFromFace(that AppLoginRequestFace) *AppLoginRequest { + this := &AppLoginRequest{} + this.BundleSignature = that.GetBundleSignature() + this.VariousInfos = that.GetVariousInfos() + this.AgentType = that.GetAgentType() + this.AgentVersion = that.GetAgentVersion() + this.OsType = that.GetOsType() + this.Hostname = that.GetHostname() + this.RuntimeType = that.GetRuntimeType() + this.RuntimeVersion = that.GetRuntimeVersion() + this.FrameworkType = that.GetFrameworkType() + this.FrameworkVersion = that.GetFrameworkVersion() + this.Environment = that.GetEnvironment() + return this +} + +type AppLoginRequest_VariousInfosFace interface { + GetTime() time.Time + GetPid() uint32 + GetPpid() uint32 + GetEuid() uint32 + GetEgid() uint32 + GetUid() uint32 + GetGid() uint32 + GetName() string +} + +func (this *AppLoginRequest_VariousInfos) GetTime() time.Time { + return this.Time +} + +func (this *AppLoginRequest_VariousInfos) GetPid() uint32 { + return this.Pid +} + +func (this *AppLoginRequest_VariousInfos) GetPpid() uint32 { + return this.Ppid +} + +func (this *AppLoginRequest_VariousInfos) GetEuid() uint32 { + return this.Euid +} + +func (this *AppLoginRequest_VariousInfos) GetEgid() uint32 { + return this.Egid +} + +func (this *AppLoginRequest_VariousInfos) GetUid() uint32 { + return this.Uid +} + +func (this *AppLoginRequest_VariousInfos) GetGid() uint32 { + return this.Gid +} + +func (this *AppLoginRequest_VariousInfos) GetName() string { + return this.Name +} + +func NewAppLoginRequest_VariousInfosFromFace(that AppLoginRequest_VariousInfosFace) *AppLoginRequest_VariousInfos { + this := &AppLoginRequest_VariousInfos{} + this.Time = that.GetTime() + this.Pid = that.GetPid() + this.Ppid = that.GetPpid() + this.Euid = that.GetEuid() + this.Egid = that.GetEgid() + this.Uid = that.GetUid() + this.Gid = that.GetGid() + this.Name = that.GetName() + return this +} + +type AppLoginResponseFace interface { + GetSessionId() string + GetStatus() bool + GetCommands() []CommandRequest + GetFeatures() AppLoginResponse_Feature + GetPackId() string + GetRules() []Rule +} + +func (this *AppLoginResponse) GetSessionId() string { + return this.SessionId +} + +func (this *AppLoginResponse) GetStatus() bool { + return this.Status +} + +func (this *AppLoginResponse) GetCommands() []CommandRequest { + return this.Commands +} + +func (this *AppLoginResponse) GetFeatures() AppLoginResponse_Feature { + return this.Features +} + +func (this *AppLoginResponse) GetPackId() string { + return this.PackId +} + +func (this *AppLoginResponse) GetRules() []Rule { + return this.Rules +} + +func NewAppLoginResponseFromFace(that AppLoginResponseFace) *AppLoginResponse { + this := &AppLoginResponse{} + this.SessionId = that.GetSessionId() + this.Status = that.GetStatus() + this.Commands = that.GetCommands() + this.Features = that.GetFeatures() + this.PackId = that.GetPackId() + this.Rules = that.GetRules() + return this +} + +type AppLoginResponse_FeatureFace interface { + Proto() github_com_gogo_protobuf_proto.Message + GetBatchSize() uint32 + GetMaxStaleness() uint32 + GetHeartbeatDelay() uint32 +} + +func (this *AppLoginResponse_Feature) GetBatchSize() uint32 { + return this.BatchSize +} + +func (this *AppLoginResponse_Feature) GetMaxStaleness() uint32 { + return this.MaxStaleness +} + +func (this *AppLoginResponse_Feature) GetHeartbeatDelay() uint32 { + return this.HeartbeatDelay +} + +func NewAppLoginResponse_FeatureFromFace(that AppLoginResponse_FeatureFace) *AppLoginResponse_Feature { + this := &AppLoginResponse_Feature{} + this.BatchSize = that.GetBatchSize() + this.MaxStaleness = that.GetMaxStaleness() + this.HeartbeatDelay = that.GetHeartbeatDelay() + return this +} + +type CommandRequestFace interface { + Proto() github_com_gogo_protobuf_proto.Message + GetName() string + GetParams() []string + GetUuid() string +} + +func (this *CommandRequest) GetName() string { + return this.Name +} + +func (this *CommandRequest) GetParams() []string { + return this.Params +} + +func (this *CommandRequest) GetUuid() string { + return this.Uuid +} + +func NewCommandRequestFromFace(that CommandRequestFace) *CommandRequest { + this := &CommandRequest{} + this.Name = that.GetName() + this.Params = that.GetParams() + this.Uuid = that.GetUuid() + return this +} + +type CommandResultFace interface { + Proto() github_com_gogo_protobuf_proto.Message + GetOutput() string + GetStatus() bool +} + +func (this *CommandResult) GetOutput() string { + return this.Output +} + +func (this *CommandResult) GetStatus() bool { + return this.Status +} + +func NewCommandResultFromFace(that CommandResultFace) *CommandResult { + this := &CommandResult{} + this.Output = that.GetOutput() + this.Status = that.GetStatus() + return this +} + +type MetricResponseFace interface { + Proto() github_com_gogo_protobuf_proto.Message + GetName() string + GetStart() time.Time + GetFinish() time.Time + GetObservation() Struct +} + +func (this *MetricResponse) GetName() string { + return this.Name +} + +func (this *MetricResponse) GetStart() time.Time { + return this.Start +} + +func (this *MetricResponse) GetFinish() time.Time { + return this.Finish +} + +func (this *MetricResponse) GetObservation() Struct { + return this.Observation +} + +func NewMetricResponseFromFace(that MetricResponseFace) *MetricResponse { + this := &MetricResponse{} + this.Name = that.GetName() + this.Start = that.GetStart() + this.Finish = that.GetFinish() + this.Observation = that.GetObservation() + return this +} + +type AppBeatRequestFace interface { + GetCommandResults() map[string]CommandResult + GetMetrics() []MetricResponse +} + +func (this *AppBeatRequest) GetCommandResults() map[string]CommandResult { + return this.CommandResults +} + +func (this *AppBeatRequest) GetMetrics() []MetricResponse { + return this.Metrics +} + +func NewAppBeatRequestFromFace(that AppBeatRequestFace) *AppBeatRequest { + this := &AppBeatRequest{} + this.CommandResults = that.GetCommandResults() + this.Metrics = that.GetMetrics() + return this +} + +type AppBeatResponseFace interface { + GetCommands() []CommandRequest + GetStatus() bool +} + +func (this *AppBeatResponse) GetCommands() []CommandRequest { + return this.Commands +} + +func (this *AppBeatResponse) GetStatus() bool { + return this.Status +} + +func NewAppBeatResponseFromFace(that AppBeatResponseFace) *AppBeatResponse { + this := &AppBeatResponse{} + this.Commands = that.GetCommands() + this.Status = that.GetStatus() + return this +} + +type BatchRequestFace interface { + GetBatch() []BatchRequest_Event +} + +func (this *BatchRequest) GetBatch() []BatchRequest_Event { + return this.Batch +} + +func NewBatchRequestFromFace(that BatchRequestFace) *BatchRequest { + this := &BatchRequest{} + this.Batch = that.GetBatch() + return this +} + +type BatchRequest_EventFace interface { + GetEventType() string + GetEvent() Struct +} + +func (this *BatchRequest_Event) GetEventType() string { + return this.EventType +} + +func (this *BatchRequest_Event) GetEvent() Struct { + return this.Event +} + +func NewBatchRequest_EventFromFace(that BatchRequest_EventFace) *BatchRequest_Event { + this := &BatchRequest_Event{} + this.EventType = that.GetEventType() + this.Event = that.GetEvent() + return this +} + +type DependencyFace interface { + GetName() string + GetVersion() string + GetHomepage() string + GetSource() *Dependency_Source +} + +func (this *Dependency) GetName() string { + return this.Name +} + +func (this *Dependency) GetVersion() string { + return this.Version +} + +func (this *Dependency) GetHomepage() string { + return this.Homepage +} + +func (this *Dependency) GetSource() *Dependency_Source { + return this.Source +} + +func NewDependencyFromFace(that DependencyFace) *Dependency { + this := &Dependency{} + this.Name = that.GetName() + this.Version = that.GetVersion() + this.Homepage = that.GetHomepage() + this.Source = that.GetSource() + return this +} + +type Dependency_SourceFace interface { + GetName() string + GetRemotes() []string +} + +func (this *Dependency_Source) GetName() string { + return this.Name +} + +func (this *Dependency_Source) GetRemotes() []string { + return this.Remotes +} + +func NewDependency_SourceFromFace(that Dependency_SourceFace) *Dependency_Source { + this := &Dependency_Source{} + this.Name = that.GetName() + this.Remotes = that.GetRemotes() + return this +} + +type RequestRecordFace interface { + GetVersion() string + GetRulespackId() string + GetClientIp() string + GetRequest() RequestRecord_Request + GetResponse() RequestRecord_Response + GetObserved() RequestRecord_Observed +} + +func (this *RequestRecord) GetVersion() string { + return this.Version +} + +func (this *RequestRecord) GetRulespackId() string { + return this.RulespackId +} + +func (this *RequestRecord) GetClientIp() string { + return this.ClientIp +} + +func (this *RequestRecord) GetRequest() RequestRecord_Request { + return this.Request +} + +func (this *RequestRecord) GetResponse() RequestRecord_Response { + return this.Response +} + +func (this *RequestRecord) GetObserved() RequestRecord_Observed { + return this.Observed +} + +func NewRequestRecordFromFace(that RequestRecordFace) *RequestRecord { + this := &RequestRecord{} + this.Version = that.GetVersion() + this.RulespackId = that.GetRulespackId() + this.ClientIp = that.GetClientIp() + this.Request = that.GetRequest() + this.Response = that.GetResponse() + this.Observed = that.GetObserved() + return this +} + +type RequestRecord_RequestFace interface { + GetRid() string + GetHeaders() []RequestRecord_Request_Header + GetVerb() string + GetPath() string + GetRawPath() string + GetHost() string + GetPort() string + GetRemoteIp() string + GetRemotePort() string + GetScheme() string + GetUserAgent() string + GetReferer() string + GetParams() RequestRecord_Request_Params +} + +func (this *RequestRecord_Request) GetRid() string { + return this.Rid +} + +func (this *RequestRecord_Request) GetHeaders() []RequestRecord_Request_Header { + return this.Headers +} + +func (this *RequestRecord_Request) GetVerb() string { + return this.Verb +} + +func (this *RequestRecord_Request) GetPath() string { + return this.Path +} + +func (this *RequestRecord_Request) GetRawPath() string { + return this.RawPath +} + +func (this *RequestRecord_Request) GetHost() string { + return this.Host +} + +func (this *RequestRecord_Request) GetPort() string { + return this.Port +} + +func (this *RequestRecord_Request) GetRemoteIp() string { + return this.RemoteIp +} + +func (this *RequestRecord_Request) GetRemotePort() string { + return this.RemotePort +} + +func (this *RequestRecord_Request) GetScheme() string { + return this.Scheme +} + +func (this *RequestRecord_Request) GetUserAgent() string { + return this.UserAgent +} + +func (this *RequestRecord_Request) GetReferer() string { + return this.Referer +} + +func (this *RequestRecord_Request) GetParams() RequestRecord_Request_Params { + return this.Params +} + +func NewRequestRecord_RequestFromFace(that RequestRecord_RequestFace) *RequestRecord_Request { + this := &RequestRecord_Request{} + this.Rid = that.GetRid() + this.Headers = that.GetHeaders() + this.Verb = that.GetVerb() + this.Path = that.GetPath() + this.RawPath = that.GetRawPath() + this.Host = that.GetHost() + this.Port = that.GetPort() + this.RemoteIp = that.GetRemoteIp() + this.RemotePort = that.GetRemotePort() + this.Scheme = that.GetScheme() + this.UserAgent = that.GetUserAgent() + this.Referer = that.GetReferer() + this.Params = that.GetParams() + return this +} + +type RequestRecord_Request_HeaderFace interface { + GetKey() string + GetValue() string +} + +func (this *RequestRecord_Request_Header) GetKey() string { + return this.Key +} + +func (this *RequestRecord_Request_Header) GetValue() string { + return this.Value +} + +func NewRequestRecord_Request_HeaderFromFace(that RequestRecord_Request_HeaderFace) *RequestRecord_Request_Header { + this := &RequestRecord_Request_Header{} + this.Key = that.GetKey() + this.Value = that.GetValue() + return this +} + +type RequestRecord_ResponseFace interface { + GetStatus() uint32 + GetContentLength() uint32 + GetContentType() string +} + +func (this *RequestRecord_Response) GetStatus() uint32 { + return this.Status +} + +func (this *RequestRecord_Response) GetContentLength() uint32 { + return this.ContentLength +} + +func (this *RequestRecord_Response) GetContentType() string { + return this.ContentType +} + +func NewRequestRecord_ResponseFromFace(that RequestRecord_ResponseFace) *RequestRecord_Response { + this := &RequestRecord_Response{} + this.Status = that.GetStatus() + this.ContentLength = that.GetContentLength() + this.ContentType = that.GetContentType() + return this +} + +type RequestRecord_ObservedFace interface { + GetAttacks() []*RequestRecord_Observed_Attack + GetSdk() []*RequestRecord_Observed_SDKEvent + GetSqreenExceptions() []*RequestRecord_Observed_Exception + GetObservations() []*RequestRecord_Observed_Observation + GetDataPoints() []*RequestRecord_Observed_DataPoint +} + +func (this *RequestRecord_Observed) GetAttacks() []*RequestRecord_Observed_Attack { + return this.Attacks +} + +func (this *RequestRecord_Observed) GetSdk() []*RequestRecord_Observed_SDKEvent { + return this.Sdk +} + +func (this *RequestRecord_Observed) GetSqreenExceptions() []*RequestRecord_Observed_Exception { + return this.SqreenExceptions +} + +func (this *RequestRecord_Observed) GetObservations() []*RequestRecord_Observed_Observation { + return this.Observations +} + +func (this *RequestRecord_Observed) GetDataPoints() []*RequestRecord_Observed_DataPoint { + return this.DataPoints +} + +func NewRequestRecord_ObservedFromFace(that RequestRecord_ObservedFace) *RequestRecord_Observed { + this := &RequestRecord_Observed{} + this.Attacks = that.GetAttacks() + this.Sdk = that.GetSdk() + this.SqreenExceptions = that.GetSqreenExceptions() + this.Observations = that.GetObservations() + this.DataPoints = that.GetDataPoints() + return this +} + +type RequestRecord_Observed_AttackFace interface { + GetRuleName() string + GetTest() bool + GetInfos() string + GetBacktrace() []string + GetTime() time.Time + GetBlock() bool +} + +func (this *RequestRecord_Observed_Attack) GetRuleName() string { + return this.RuleName +} + +func (this *RequestRecord_Observed_Attack) GetTest() bool { + return this.Test +} + +func (this *RequestRecord_Observed_Attack) GetInfos() string { + return this.Infos +} + +func (this *RequestRecord_Observed_Attack) GetBacktrace() []string { + return this.Backtrace +} + +func (this *RequestRecord_Observed_Attack) GetTime() time.Time { + return this.Time +} + +func (this *RequestRecord_Observed_Attack) GetBlock() bool { + return this.Block +} + +func NewRequestRecord_Observed_AttackFromFace(that RequestRecord_Observed_AttackFace) *RequestRecord_Observed_Attack { + this := &RequestRecord_Observed_Attack{} + this.RuleName = that.GetRuleName() + this.Test = that.GetTest() + this.Infos = that.GetInfos() + this.Backtrace = that.GetBacktrace() + this.Time = that.GetTime() + this.Block = that.GetBlock() + return this +} + +type RequestRecord_Observed_SDKEventFace interface { + GetTime() time.Time + GetName() string + GetArgs() RequestRecord_Observed_SDKEvent_Args +} + +func (this *RequestRecord_Observed_SDKEvent) GetTime() time.Time { + return this.Time +} + +func (this *RequestRecord_Observed_SDKEvent) GetName() string { + return this.Name +} + +func (this *RequestRecord_Observed_SDKEvent) GetArgs() RequestRecord_Observed_SDKEvent_Args { + return this.Args +} + +func NewRequestRecord_Observed_SDKEventFromFace(that RequestRecord_Observed_SDKEventFace) *RequestRecord_Observed_SDKEvent { + this := &RequestRecord_Observed_SDKEvent{} + this.Time = that.GetTime() + this.Name = that.GetName() + this.Args = that.GetArgs() + return this +} + +type RequestRecord_Observed_SDKEvent_Args_TrackFace interface { + GetEvent() string + GetOptions() *RequestRecord_Observed_SDKEvent_Args_Track_Options +} + +func (this *RequestRecord_Observed_SDKEvent_Args_Track) GetEvent() string { + return this.Event +} + +func (this *RequestRecord_Observed_SDKEvent_Args_Track) GetOptions() *RequestRecord_Observed_SDKEvent_Args_Track_Options { + return this.Options +} + +func NewRequestRecord_Observed_SDKEvent_Args_TrackFromFace(that RequestRecord_Observed_SDKEvent_Args_TrackFace) *RequestRecord_Observed_SDKEvent_Args_Track { + this := &RequestRecord_Observed_SDKEvent_Args_Track{} + this.Event = that.GetEvent() + this.Options = that.GetOptions() + return this +} + +type RequestRecord_Observed_SDKEvent_Args_Track_OptionsFace interface { + GetProperties() *Struct + GetUserIdentifiers() *Struct +} + +func (this *RequestRecord_Observed_SDKEvent_Args_Track_Options) GetProperties() *Struct { + return this.Properties +} + +func (this *RequestRecord_Observed_SDKEvent_Args_Track_Options) GetUserIdentifiers() *Struct { + return this.UserIdentifiers +} + +func NewRequestRecord_Observed_SDKEvent_Args_Track_OptionsFromFace(that RequestRecord_Observed_SDKEvent_Args_Track_OptionsFace) *RequestRecord_Observed_SDKEvent_Args_Track_Options { + this := &RequestRecord_Observed_SDKEvent_Args_Track_Options{} + this.Properties = that.GetProperties() + this.UserIdentifiers = that.GetUserIdentifiers() + return this +} + +type RequestRecord_Observed_SDKEvent_Args_IdentifyFace interface { + GetUserIdentifiers() *Struct +} + +func (this *RequestRecord_Observed_SDKEvent_Args_Identify) GetUserIdentifiers() *Struct { + return this.UserIdentifiers +} + +func NewRequestRecord_Observed_SDKEvent_Args_IdentifyFromFace(that RequestRecord_Observed_SDKEvent_Args_IdentifyFace) *RequestRecord_Observed_SDKEvent_Args_Identify { + this := &RequestRecord_Observed_SDKEvent_Args_Identify{} + this.UserIdentifiers = that.GetUserIdentifiers() + return this +} + +type RequestRecord_Observed_ExceptionFace interface { + GetMessage() string + GetKlass() string + GetRuleName() string + GetTest() bool + GetInfos() string + GetBacktrace() []string + GetTime() time.Time +} + +func (this *RequestRecord_Observed_Exception) GetMessage() string { + return this.Message +} + +func (this *RequestRecord_Observed_Exception) GetKlass() string { + return this.Klass +} + +func (this *RequestRecord_Observed_Exception) GetRuleName() string { + return this.RuleName +} + +func (this *RequestRecord_Observed_Exception) GetTest() bool { + return this.Test +} + +func (this *RequestRecord_Observed_Exception) GetInfos() string { + return this.Infos +} + +func (this *RequestRecord_Observed_Exception) GetBacktrace() []string { + return this.Backtrace +} + +func (this *RequestRecord_Observed_Exception) GetTime() time.Time { + return this.Time +} + +func NewRequestRecord_Observed_ExceptionFromFace(that RequestRecord_Observed_ExceptionFace) *RequestRecord_Observed_Exception { + this := &RequestRecord_Observed_Exception{} + this.Message = that.GetMessage() + this.Klass = that.GetKlass() + this.RuleName = that.GetRuleName() + this.Test = that.GetTest() + this.Infos = that.GetInfos() + this.Backtrace = that.GetBacktrace() + this.Time = that.GetTime() + return this +} + +type RequestRecord_Observed_ObservationFace interface { + GetCategory() string + GetKey() string + GetValue() string + GetTime() time.Time +} + +func (this *RequestRecord_Observed_Observation) GetCategory() string { + return this.Category +} + +func (this *RequestRecord_Observed_Observation) GetKey() string { + return this.Key +} + +func (this *RequestRecord_Observed_Observation) GetValue() string { + return this.Value +} + +func (this *RequestRecord_Observed_Observation) GetTime() time.Time { + return this.Time +} + +func NewRequestRecord_Observed_ObservationFromFace(that RequestRecord_Observed_ObservationFace) *RequestRecord_Observed_Observation { + this := &RequestRecord_Observed_Observation{} + this.Category = that.GetCategory() + this.Key = that.GetKey() + this.Value = that.GetValue() + this.Time = that.GetTime() + return this +} + +type RequestRecord_Observed_DataPointFace interface { + GetRulespackId() string + GetRuleName() string + GetTime() time.Time + GetInfos() string +} + +func (this *RequestRecord_Observed_DataPoint) GetRulespackId() string { + return this.RulespackId +} + +func (this *RequestRecord_Observed_DataPoint) GetRuleName() string { + return this.RuleName +} + +func (this *RequestRecord_Observed_DataPoint) GetTime() time.Time { + return this.Time +} + +func (this *RequestRecord_Observed_DataPoint) GetInfos() string { + return this.Infos +} + +func NewRequestRecord_Observed_DataPointFromFace(that RequestRecord_Observed_DataPointFace) *RequestRecord_Observed_DataPoint { + this := &RequestRecord_Observed_DataPoint{} + this.RulespackId = that.GetRulespackId() + this.RuleName = that.GetRuleName() + this.Time = that.GetTime() + this.Infos = that.GetInfos() + return this +} diff --git a/agent/internal/backend/api/api.pb.go b/agent/internal/backend/api/api.pb.go deleted file mode 100644 index 3de3139e..00000000 --- a/agent/internal/backend/api/api.pb.go +++ /dev/null @@ -1,2979 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: agent/internal/backend/api/api.proto - -package api - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" - proto "github.com/gogo/protobuf/proto" - _ "github.com/gogo/protobuf/types" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - math "math" - time "time" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf -var _ = time.Kitchen - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type AppLoginRequest struct { - BundleSignature string `protobuf:"bytes,1,opt,name=bundle_signature,json=bundleSignature,proto3" json:"bundle_signature,omitempty"` - VariousInfos AppLoginRequest_VariousInfos `protobuf:"bytes,2,opt,name=various_infos,json=variousInfos,proto3" json:"various_infos"` - AgentType string `protobuf:"bytes,3,opt,name=agent_type,json=agentType,proto3" json:"agent_type,omitempty"` - AgentVersion string `protobuf:"bytes,4,opt,name=agent_version,json=agentVersion,proto3" json:"agent_version,omitempty"` - OsType string `protobuf:"bytes,5,opt,name=os_type,json=osType,proto3" json:"os_type,omitempty"` - Hostname string `protobuf:"bytes,6,opt,name=hostname,proto3" json:"hostname,omitempty"` - RuntimeType string `protobuf:"bytes,7,opt,name=runtime_type,json=runtimeType,proto3" json:"runtime_type,omitempty"` - RuntimeVersion string `protobuf:"bytes,8,opt,name=runtime_version,json=runtimeVersion,proto3" json:"runtime_version,omitempty"` - FrameworkType string `protobuf:"bytes,9,opt,name=framework_type,json=frameworkType,proto3" json:"framework_type,omitempty"` - FrameworkVersion string `protobuf:"bytes,10,opt,name=framework_version,json=frameworkVersion,proto3" json:"framework_version,omitempty"` - Environment string `protobuf:"bytes,11,opt,name=environment,proto3" json:"environment,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AppLoginRequest) Reset() { *m = AppLoginRequest{} } -func (m *AppLoginRequest) String() string { return proto.CompactTextString(m) } -func (*AppLoginRequest) ProtoMessage() {} -func (*AppLoginRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_aa33db9090833f07, []int{0} -} -func (m *AppLoginRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AppLoginRequest.Unmarshal(m, b) -} -func (m *AppLoginRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AppLoginRequest.Marshal(b, m, deterministic) -} -func (m *AppLoginRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_AppLoginRequest.Merge(m, src) -} -func (m *AppLoginRequest) XXX_Size() int { - return xxx_messageInfo_AppLoginRequest.Size(m) -} -func (m *AppLoginRequest) XXX_DiscardUnknown() { - xxx_messageInfo_AppLoginRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_AppLoginRequest proto.InternalMessageInfo - -type AppLoginRequest_VariousInfos struct { - Time time.Time `protobuf:"bytes,1,opt,name=time,proto3,stdtime" json:"time"` - Pid uint32 `protobuf:"varint,3,opt,name=pid,proto3" json:"pid,omitempty"` - Ppid uint32 `protobuf:"varint,4,opt,name=ppid,proto3" json:"ppid,omitempty"` - Euid uint32 `protobuf:"varint,5,opt,name=euid,proto3" json:"euid,omitempty"` - Egid uint32 `protobuf:"varint,6,opt,name=egid,proto3" json:"egid,omitempty"` - Uid uint32 `protobuf:"varint,7,opt,name=uid,proto3" json:"uid,omitempty"` - Gid uint32 `protobuf:"varint,8,opt,name=gid,proto3" json:"gid,omitempty"` - Name string `protobuf:"bytes,9,opt,name=name,proto3" json:"name,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AppLoginRequest_VariousInfos) Reset() { *m = AppLoginRequest_VariousInfos{} } -func (m *AppLoginRequest_VariousInfos) String() string { return proto.CompactTextString(m) } -func (*AppLoginRequest_VariousInfos) ProtoMessage() {} -func (*AppLoginRequest_VariousInfos) Descriptor() ([]byte, []int) { - return fileDescriptor_aa33db9090833f07, []int{0, 0} -} -func (m *AppLoginRequest_VariousInfos) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AppLoginRequest_VariousInfos.Unmarshal(m, b) -} -func (m *AppLoginRequest_VariousInfos) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AppLoginRequest_VariousInfos.Marshal(b, m, deterministic) -} -func (m *AppLoginRequest_VariousInfos) XXX_Merge(src proto.Message) { - xxx_messageInfo_AppLoginRequest_VariousInfos.Merge(m, src) -} -func (m *AppLoginRequest_VariousInfos) XXX_Size() int { - return xxx_messageInfo_AppLoginRequest_VariousInfos.Size(m) -} -func (m *AppLoginRequest_VariousInfos) XXX_DiscardUnknown() { - xxx_messageInfo_AppLoginRequest_VariousInfos.DiscardUnknown(m) -} - -var xxx_messageInfo_AppLoginRequest_VariousInfos proto.InternalMessageInfo - -type AppLoginResponse struct { - SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` - Status bool `protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"` - Commands []CommandRequest `protobuf:"bytes,3,rep,name=commands,proto3" json:"commands"` - Features AppLoginResponse_Feature `protobuf:"bytes,4,opt,name=features,proto3" json:"features"` - PackId string `protobuf:"bytes,5,opt,name=pack_id,json=packId,proto3" json:"pack_id,omitempty"` - Rules []Rule `protobuf:"bytes,6,rep,name=rules,proto3" json:"rules"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AppLoginResponse) Reset() { *m = AppLoginResponse{} } -func (m *AppLoginResponse) String() string { return proto.CompactTextString(m) } -func (*AppLoginResponse) ProtoMessage() {} -func (*AppLoginResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_aa33db9090833f07, []int{1} -} -func (m *AppLoginResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AppLoginResponse.Unmarshal(m, b) -} -func (m *AppLoginResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AppLoginResponse.Marshal(b, m, deterministic) -} -func (m *AppLoginResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_AppLoginResponse.Merge(m, src) -} -func (m *AppLoginResponse) XXX_Size() int { - return xxx_messageInfo_AppLoginResponse.Size(m) -} -func (m *AppLoginResponse) XXX_DiscardUnknown() { - xxx_messageInfo_AppLoginResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_AppLoginResponse proto.InternalMessageInfo - -type AppLoginResponse_Feature struct { - BatchSize uint32 `protobuf:"varint,1,opt,name=batch_size,json=batchSize,proto3" json:"batch_size,omitempty"` - MaxStaleness uint32 `protobuf:"varint,2,opt,name=max_staleness,json=maxStaleness,proto3" json:"max_staleness,omitempty"` - HeartbeatDelay uint32 `protobuf:"varint,3,opt,name=heartbeat_delay,json=heartbeatDelay,proto3" json:"heartbeat_delay,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AppLoginResponse_Feature) Reset() { *m = AppLoginResponse_Feature{} } -func (m *AppLoginResponse_Feature) String() string { return proto.CompactTextString(m) } -func (*AppLoginResponse_Feature) ProtoMessage() {} -func (*AppLoginResponse_Feature) Descriptor() ([]byte, []int) { - return fileDescriptor_aa33db9090833f07, []int{1, 0} -} -func (m *AppLoginResponse_Feature) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AppLoginResponse_Feature.Unmarshal(m, b) -} -func (m *AppLoginResponse_Feature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AppLoginResponse_Feature.Marshal(b, m, deterministic) -} -func (m *AppLoginResponse_Feature) XXX_Merge(src proto.Message) { - xxx_messageInfo_AppLoginResponse_Feature.Merge(m, src) -} -func (m *AppLoginResponse_Feature) XXX_Size() int { - return xxx_messageInfo_AppLoginResponse_Feature.Size(m) -} -func (m *AppLoginResponse_Feature) XXX_DiscardUnknown() { - xxx_messageInfo_AppLoginResponse_Feature.DiscardUnknown(m) -} - -var xxx_messageInfo_AppLoginResponse_Feature proto.InternalMessageInfo - -type CommandRequest struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Params []string `protobuf:"bytes,2,rep,name=params,proto3" json:"params,omitempty"` - Uuid string `protobuf:"bytes,3,opt,name=uuid,proto3" json:"uuid,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CommandRequest) Reset() { *m = CommandRequest{} } -func (m *CommandRequest) String() string { return proto.CompactTextString(m) } -func (*CommandRequest) ProtoMessage() {} -func (*CommandRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_aa33db9090833f07, []int{2} -} -func (m *CommandRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CommandRequest.Unmarshal(m, b) -} -func (m *CommandRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CommandRequest.Marshal(b, m, deterministic) -} -func (m *CommandRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_CommandRequest.Merge(m, src) -} -func (m *CommandRequest) XXX_Size() int { - return xxx_messageInfo_CommandRequest.Size(m) -} -func (m *CommandRequest) XXX_DiscardUnknown() { - xxx_messageInfo_CommandRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_CommandRequest proto.InternalMessageInfo - -type CommandResult struct { - Output string `protobuf:"bytes,1,opt,name=output,proto3" json:"output,omitempty"` - Status bool `protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *CommandResult) Reset() { *m = CommandResult{} } -func (m *CommandResult) String() string { return proto.CompactTextString(m) } -func (*CommandResult) ProtoMessage() {} -func (*CommandResult) Descriptor() ([]byte, []int) { - return fileDescriptor_aa33db9090833f07, []int{3} -} -func (m *CommandResult) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_CommandResult.Unmarshal(m, b) -} -func (m *CommandResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_CommandResult.Marshal(b, m, deterministic) -} -func (m *CommandResult) XXX_Merge(src proto.Message) { - xxx_messageInfo_CommandResult.Merge(m, src) -} -func (m *CommandResult) XXX_Size() int { - return xxx_messageInfo_CommandResult.Size(m) -} -func (m *CommandResult) XXX_DiscardUnknown() { - xxx_messageInfo_CommandResult.DiscardUnknown(m) -} - -var xxx_messageInfo_CommandResult proto.InternalMessageInfo - -type MetricResponse struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Start time.Time `protobuf:"bytes,2,opt,name=start,proto3,stdtime" json:"start"` - Finish time.Time `protobuf:"bytes,3,opt,name=finish,proto3,stdtime" json:"finish"` - Observation Struct `protobuf:"bytes,4,opt,name=observation,proto3,customtype=Struct" json:"observation"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *MetricResponse) Reset() { *m = MetricResponse{} } -func (m *MetricResponse) String() string { return proto.CompactTextString(m) } -func (*MetricResponse) ProtoMessage() {} -func (*MetricResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_aa33db9090833f07, []int{4} -} -func (m *MetricResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MetricResponse.Unmarshal(m, b) -} -func (m *MetricResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MetricResponse.Marshal(b, m, deterministic) -} -func (m *MetricResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MetricResponse.Merge(m, src) -} -func (m *MetricResponse) XXX_Size() int { - return xxx_messageInfo_MetricResponse.Size(m) -} -func (m *MetricResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MetricResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MetricResponse proto.InternalMessageInfo - -type AppBeatRequest struct { - CommandResults map[string]CommandResult `protobuf:"bytes,1,rep,name=command_results,json=commandResults,proto3" json:"command_results" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Metrics []MetricResponse `protobuf:"bytes,2,rep,name=metrics,proto3" json:"metrics"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AppBeatRequest) Reset() { *m = AppBeatRequest{} } -func (m *AppBeatRequest) String() string { return proto.CompactTextString(m) } -func (*AppBeatRequest) ProtoMessage() {} -func (*AppBeatRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_aa33db9090833f07, []int{5} -} -func (m *AppBeatRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AppBeatRequest.Unmarshal(m, b) -} -func (m *AppBeatRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AppBeatRequest.Marshal(b, m, deterministic) -} -func (m *AppBeatRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_AppBeatRequest.Merge(m, src) -} -func (m *AppBeatRequest) XXX_Size() int { - return xxx_messageInfo_AppBeatRequest.Size(m) -} -func (m *AppBeatRequest) XXX_DiscardUnknown() { - xxx_messageInfo_AppBeatRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_AppBeatRequest proto.InternalMessageInfo - -type AppBeatResponse struct { - Commands []CommandRequest `protobuf:"bytes,1,rep,name=commands,proto3" json:"commands"` - Status bool `protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *AppBeatResponse) Reset() { *m = AppBeatResponse{} } -func (m *AppBeatResponse) String() string { return proto.CompactTextString(m) } -func (*AppBeatResponse) ProtoMessage() {} -func (*AppBeatResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_aa33db9090833f07, []int{6} -} -func (m *AppBeatResponse) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AppBeatResponse.Unmarshal(m, b) -} -func (m *AppBeatResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AppBeatResponse.Marshal(b, m, deterministic) -} -func (m *AppBeatResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_AppBeatResponse.Merge(m, src) -} -func (m *AppBeatResponse) XXX_Size() int { - return xxx_messageInfo_AppBeatResponse.Size(m) -} -func (m *AppBeatResponse) XXX_DiscardUnknown() { - xxx_messageInfo_AppBeatResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_AppBeatResponse proto.InternalMessageInfo - -type BatchRequest struct { - Batch []BatchRequest_Event `protobuf:"bytes,1,rep,name=batch,proto3" json:"batch"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BatchRequest) Reset() { *m = BatchRequest{} } -func (m *BatchRequest) String() string { return proto.CompactTextString(m) } -func (*BatchRequest) ProtoMessage() {} -func (*BatchRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_aa33db9090833f07, []int{7} -} -func (m *BatchRequest) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_BatchRequest.Unmarshal(m, b) -} -func (m *BatchRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_BatchRequest.Marshal(b, m, deterministic) -} -func (m *BatchRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_BatchRequest.Merge(m, src) -} -func (m *BatchRequest) XXX_Size() int { - return xxx_messageInfo_BatchRequest.Size(m) -} -func (m *BatchRequest) XXX_DiscardUnknown() { - xxx_messageInfo_BatchRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_BatchRequest proto.InternalMessageInfo - -type BatchRequest_Event struct { - EventType string `protobuf:"bytes,1,opt,name=event_type,json=eventType,proto3" json:"event_type,omitempty"` - Event Struct `protobuf:"bytes,2,opt,name=event,proto3,customtype=Struct" json:"event"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *BatchRequest_Event) Reset() { *m = BatchRequest_Event{} } -func (m *BatchRequest_Event) String() string { return proto.CompactTextString(m) } -func (*BatchRequest_Event) ProtoMessage() {} -func (*BatchRequest_Event) Descriptor() ([]byte, []int) { - return fileDescriptor_aa33db9090833f07, []int{7, 0} -} -func (m *BatchRequest_Event) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_BatchRequest_Event.Unmarshal(m, b) -} -func (m *BatchRequest_Event) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_BatchRequest_Event.Marshal(b, m, deterministic) -} -func (m *BatchRequest_Event) XXX_Merge(src proto.Message) { - xxx_messageInfo_BatchRequest_Event.Merge(m, src) -} -func (m *BatchRequest_Event) XXX_Size() int { - return xxx_messageInfo_BatchRequest_Event.Size(m) -} -func (m *BatchRequest_Event) XXX_DiscardUnknown() { - xxx_messageInfo_BatchRequest_Event.DiscardUnknown(m) -} - -var xxx_messageInfo_BatchRequest_Event proto.InternalMessageInfo - -type Rule struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Rule) Reset() { *m = Rule{} } -func (m *Rule) String() string { return proto.CompactTextString(m) } -func (*Rule) ProtoMessage() {} -func (*Rule) Descriptor() ([]byte, []int) { - return fileDescriptor_aa33db9090833f07, []int{8} -} -func (m *Rule) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Rule.Unmarshal(m, b) -} -func (m *Rule) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Rule.Marshal(b, m, deterministic) -} -func (m *Rule) XXX_Merge(src proto.Message) { - xxx_messageInfo_Rule.Merge(m, src) -} -func (m *Rule) XXX_Size() int { - return xxx_messageInfo_Rule.Size(m) -} -func (m *Rule) XXX_DiscardUnknown() { - xxx_messageInfo_Rule.DiscardUnknown(m) -} - -var xxx_messageInfo_Rule proto.InternalMessageInfo - -type Dependency struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` - Homepage string `protobuf:"bytes,3,opt,name=homepage,proto3" json:"homepage,omitempty"` - Source *Dependency_Source `protobuf:"bytes,4,opt,name=source,proto3" json:"source,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Dependency) Reset() { *m = Dependency{} } -func (m *Dependency) String() string { return proto.CompactTextString(m) } -func (*Dependency) ProtoMessage() {} -func (*Dependency) Descriptor() ([]byte, []int) { - return fileDescriptor_aa33db9090833f07, []int{9} -} -func (m *Dependency) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Dependency.Unmarshal(m, b) -} -func (m *Dependency) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Dependency.Marshal(b, m, deterministic) -} -func (m *Dependency) XXX_Merge(src proto.Message) { - xxx_messageInfo_Dependency.Merge(m, src) -} -func (m *Dependency) XXX_Size() int { - return xxx_messageInfo_Dependency.Size(m) -} -func (m *Dependency) XXX_DiscardUnknown() { - xxx_messageInfo_Dependency.DiscardUnknown(m) -} - -var xxx_messageInfo_Dependency proto.InternalMessageInfo - -type Dependency_Source struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Remotes []string `protobuf:"bytes,2,rep,name=remotes,proto3" json:"remotes,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Dependency_Source) Reset() { *m = Dependency_Source{} } -func (m *Dependency_Source) String() string { return proto.CompactTextString(m) } -func (*Dependency_Source) ProtoMessage() {} -func (*Dependency_Source) Descriptor() ([]byte, []int) { - return fileDescriptor_aa33db9090833f07, []int{9, 0} -} -func (m *Dependency_Source) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Dependency_Source.Unmarshal(m, b) -} -func (m *Dependency_Source) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Dependency_Source.Marshal(b, m, deterministic) -} -func (m *Dependency_Source) XXX_Merge(src proto.Message) { - xxx_messageInfo_Dependency_Source.Merge(m, src) -} -func (m *Dependency_Source) XXX_Size() int { - return xxx_messageInfo_Dependency_Source.Size(m) -} -func (m *Dependency_Source) XXX_DiscardUnknown() { - xxx_messageInfo_Dependency_Source.DiscardUnknown(m) -} - -var xxx_messageInfo_Dependency_Source proto.InternalMessageInfo - -type RequestRecord struct { - Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` - RulespackId string `protobuf:"bytes,2,opt,name=rulespack_id,json=rulespackId,proto3" json:"rulespack_id"` - ClientIp string `protobuf:"bytes,3,opt,name=client_ip,json=clientIp,proto3" json:"client_ip"` - Request RequestRecord_Request `protobuf:"bytes,4,opt,name=request,proto3" json:"request"` - Response RequestRecord_Response `protobuf:"bytes,5,opt,name=response,proto3" json:"response"` - Observed RequestRecord_Observed `protobuf:"bytes,6,opt,name=observed,proto3" json:"observed"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RequestRecord) Reset() { *m = RequestRecord{} } -func (m *RequestRecord) String() string { return proto.CompactTextString(m) } -func (*RequestRecord) ProtoMessage() {} -func (*RequestRecord) Descriptor() ([]byte, []int) { - return fileDescriptor_aa33db9090833f07, []int{10} -} -func (m *RequestRecord) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RequestRecord.Unmarshal(m, b) -} -func (m *RequestRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RequestRecord.Marshal(b, m, deterministic) -} -func (m *RequestRecord) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestRecord.Merge(m, src) -} -func (m *RequestRecord) XXX_Size() int { - return xxx_messageInfo_RequestRecord.Size(m) -} -func (m *RequestRecord) XXX_DiscardUnknown() { - xxx_messageInfo_RequestRecord.DiscardUnknown(m) -} - -var xxx_messageInfo_RequestRecord proto.InternalMessageInfo - -type RequestRecord_Request struct { - Rid string `protobuf:"bytes,1,opt,name=rid,proto3" json:"rid,omitempty"` - Headers []RequestRecord_Request_Header `protobuf:"bytes,2,rep,name=headers,proto3" json:"headers"` - Verb string `protobuf:"bytes,3,opt,name=verb,proto3" json:"verb,omitempty"` - Path string `protobuf:"bytes,4,opt,name=path,proto3" json:"path,omitempty"` - RawPath string `protobuf:"bytes,5,opt,name=raw_path,json=rawPath,proto3" json:"raw_path,omitempty"` - Host string `protobuf:"bytes,6,opt,name=host,proto3" json:"host,omitempty"` - Port string `protobuf:"bytes,7,opt,name=port,proto3" json:"port,omitempty"` - RemoteIp string `protobuf:"bytes,8,opt,name=remote_ip,json=remoteIp,proto3" json:"remote_ip,omitempty"` - RemotePort string `protobuf:"bytes,9,opt,name=remote_port,json=remotePort,proto3" json:"remote_port,omitempty"` - Scheme string `protobuf:"bytes,10,opt,name=scheme,proto3" json:"scheme,omitempty"` - UserAgent string `protobuf:"bytes,11,opt,name=user_agent,json=userAgent,proto3" json:"user_agent,omitempty"` - Referer string `protobuf:"bytes,12,opt,name=referer,proto3" json:"referer,omitempty"` - Params RequestRecord_Request_Params `protobuf:"bytes,13,opt,name=params,proto3" json:"params"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RequestRecord_Request) Reset() { *m = RequestRecord_Request{} } -func (m *RequestRecord_Request) String() string { return proto.CompactTextString(m) } -func (*RequestRecord_Request) ProtoMessage() {} -func (*RequestRecord_Request) Descriptor() ([]byte, []int) { - return fileDescriptor_aa33db9090833f07, []int{10, 0} -} -func (m *RequestRecord_Request) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RequestRecord_Request.Unmarshal(m, b) -} -func (m *RequestRecord_Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RequestRecord_Request.Marshal(b, m, deterministic) -} -func (m *RequestRecord_Request) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestRecord_Request.Merge(m, src) -} -func (m *RequestRecord_Request) XXX_Size() int { - return xxx_messageInfo_RequestRecord_Request.Size(m) -} -func (m *RequestRecord_Request) XXX_DiscardUnknown() { - xxx_messageInfo_RequestRecord_Request.DiscardUnknown(m) -} - -var xxx_messageInfo_RequestRecord_Request proto.InternalMessageInfo - -type RequestRecord_Request_Header struct { - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RequestRecord_Request_Header) Reset() { *m = RequestRecord_Request_Header{} } -func (m *RequestRecord_Request_Header) String() string { return proto.CompactTextString(m) } -func (*RequestRecord_Request_Header) ProtoMessage() {} -func (*RequestRecord_Request_Header) Descriptor() ([]byte, []int) { - return fileDescriptor_aa33db9090833f07, []int{10, 0, 0} -} -func (m *RequestRecord_Request_Header) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RequestRecord_Request_Header.Unmarshal(m, b) -} -func (m *RequestRecord_Request_Header) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RequestRecord_Request_Header.Marshal(b, m, deterministic) -} -func (m *RequestRecord_Request_Header) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestRecord_Request_Header.Merge(m, src) -} -func (m *RequestRecord_Request_Header) XXX_Size() int { - return xxx_messageInfo_RequestRecord_Request_Header.Size(m) -} -func (m *RequestRecord_Request_Header) XXX_DiscardUnknown() { - xxx_messageInfo_RequestRecord_Request_Header.DiscardUnknown(m) -} - -var xxx_messageInfo_RequestRecord_Request_Header proto.InternalMessageInfo - -type RequestRecord_Request_Params struct { - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RequestRecord_Request_Params) Reset() { *m = RequestRecord_Request_Params{} } -func (m *RequestRecord_Request_Params) String() string { return proto.CompactTextString(m) } -func (*RequestRecord_Request_Params) ProtoMessage() {} -func (*RequestRecord_Request_Params) Descriptor() ([]byte, []int) { - return fileDescriptor_aa33db9090833f07, []int{10, 0, 1} -} -func (m *RequestRecord_Request_Params) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RequestRecord_Request_Params.Unmarshal(m, b) -} -func (m *RequestRecord_Request_Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RequestRecord_Request_Params.Marshal(b, m, deterministic) -} -func (m *RequestRecord_Request_Params) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestRecord_Request_Params.Merge(m, src) -} -func (m *RequestRecord_Request_Params) XXX_Size() int { - return xxx_messageInfo_RequestRecord_Request_Params.Size(m) -} -func (m *RequestRecord_Request_Params) XXX_DiscardUnknown() { - xxx_messageInfo_RequestRecord_Request_Params.DiscardUnknown(m) -} - -var xxx_messageInfo_RequestRecord_Request_Params proto.InternalMessageInfo - -type RequestRecord_Response struct { - Status uint32 `protobuf:"varint,1,opt,name=status,proto3" json:"status,omitempty"` - ContentLength uint32 `protobuf:"varint,2,opt,name=content_length,json=contentLength,proto3" json:"content_length,omitempty"` - ContentType string `protobuf:"bytes,3,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RequestRecord_Response) Reset() { *m = RequestRecord_Response{} } -func (m *RequestRecord_Response) String() string { return proto.CompactTextString(m) } -func (*RequestRecord_Response) ProtoMessage() {} -func (*RequestRecord_Response) Descriptor() ([]byte, []int) { - return fileDescriptor_aa33db9090833f07, []int{10, 1} -} -func (m *RequestRecord_Response) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RequestRecord_Response.Unmarshal(m, b) -} -func (m *RequestRecord_Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RequestRecord_Response.Marshal(b, m, deterministic) -} -func (m *RequestRecord_Response) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestRecord_Response.Merge(m, src) -} -func (m *RequestRecord_Response) XXX_Size() int { - return xxx_messageInfo_RequestRecord_Response.Size(m) -} -func (m *RequestRecord_Response) XXX_DiscardUnknown() { - xxx_messageInfo_RequestRecord_Response.DiscardUnknown(m) -} - -var xxx_messageInfo_RequestRecord_Response proto.InternalMessageInfo - -type RequestRecord_Observed struct { - Attacks []*RequestRecord_Observed_Attack `protobuf:"bytes,1,rep,name=attacks,proto3" json:"attacks,omitempty"` - Sdk []*RequestRecord_Observed_SDKEvent `protobuf:"bytes,2,rep,name=sdk,proto3" json:"sdk,omitempty"` - SqreenExceptions []*RequestRecord_Observed_Exception `protobuf:"bytes,3,rep,name=sqreen_exceptions,json=sqreenExceptions,proto3" json:"sqreen_exceptions,omitempty"` - Observations []*RequestRecord_Observed_Observation `protobuf:"bytes,4,rep,name=observations,proto3" json:"observations,omitempty"` - DataPoints []*RequestRecord_Observed_DataPoint `protobuf:"bytes,5,rep,name=data_points,json=dataPoints,proto3" json:"data_points,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RequestRecord_Observed) Reset() { *m = RequestRecord_Observed{} } -func (m *RequestRecord_Observed) String() string { return proto.CompactTextString(m) } -func (*RequestRecord_Observed) ProtoMessage() {} -func (*RequestRecord_Observed) Descriptor() ([]byte, []int) { - return fileDescriptor_aa33db9090833f07, []int{10, 2} -} -func (m *RequestRecord_Observed) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RequestRecord_Observed.Unmarshal(m, b) -} -func (m *RequestRecord_Observed) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RequestRecord_Observed.Marshal(b, m, deterministic) -} -func (m *RequestRecord_Observed) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestRecord_Observed.Merge(m, src) -} -func (m *RequestRecord_Observed) XXX_Size() int { - return xxx_messageInfo_RequestRecord_Observed.Size(m) -} -func (m *RequestRecord_Observed) XXX_DiscardUnknown() { - xxx_messageInfo_RequestRecord_Observed.DiscardUnknown(m) -} - -var xxx_messageInfo_RequestRecord_Observed proto.InternalMessageInfo - -type RequestRecord_Observed_Attack struct { - RuleName string `protobuf:"bytes,1,opt,name=rule_name,json=ruleName,proto3" json:"rule_name,omitempty"` - Test bool `protobuf:"varint,2,opt,name=test,proto3" json:"test,omitempty"` - Infos string `protobuf:"bytes,3,opt,name=infos,proto3" json:"infos,omitempty"` - Backtrace []string `protobuf:"bytes,4,rep,name=backtrace,proto3" json:"backtrace,omitempty"` - Time time.Time `protobuf:"bytes,5,opt,name=time,proto3,stdtime" json:"time"` - Block bool `protobuf:"varint,6,opt,name=block,proto3" json:"block,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RequestRecord_Observed_Attack) Reset() { *m = RequestRecord_Observed_Attack{} } -func (m *RequestRecord_Observed_Attack) String() string { return proto.CompactTextString(m) } -func (*RequestRecord_Observed_Attack) ProtoMessage() {} -func (*RequestRecord_Observed_Attack) Descriptor() ([]byte, []int) { - return fileDescriptor_aa33db9090833f07, []int{10, 2, 0} -} -func (m *RequestRecord_Observed_Attack) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RequestRecord_Observed_Attack.Unmarshal(m, b) -} -func (m *RequestRecord_Observed_Attack) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RequestRecord_Observed_Attack.Marshal(b, m, deterministic) -} -func (m *RequestRecord_Observed_Attack) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestRecord_Observed_Attack.Merge(m, src) -} -func (m *RequestRecord_Observed_Attack) XXX_Size() int { - return xxx_messageInfo_RequestRecord_Observed_Attack.Size(m) -} -func (m *RequestRecord_Observed_Attack) XXX_DiscardUnknown() { - xxx_messageInfo_RequestRecord_Observed_Attack.DiscardUnknown(m) -} - -var xxx_messageInfo_RequestRecord_Observed_Attack proto.InternalMessageInfo - -type RequestRecord_Observed_SDKEvent struct { - Time time.Time `protobuf:"bytes,1,opt,name=time,proto3,stdtime" json:"time"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Args RequestRecord_Observed_SDKEvent_Args `protobuf:"bytes,3,opt,name=args,proto3" json:"args"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RequestRecord_Observed_SDKEvent) Reset() { *m = RequestRecord_Observed_SDKEvent{} } -func (m *RequestRecord_Observed_SDKEvent) String() string { return proto.CompactTextString(m) } -func (*RequestRecord_Observed_SDKEvent) ProtoMessage() {} -func (*RequestRecord_Observed_SDKEvent) Descriptor() ([]byte, []int) { - return fileDescriptor_aa33db9090833f07, []int{10, 2, 1} -} -func (m *RequestRecord_Observed_SDKEvent) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RequestRecord_Observed_SDKEvent.Unmarshal(m, b) -} -func (m *RequestRecord_Observed_SDKEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RequestRecord_Observed_SDKEvent.Marshal(b, m, deterministic) -} -func (m *RequestRecord_Observed_SDKEvent) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestRecord_Observed_SDKEvent.Merge(m, src) -} -func (m *RequestRecord_Observed_SDKEvent) XXX_Size() int { - return xxx_messageInfo_RequestRecord_Observed_SDKEvent.Size(m) -} -func (m *RequestRecord_Observed_SDKEvent) XXX_DiscardUnknown() { - xxx_messageInfo_RequestRecord_Observed_SDKEvent.DiscardUnknown(m) -} - -var xxx_messageInfo_RequestRecord_Observed_SDKEvent proto.InternalMessageInfo - -// Helper message type to disable the face extension only on it and not in -// the entire SDKEvent message type. oneof + face is not supported. -type RequestRecord_Observed_SDKEvent_Args struct { - // Types that are valid to be assigned to Args: - // *RequestRecord_Observed_SDKEvent_Args_Track_ - // *RequestRecord_Observed_SDKEvent_Args_Identify_ - Args isRequestRecord_Observed_SDKEvent_Args_Args `protobuf_oneof:"args"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RequestRecord_Observed_SDKEvent_Args) Reset() { *m = RequestRecord_Observed_SDKEvent_Args{} } -func (m *RequestRecord_Observed_SDKEvent_Args) String() string { return proto.CompactTextString(m) } -func (*RequestRecord_Observed_SDKEvent_Args) ProtoMessage() {} -func (*RequestRecord_Observed_SDKEvent_Args) Descriptor() ([]byte, []int) { - return fileDescriptor_aa33db9090833f07, []int{10, 2, 1, 0} -} -func (m *RequestRecord_Observed_SDKEvent_Args) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RequestRecord_Observed_SDKEvent_Args.Unmarshal(m, b) -} -func (m *RequestRecord_Observed_SDKEvent_Args) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RequestRecord_Observed_SDKEvent_Args.Marshal(b, m, deterministic) -} -func (m *RequestRecord_Observed_SDKEvent_Args) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestRecord_Observed_SDKEvent_Args.Merge(m, src) -} -func (m *RequestRecord_Observed_SDKEvent_Args) XXX_Size() int { - return xxx_messageInfo_RequestRecord_Observed_SDKEvent_Args.Size(m) -} -func (m *RequestRecord_Observed_SDKEvent_Args) XXX_DiscardUnknown() { - xxx_messageInfo_RequestRecord_Observed_SDKEvent_Args.DiscardUnknown(m) -} - -var xxx_messageInfo_RequestRecord_Observed_SDKEvent_Args proto.InternalMessageInfo - -type isRequestRecord_Observed_SDKEvent_Args_Args interface { - isRequestRecord_Observed_SDKEvent_Args_Args() -} - -type RequestRecord_Observed_SDKEvent_Args_Track_ struct { - Track *RequestRecord_Observed_SDKEvent_Args_Track `protobuf:"bytes,1,opt,name=track,proto3,oneof"` -} -type RequestRecord_Observed_SDKEvent_Args_Identify_ struct { - Identify *RequestRecord_Observed_SDKEvent_Args_Identify `protobuf:"bytes,2,opt,name=identify,proto3,oneof"` -} - -func (*RequestRecord_Observed_SDKEvent_Args_Track_) isRequestRecord_Observed_SDKEvent_Args_Args() {} -func (*RequestRecord_Observed_SDKEvent_Args_Identify_) isRequestRecord_Observed_SDKEvent_Args_Args() {} - -func (m *RequestRecord_Observed_SDKEvent_Args) GetArgs() isRequestRecord_Observed_SDKEvent_Args_Args { - if m != nil { - return m.Args - } - return nil -} - -func (m *RequestRecord_Observed_SDKEvent_Args) GetTrack() *RequestRecord_Observed_SDKEvent_Args_Track { - if x, ok := m.GetArgs().(*RequestRecord_Observed_SDKEvent_Args_Track_); ok { - return x.Track - } - return nil -} - -func (m *RequestRecord_Observed_SDKEvent_Args) GetIdentify() *RequestRecord_Observed_SDKEvent_Args_Identify { - if x, ok := m.GetArgs().(*RequestRecord_Observed_SDKEvent_Args_Identify_); ok { - return x.Identify - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*RequestRecord_Observed_SDKEvent_Args) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _RequestRecord_Observed_SDKEvent_Args_OneofMarshaler, _RequestRecord_Observed_SDKEvent_Args_OneofUnmarshaler, _RequestRecord_Observed_SDKEvent_Args_OneofSizer, []interface{}{ - (*RequestRecord_Observed_SDKEvent_Args_Track_)(nil), - (*RequestRecord_Observed_SDKEvent_Args_Identify_)(nil), - } -} - -func _RequestRecord_Observed_SDKEvent_Args_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*RequestRecord_Observed_SDKEvent_Args) - // args - switch x := m.Args.(type) { - case *RequestRecord_Observed_SDKEvent_Args_Track_: - _ = b.EncodeVarint(1<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Track); err != nil { - return err - } - case *RequestRecord_Observed_SDKEvent_Args_Identify_: - _ = b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Identify); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("RequestRecord_Observed_SDKEvent_Args.Args has unexpected type %T", x) - } - return nil -} - -func _RequestRecord_Observed_SDKEvent_Args_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*RequestRecord_Observed_SDKEvent_Args) - switch tag { - case 1: // args.track - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(RequestRecord_Observed_SDKEvent_Args_Track) - err := b.DecodeMessage(msg) - m.Args = &RequestRecord_Observed_SDKEvent_Args_Track_{msg} - return true, err - case 2: // args.identify - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(RequestRecord_Observed_SDKEvent_Args_Identify) - err := b.DecodeMessage(msg) - m.Args = &RequestRecord_Observed_SDKEvent_Args_Identify_{msg} - return true, err - default: - return false, nil - } -} - -func _RequestRecord_Observed_SDKEvent_Args_OneofSizer(msg proto.Message) (n int) { - m := msg.(*RequestRecord_Observed_SDKEvent_Args) - // args - switch x := m.Args.(type) { - case *RequestRecord_Observed_SDKEvent_Args_Track_: - s := proto.Size(x.Track) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *RequestRecord_Observed_SDKEvent_Args_Identify_: - s := proto.Size(x.Identify) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -// Serialized into: -// [ -// "", -// { -// "user_identifiers": , -// "properties": -// } -// ] -type RequestRecord_Observed_SDKEvent_Args_Track struct { - Event string `protobuf:"bytes,1,opt,name=event,proto3" json:"event,omitempty"` - Options *RequestRecord_Observed_SDKEvent_Args_Track_Options `protobuf:"bytes,2,opt,name=options,proto3" json:"options,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RequestRecord_Observed_SDKEvent_Args_Track) Reset() { - *m = RequestRecord_Observed_SDKEvent_Args_Track{} -} -func (m *RequestRecord_Observed_SDKEvent_Args_Track) String() string { - return proto.CompactTextString(m) -} -func (*RequestRecord_Observed_SDKEvent_Args_Track) ProtoMessage() {} -func (*RequestRecord_Observed_SDKEvent_Args_Track) Descriptor() ([]byte, []int) { - return fileDescriptor_aa33db9090833f07, []int{10, 2, 1, 0, 0} -} -func (m *RequestRecord_Observed_SDKEvent_Args_Track) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RequestRecord_Observed_SDKEvent_Args_Track.Unmarshal(m, b) -} -func (m *RequestRecord_Observed_SDKEvent_Args_Track) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RequestRecord_Observed_SDKEvent_Args_Track.Marshal(b, m, deterministic) -} -func (m *RequestRecord_Observed_SDKEvent_Args_Track) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestRecord_Observed_SDKEvent_Args_Track.Merge(m, src) -} -func (m *RequestRecord_Observed_SDKEvent_Args_Track) XXX_Size() int { - return xxx_messageInfo_RequestRecord_Observed_SDKEvent_Args_Track.Size(m) -} -func (m *RequestRecord_Observed_SDKEvent_Args_Track) XXX_DiscardUnknown() { - xxx_messageInfo_RequestRecord_Observed_SDKEvent_Args_Track.DiscardUnknown(m) -} - -var xxx_messageInfo_RequestRecord_Observed_SDKEvent_Args_Track proto.InternalMessageInfo - -type RequestRecord_Observed_SDKEvent_Args_Track_Options struct { - Properties *Struct `protobuf:"bytes,1,opt,name=properties,proto3,customtype=Struct" json:"properties,omitempty"` - UserIdentifiers *Struct `protobuf:"bytes,2,opt,name=user_identifiers,json=userIdentifiers,proto3,customtype=Struct" json:"user_identifiers,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RequestRecord_Observed_SDKEvent_Args_Track_Options) Reset() { - *m = RequestRecord_Observed_SDKEvent_Args_Track_Options{} -} -func (m *RequestRecord_Observed_SDKEvent_Args_Track_Options) String() string { - return proto.CompactTextString(m) -} -func (*RequestRecord_Observed_SDKEvent_Args_Track_Options) ProtoMessage() {} -func (*RequestRecord_Observed_SDKEvent_Args_Track_Options) Descriptor() ([]byte, []int) { - return fileDescriptor_aa33db9090833f07, []int{10, 2, 1, 0, 0, 0} -} -func (m *RequestRecord_Observed_SDKEvent_Args_Track_Options) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RequestRecord_Observed_SDKEvent_Args_Track_Options.Unmarshal(m, b) -} -func (m *RequestRecord_Observed_SDKEvent_Args_Track_Options) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RequestRecord_Observed_SDKEvent_Args_Track_Options.Marshal(b, m, deterministic) -} -func (m *RequestRecord_Observed_SDKEvent_Args_Track_Options) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestRecord_Observed_SDKEvent_Args_Track_Options.Merge(m, src) -} -func (m *RequestRecord_Observed_SDKEvent_Args_Track_Options) XXX_Size() int { - return xxx_messageInfo_RequestRecord_Observed_SDKEvent_Args_Track_Options.Size(m) -} -func (m *RequestRecord_Observed_SDKEvent_Args_Track_Options) XXX_DiscardUnknown() { - xxx_messageInfo_RequestRecord_Observed_SDKEvent_Args_Track_Options.DiscardUnknown(m) -} - -var xxx_messageInfo_RequestRecord_Observed_SDKEvent_Args_Track_Options proto.InternalMessageInfo - -// Serialized into: -// [ ] -type RequestRecord_Observed_SDKEvent_Args_Identify struct { - UserIdentifiers *Struct `protobuf:"bytes,1,opt,name=user_identifiers,json=userIdentifiers,proto3,customtype=Struct" json:"user_identifiers,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RequestRecord_Observed_SDKEvent_Args_Identify) Reset() { - *m = RequestRecord_Observed_SDKEvent_Args_Identify{} -} -func (m *RequestRecord_Observed_SDKEvent_Args_Identify) String() string { - return proto.CompactTextString(m) -} -func (*RequestRecord_Observed_SDKEvent_Args_Identify) ProtoMessage() {} -func (*RequestRecord_Observed_SDKEvent_Args_Identify) Descriptor() ([]byte, []int) { - return fileDescriptor_aa33db9090833f07, []int{10, 2, 1, 0, 1} -} -func (m *RequestRecord_Observed_SDKEvent_Args_Identify) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RequestRecord_Observed_SDKEvent_Args_Identify.Unmarshal(m, b) -} -func (m *RequestRecord_Observed_SDKEvent_Args_Identify) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RequestRecord_Observed_SDKEvent_Args_Identify.Marshal(b, m, deterministic) -} -func (m *RequestRecord_Observed_SDKEvent_Args_Identify) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestRecord_Observed_SDKEvent_Args_Identify.Merge(m, src) -} -func (m *RequestRecord_Observed_SDKEvent_Args_Identify) XXX_Size() int { - return xxx_messageInfo_RequestRecord_Observed_SDKEvent_Args_Identify.Size(m) -} -func (m *RequestRecord_Observed_SDKEvent_Args_Identify) XXX_DiscardUnknown() { - xxx_messageInfo_RequestRecord_Observed_SDKEvent_Args_Identify.DiscardUnknown(m) -} - -var xxx_messageInfo_RequestRecord_Observed_SDKEvent_Args_Identify proto.InternalMessageInfo - -type RequestRecord_Observed_Exception struct { - Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` - Klass string `protobuf:"bytes,2,opt,name=klass,proto3" json:"klass,omitempty"` - RuleName string `protobuf:"bytes,3,opt,name=rule_name,json=ruleName,proto3" json:"rule_name,omitempty"` - Test bool `protobuf:"varint,4,opt,name=test,proto3" json:"test,omitempty"` - Infos string `protobuf:"bytes,5,opt,name=infos,proto3" json:"infos,omitempty"` - Backtrace []string `protobuf:"bytes,6,rep,name=backtrace,proto3" json:"backtrace,omitempty"` - Time time.Time `protobuf:"bytes,7,opt,name=time,proto3,stdtime" json:"time"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RequestRecord_Observed_Exception) Reset() { *m = RequestRecord_Observed_Exception{} } -func (m *RequestRecord_Observed_Exception) String() string { return proto.CompactTextString(m) } -func (*RequestRecord_Observed_Exception) ProtoMessage() {} -func (*RequestRecord_Observed_Exception) Descriptor() ([]byte, []int) { - return fileDescriptor_aa33db9090833f07, []int{10, 2, 2} -} -func (m *RequestRecord_Observed_Exception) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RequestRecord_Observed_Exception.Unmarshal(m, b) -} -func (m *RequestRecord_Observed_Exception) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RequestRecord_Observed_Exception.Marshal(b, m, deterministic) -} -func (m *RequestRecord_Observed_Exception) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestRecord_Observed_Exception.Merge(m, src) -} -func (m *RequestRecord_Observed_Exception) XXX_Size() int { - return xxx_messageInfo_RequestRecord_Observed_Exception.Size(m) -} -func (m *RequestRecord_Observed_Exception) XXX_DiscardUnknown() { - xxx_messageInfo_RequestRecord_Observed_Exception.DiscardUnknown(m) -} - -var xxx_messageInfo_RequestRecord_Observed_Exception proto.InternalMessageInfo - -type RequestRecord_Observed_Observation struct { - Category string `protobuf:"bytes,1,opt,name=category,proto3" json:"category,omitempty"` - Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` - Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` - Time time.Time `protobuf:"bytes,4,opt,name=time,proto3,stdtime" json:"time"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RequestRecord_Observed_Observation) Reset() { *m = RequestRecord_Observed_Observation{} } -func (m *RequestRecord_Observed_Observation) String() string { return proto.CompactTextString(m) } -func (*RequestRecord_Observed_Observation) ProtoMessage() {} -func (*RequestRecord_Observed_Observation) Descriptor() ([]byte, []int) { - return fileDescriptor_aa33db9090833f07, []int{10, 2, 3} -} -func (m *RequestRecord_Observed_Observation) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RequestRecord_Observed_Observation.Unmarshal(m, b) -} -func (m *RequestRecord_Observed_Observation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RequestRecord_Observed_Observation.Marshal(b, m, deterministic) -} -func (m *RequestRecord_Observed_Observation) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestRecord_Observed_Observation.Merge(m, src) -} -func (m *RequestRecord_Observed_Observation) XXX_Size() int { - return xxx_messageInfo_RequestRecord_Observed_Observation.Size(m) -} -func (m *RequestRecord_Observed_Observation) XXX_DiscardUnknown() { - xxx_messageInfo_RequestRecord_Observed_Observation.DiscardUnknown(m) -} - -var xxx_messageInfo_RequestRecord_Observed_Observation proto.InternalMessageInfo - -type RequestRecord_Observed_DataPoint struct { - RulespackId string `protobuf:"bytes,1,opt,name=rulespack_id,json=rulespackId,proto3" json:"rulespack_id,omitempty"` - RuleName string `protobuf:"bytes,2,opt,name=rule_name,json=ruleName,proto3" json:"rule_name,omitempty"` - Time time.Time `protobuf:"bytes,3,opt,name=time,proto3,stdtime" json:"time"` - Infos string `protobuf:"bytes,4,opt,name=infos,proto3" json:"infos,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RequestRecord_Observed_DataPoint) Reset() { *m = RequestRecord_Observed_DataPoint{} } -func (m *RequestRecord_Observed_DataPoint) String() string { return proto.CompactTextString(m) } -func (*RequestRecord_Observed_DataPoint) ProtoMessage() {} -func (*RequestRecord_Observed_DataPoint) Descriptor() ([]byte, []int) { - return fileDescriptor_aa33db9090833f07, []int{10, 2, 4} -} -func (m *RequestRecord_Observed_DataPoint) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RequestRecord_Observed_DataPoint.Unmarshal(m, b) -} -func (m *RequestRecord_Observed_DataPoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RequestRecord_Observed_DataPoint.Marshal(b, m, deterministic) -} -func (m *RequestRecord_Observed_DataPoint) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestRecord_Observed_DataPoint.Merge(m, src) -} -func (m *RequestRecord_Observed_DataPoint) XXX_Size() int { - return xxx_messageInfo_RequestRecord_Observed_DataPoint.Size(m) -} -func (m *RequestRecord_Observed_DataPoint) XXX_DiscardUnknown() { - xxx_messageInfo_RequestRecord_Observed_DataPoint.DiscardUnknown(m) -} - -var xxx_messageInfo_RequestRecord_Observed_DataPoint proto.InternalMessageInfo - -func init() { - proto.RegisterType((*AppLoginRequest)(nil), "sqreen.agent.backend.api.AppLoginRequest") - proto.RegisterType((*AppLoginRequest_VariousInfos)(nil), "sqreen.agent.backend.api.AppLoginRequest.VariousInfos") - proto.RegisterType((*AppLoginResponse)(nil), "sqreen.agent.backend.api.AppLoginResponse") - proto.RegisterType((*AppLoginResponse_Feature)(nil), "sqreen.agent.backend.api.AppLoginResponse.Feature") - proto.RegisterType((*CommandRequest)(nil), "sqreen.agent.backend.api.CommandRequest") - proto.RegisterType((*CommandResult)(nil), "sqreen.agent.backend.api.CommandResult") - proto.RegisterType((*MetricResponse)(nil), "sqreen.agent.backend.api.MetricResponse") - proto.RegisterType((*AppBeatRequest)(nil), "sqreen.agent.backend.api.AppBeatRequest") - proto.RegisterMapType((map[string]CommandResult)(nil), "sqreen.agent.backend.api.AppBeatRequest.CommandResultsEntry") - proto.RegisterType((*AppBeatResponse)(nil), "sqreen.agent.backend.api.AppBeatResponse") - proto.RegisterType((*BatchRequest)(nil), "sqreen.agent.backend.api.BatchRequest") - proto.RegisterType((*BatchRequest_Event)(nil), "sqreen.agent.backend.api.BatchRequest.Event") - proto.RegisterType((*Rule)(nil), "sqreen.agent.backend.api.Rule") - proto.RegisterType((*Dependency)(nil), "sqreen.agent.backend.api.Dependency") - proto.RegisterType((*Dependency_Source)(nil), "sqreen.agent.backend.api.Dependency.Source") - proto.RegisterType((*RequestRecord)(nil), "sqreen.agent.backend.api.RequestRecord") - proto.RegisterType((*RequestRecord_Request)(nil), "sqreen.agent.backend.api.RequestRecord.Request") - proto.RegisterType((*RequestRecord_Request_Header)(nil), "sqreen.agent.backend.api.RequestRecord.Request.Header") - proto.RegisterType((*RequestRecord_Request_Params)(nil), "sqreen.agent.backend.api.RequestRecord.Request.Params") - proto.RegisterType((*RequestRecord_Response)(nil), "sqreen.agent.backend.api.RequestRecord.Response") - proto.RegisterType((*RequestRecord_Observed)(nil), "sqreen.agent.backend.api.RequestRecord.Observed") - proto.RegisterType((*RequestRecord_Observed_Attack)(nil), "sqreen.agent.backend.api.RequestRecord.Observed.Attack") - proto.RegisterType((*RequestRecord_Observed_SDKEvent)(nil), "sqreen.agent.backend.api.RequestRecord.Observed.SDKEvent") - proto.RegisterType((*RequestRecord_Observed_SDKEvent_Args)(nil), "sqreen.agent.backend.api.RequestRecord.Observed.SDKEvent.Args") - proto.RegisterType((*RequestRecord_Observed_SDKEvent_Args_Track)(nil), "sqreen.agent.backend.api.RequestRecord.Observed.SDKEvent.Args.Track") - proto.RegisterType((*RequestRecord_Observed_SDKEvent_Args_Track_Options)(nil), "sqreen.agent.backend.api.RequestRecord.Observed.SDKEvent.Args.Track.Options") - proto.RegisterType((*RequestRecord_Observed_SDKEvent_Args_Identify)(nil), "sqreen.agent.backend.api.RequestRecord.Observed.SDKEvent.Args.Identify") - proto.RegisterType((*RequestRecord_Observed_Exception)(nil), "sqreen.agent.backend.api.RequestRecord.Observed.Exception") - proto.RegisterType((*RequestRecord_Observed_Observation)(nil), "sqreen.agent.backend.api.RequestRecord.Observed.Observation") - proto.RegisterType((*RequestRecord_Observed_DataPoint)(nil), "sqreen.agent.backend.api.RequestRecord.Observed.DataPoint") -} - -func init() { - proto.RegisterFile("agent/internal/backend/api/api.proto", fileDescriptor_aa33db9090833f07) -} - -var fileDescriptor_aa33db9090833f07 = []byte{ - // 1925 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x58, 0xcf, 0x6f, 0x23, 0x49, - 0xf5, 0x4f, 0xc7, 0xbf, 0xda, 0xcf, 0x71, 0x92, 0xa9, 0xef, 0xea, 0x3b, 0xa6, 0x59, 0x26, 0x83, - 0x61, 0xb5, 0x03, 0x0b, 0x9d, 0x55, 0x56, 0x1a, 0x96, 0x68, 0x17, 0x14, 0x4f, 0x06, 0x62, 0x76, - 0xd8, 0x09, 0x9d, 0x68, 0x84, 0x16, 0x24, 0x53, 0xee, 0xae, 0xd8, 0x8d, 0xed, 0xee, 0xde, 0xaa, - 0x6a, 0xcf, 0x64, 0xff, 0x05, 0x2e, 0x48, 0x1c, 0x91, 0x10, 0x27, 0x40, 0xe2, 0x84, 0xb8, 0x70, - 0x41, 0x5c, 0xf7, 0xc4, 0x85, 0xdb, 0x1e, 0x82, 0xe6, 0x06, 0xfb, 0x17, 0x70, 0x03, 0xd5, 0xab, - 0xaa, 0x76, 0x7b, 0x88, 0x67, 0x93, 0x19, 0x0e, 0x91, 0xea, 0x7d, 0xba, 0xde, 0xa7, 0xaa, 0xde, - 0x6f, 0x07, 0xbe, 0x4c, 0x47, 0x2c, 0x91, 0xbb, 0x71, 0x22, 0x19, 0x4f, 0xe8, 0x74, 0x77, 0x48, - 0xc3, 0x09, 0x4b, 0xa2, 0x5d, 0x9a, 0xc5, 0xea, 0xcf, 0xcf, 0x78, 0x2a, 0x53, 0xd2, 0x11, 0x1f, - 0x72, 0xc6, 0x12, 0x1f, 0x37, 0xfb, 0x66, 0x8f, 0x4f, 0xb3, 0xd8, 0xdb, 0x19, 0xa5, 0xe9, 0x68, - 0xca, 0x76, 0x71, 0xdf, 0x30, 0x3f, 0xdb, 0x95, 0xf1, 0x8c, 0x09, 0x49, 0x67, 0x99, 0x56, 0xf5, - 0x5e, 0x7d, 0x76, 0x83, 0x90, 0x3c, 0x0f, 0xa5, 0xf9, 0xfa, 0xf5, 0x51, 0x2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x21, 0x95, 0x6c, 0x94, 0x72, 0xdb, 0x3c, 0x0b, 0xd9, 0xf6, 0xd4, 0xf5, - 0x4b, 0x7a, 0x6a, 0xa5, 0xd4, 0x53, 0x8b, 0xdb, 0x54, 0xaf, 0x7d, 0x9b, 0x5f, 0x3a, 0xd0, 0x2c, - 0x4a, 0xab, 0xfe, 0x9f, 0x59, 0x69, 0xda, 0x75, 0xec, 0xff, 0xcc, 0x16, 0xb3, 0xed, 0x92, 0x75, - 0xd7, 0x9f, 0xb1, 0xae, 0xbd, 0x47, 0xe5, 0x45, 0xca, 0xa3, 0xf6, 0x41, 0xb5, 0xe4, 0x83, 0xde, - 0x8d, 0x8f, 0x9f, 0xde, 0x5a, 0xfb, 0xc7, 0xd3, 0x5b, 0xce, 0xbf, 0x9e, 0xde, 0x72, 0x3e, 0xa8, - 0xd0, 0x2c, 0x1e, 0xd6, 0x91, 0xec, 0xad, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x02, 0xfa, 0xb9, - 0x2d, 0xa8, 0x15, 0x00, 0x00, -} - -type AppLoginRequestFace interface { - Proto() github_com_gogo_protobuf_proto.Message - GetBundleSignature() string - GetVariousInfos() AppLoginRequest_VariousInfos - GetAgentType() string - GetAgentVersion() string - GetOsType() string - GetHostname() string - GetRuntimeType() string - GetRuntimeVersion() string - GetFrameworkType() string - GetFrameworkVersion() string - GetEnvironment() string -} - -func (this *AppLoginRequest) Proto() github_com_gogo_protobuf_proto.Message { - return this -} - -func (this *AppLoginRequest) TestProto() github_com_gogo_protobuf_proto.Message { - return NewAppLoginRequestFromFace(this) -} - -func (this *AppLoginRequest) GetBundleSignature() string { - return this.BundleSignature -} - -func (this *AppLoginRequest) GetVariousInfos() AppLoginRequest_VariousInfos { - return this.VariousInfos -} - -func (this *AppLoginRequest) GetAgentType() string { - return this.AgentType -} - -func (this *AppLoginRequest) GetAgentVersion() string { - return this.AgentVersion -} - -func (this *AppLoginRequest) GetOsType() string { - return this.OsType -} - -func (this *AppLoginRequest) GetHostname() string { - return this.Hostname -} - -func (this *AppLoginRequest) GetRuntimeType() string { - return this.RuntimeType -} - -func (this *AppLoginRequest) GetRuntimeVersion() string { - return this.RuntimeVersion -} - -func (this *AppLoginRequest) GetFrameworkType() string { - return this.FrameworkType -} - -func (this *AppLoginRequest) GetFrameworkVersion() string { - return this.FrameworkVersion -} - -func (this *AppLoginRequest) GetEnvironment() string { - return this.Environment -} - -func NewAppLoginRequestFromFace(that AppLoginRequestFace) *AppLoginRequest { - this := &AppLoginRequest{} - this.BundleSignature = that.GetBundleSignature() - this.VariousInfos = that.GetVariousInfos() - this.AgentType = that.GetAgentType() - this.AgentVersion = that.GetAgentVersion() - this.OsType = that.GetOsType() - this.Hostname = that.GetHostname() - this.RuntimeType = that.GetRuntimeType() - this.RuntimeVersion = that.GetRuntimeVersion() - this.FrameworkType = that.GetFrameworkType() - this.FrameworkVersion = that.GetFrameworkVersion() - this.Environment = that.GetEnvironment() - return this -} - -type AppLoginRequest_VariousInfosFace interface { - Proto() github_com_gogo_protobuf_proto.Message - GetTime() time.Time - GetPid() uint32 - GetPpid() uint32 - GetEuid() uint32 - GetEgid() uint32 - GetUid() uint32 - GetGid() uint32 - GetName() string -} - -func (this *AppLoginRequest_VariousInfos) Proto() github_com_gogo_protobuf_proto.Message { - return this -} - -func (this *AppLoginRequest_VariousInfos) TestProto() github_com_gogo_protobuf_proto.Message { - return NewAppLoginRequest_VariousInfosFromFace(this) -} - -func (this *AppLoginRequest_VariousInfos) GetTime() time.Time { - return this.Time -} - -func (this *AppLoginRequest_VariousInfos) GetPid() uint32 { - return this.Pid -} - -func (this *AppLoginRequest_VariousInfos) GetPpid() uint32 { - return this.Ppid -} - -func (this *AppLoginRequest_VariousInfos) GetEuid() uint32 { - return this.Euid -} - -func (this *AppLoginRequest_VariousInfos) GetEgid() uint32 { - return this.Egid -} - -func (this *AppLoginRequest_VariousInfos) GetUid() uint32 { - return this.Uid -} - -func (this *AppLoginRequest_VariousInfos) GetGid() uint32 { - return this.Gid -} - -func (this *AppLoginRequest_VariousInfos) GetName() string { - return this.Name -} - -func NewAppLoginRequest_VariousInfosFromFace(that AppLoginRequest_VariousInfosFace) *AppLoginRequest_VariousInfos { - this := &AppLoginRequest_VariousInfos{} - this.Time = that.GetTime() - this.Pid = that.GetPid() - this.Ppid = that.GetPpid() - this.Euid = that.GetEuid() - this.Egid = that.GetEgid() - this.Uid = that.GetUid() - this.Gid = that.GetGid() - this.Name = that.GetName() - return this -} - -type AppLoginResponseFace interface { - Proto() github_com_gogo_protobuf_proto.Message - GetSessionId() string - GetStatus() bool - GetCommands() []CommandRequest - GetFeatures() AppLoginResponse_Feature - GetPackId() string - GetRules() []Rule -} - -func (this *AppLoginResponse) Proto() github_com_gogo_protobuf_proto.Message { - return this -} - -func (this *AppLoginResponse) TestProto() github_com_gogo_protobuf_proto.Message { - return NewAppLoginResponseFromFace(this) -} - -func (this *AppLoginResponse) GetSessionId() string { - return this.SessionId -} - -func (this *AppLoginResponse) GetStatus() bool { - return this.Status -} - -func (this *AppLoginResponse) GetCommands() []CommandRequest { - return this.Commands -} - -func (this *AppLoginResponse) GetFeatures() AppLoginResponse_Feature { - return this.Features -} - -func (this *AppLoginResponse) GetPackId() string { - return this.PackId -} - -func (this *AppLoginResponse) GetRules() []Rule { - return this.Rules -} - -func NewAppLoginResponseFromFace(that AppLoginResponseFace) *AppLoginResponse { - this := &AppLoginResponse{} - this.SessionId = that.GetSessionId() - this.Status = that.GetStatus() - this.Commands = that.GetCommands() - this.Features = that.GetFeatures() - this.PackId = that.GetPackId() - this.Rules = that.GetRules() - return this -} - -type AppLoginResponse_FeatureFace interface { - Proto() github_com_gogo_protobuf_proto.Message - GetBatchSize() uint32 - GetMaxStaleness() uint32 - GetHeartbeatDelay() uint32 -} - -func (this *AppLoginResponse_Feature) Proto() github_com_gogo_protobuf_proto.Message { - return this -} - -func (this *AppLoginResponse_Feature) TestProto() github_com_gogo_protobuf_proto.Message { - return NewAppLoginResponse_FeatureFromFace(this) -} - -func (this *AppLoginResponse_Feature) GetBatchSize() uint32 { - return this.BatchSize -} - -func (this *AppLoginResponse_Feature) GetMaxStaleness() uint32 { - return this.MaxStaleness -} - -func (this *AppLoginResponse_Feature) GetHeartbeatDelay() uint32 { - return this.HeartbeatDelay -} - -func NewAppLoginResponse_FeatureFromFace(that AppLoginResponse_FeatureFace) *AppLoginResponse_Feature { - this := &AppLoginResponse_Feature{} - this.BatchSize = that.GetBatchSize() - this.MaxStaleness = that.GetMaxStaleness() - this.HeartbeatDelay = that.GetHeartbeatDelay() - return this -} - -type CommandRequestFace interface { - Proto() github_com_gogo_protobuf_proto.Message - GetName() string - GetParams() []string - GetUuid() string -} - -func (this *CommandRequest) Proto() github_com_gogo_protobuf_proto.Message { - return this -} - -func (this *CommandRequest) TestProto() github_com_gogo_protobuf_proto.Message { - return NewCommandRequestFromFace(this) -} - -func (this *CommandRequest) GetName() string { - return this.Name -} - -func (this *CommandRequest) GetParams() []string { - return this.Params -} - -func (this *CommandRequest) GetUuid() string { - return this.Uuid -} - -func NewCommandRequestFromFace(that CommandRequestFace) *CommandRequest { - this := &CommandRequest{} - this.Name = that.GetName() - this.Params = that.GetParams() - this.Uuid = that.GetUuid() - return this -} - -type CommandResultFace interface { - Proto() github_com_gogo_protobuf_proto.Message - GetOutput() string - GetStatus() bool -} - -func (this *CommandResult) Proto() github_com_gogo_protobuf_proto.Message { - return this -} - -func (this *CommandResult) TestProto() github_com_gogo_protobuf_proto.Message { - return NewCommandResultFromFace(this) -} - -func (this *CommandResult) GetOutput() string { - return this.Output -} - -func (this *CommandResult) GetStatus() bool { - return this.Status -} - -func NewCommandResultFromFace(that CommandResultFace) *CommandResult { - this := &CommandResult{} - this.Output = that.GetOutput() - this.Status = that.GetStatus() - return this -} - -type MetricResponseFace interface { - Proto() github_com_gogo_protobuf_proto.Message - GetName() string - GetStart() time.Time - GetFinish() time.Time - GetObservation() Struct -} - -func (this *MetricResponse) Proto() github_com_gogo_protobuf_proto.Message { - return this -} - -func (this *MetricResponse) TestProto() github_com_gogo_protobuf_proto.Message { - return NewMetricResponseFromFace(this) -} - -func (this *MetricResponse) GetName() string { - return this.Name -} - -func (this *MetricResponse) GetStart() time.Time { - return this.Start -} - -func (this *MetricResponse) GetFinish() time.Time { - return this.Finish -} - -func (this *MetricResponse) GetObservation() Struct { - return this.Observation -} - -func NewMetricResponseFromFace(that MetricResponseFace) *MetricResponse { - this := &MetricResponse{} - this.Name = that.GetName() - this.Start = that.GetStart() - this.Finish = that.GetFinish() - this.Observation = that.GetObservation() - return this -} - -type AppBeatRequestFace interface { - Proto() github_com_gogo_protobuf_proto.Message - GetCommandResults() map[string]CommandResult - GetMetrics() []MetricResponse -} - -func (this *AppBeatRequest) Proto() github_com_gogo_protobuf_proto.Message { - return this -} - -func (this *AppBeatRequest) TestProto() github_com_gogo_protobuf_proto.Message { - return NewAppBeatRequestFromFace(this) -} - -func (this *AppBeatRequest) GetCommandResults() map[string]CommandResult { - return this.CommandResults -} - -func (this *AppBeatRequest) GetMetrics() []MetricResponse { - return this.Metrics -} - -func NewAppBeatRequestFromFace(that AppBeatRequestFace) *AppBeatRequest { - this := &AppBeatRequest{} - this.CommandResults = that.GetCommandResults() - this.Metrics = that.GetMetrics() - return this -} - -type AppBeatResponseFace interface { - Proto() github_com_gogo_protobuf_proto.Message - GetCommands() []CommandRequest - GetStatus() bool -} - -func (this *AppBeatResponse) Proto() github_com_gogo_protobuf_proto.Message { - return this -} - -func (this *AppBeatResponse) TestProto() github_com_gogo_protobuf_proto.Message { - return NewAppBeatResponseFromFace(this) -} - -func (this *AppBeatResponse) GetCommands() []CommandRequest { - return this.Commands -} - -func (this *AppBeatResponse) GetStatus() bool { - return this.Status -} - -func NewAppBeatResponseFromFace(that AppBeatResponseFace) *AppBeatResponse { - this := &AppBeatResponse{} - this.Commands = that.GetCommands() - this.Status = that.GetStatus() - return this -} - -type BatchRequestFace interface { - Proto() github_com_gogo_protobuf_proto.Message - GetBatch() []BatchRequest_Event -} - -func (this *BatchRequest) Proto() github_com_gogo_protobuf_proto.Message { - return this -} - -func (this *BatchRequest) TestProto() github_com_gogo_protobuf_proto.Message { - return NewBatchRequestFromFace(this) -} - -func (this *BatchRequest) GetBatch() []BatchRequest_Event { - return this.Batch -} - -func NewBatchRequestFromFace(that BatchRequestFace) *BatchRequest { - this := &BatchRequest{} - this.Batch = that.GetBatch() - return this -} - -type BatchRequest_EventFace interface { - Proto() github_com_gogo_protobuf_proto.Message - GetEventType() string - GetEvent() Struct -} - -func (this *BatchRequest_Event) Proto() github_com_gogo_protobuf_proto.Message { - return this -} - -func (this *BatchRequest_Event) TestProto() github_com_gogo_protobuf_proto.Message { - return NewBatchRequest_EventFromFace(this) -} - -func (this *BatchRequest_Event) GetEventType() string { - return this.EventType -} - -func (this *BatchRequest_Event) GetEvent() Struct { - return this.Event -} - -func NewBatchRequest_EventFromFace(that BatchRequest_EventFace) *BatchRequest_Event { - this := &BatchRequest_Event{} - this.EventType = that.GetEventType() - this.Event = that.GetEvent() - return this -} - -type RuleFace interface { - Proto() github_com_gogo_protobuf_proto.Message -} - -func (this *Rule) Proto() github_com_gogo_protobuf_proto.Message { - return this -} - -func (this *Rule) TestProto() github_com_gogo_protobuf_proto.Message { - return NewRuleFromFace(this) -} - -func NewRuleFromFace(that RuleFace) *Rule { - this := &Rule{} - return this -} - -type DependencyFace interface { - Proto() github_com_gogo_protobuf_proto.Message - GetName() string - GetVersion() string - GetHomepage() string - GetSource() *Dependency_Source -} - -func (this *Dependency) Proto() github_com_gogo_protobuf_proto.Message { - return this -} - -func (this *Dependency) TestProto() github_com_gogo_protobuf_proto.Message { - return NewDependencyFromFace(this) -} - -func (this *Dependency) GetName() string { - return this.Name -} - -func (this *Dependency) GetVersion() string { - return this.Version -} - -func (this *Dependency) GetHomepage() string { - return this.Homepage -} - -func (this *Dependency) GetSource() *Dependency_Source { - return this.Source -} - -func NewDependencyFromFace(that DependencyFace) *Dependency { - this := &Dependency{} - this.Name = that.GetName() - this.Version = that.GetVersion() - this.Homepage = that.GetHomepage() - this.Source = that.GetSource() - return this -} - -type Dependency_SourceFace interface { - Proto() github_com_gogo_protobuf_proto.Message - GetName() string - GetRemotes() []string -} - -func (this *Dependency_Source) Proto() github_com_gogo_protobuf_proto.Message { - return this -} - -func (this *Dependency_Source) TestProto() github_com_gogo_protobuf_proto.Message { - return NewDependency_SourceFromFace(this) -} - -func (this *Dependency_Source) GetName() string { - return this.Name -} - -func (this *Dependency_Source) GetRemotes() []string { - return this.Remotes -} - -func NewDependency_SourceFromFace(that Dependency_SourceFace) *Dependency_Source { - this := &Dependency_Source{} - this.Name = that.GetName() - this.Remotes = that.GetRemotes() - return this -} - -type RequestRecordFace interface { - Proto() github_com_gogo_protobuf_proto.Message - GetVersion() string - GetRulespackId() string - GetClientIp() string - GetRequest() RequestRecord_Request - GetResponse() RequestRecord_Response - GetObserved() RequestRecord_Observed -} - -func (this *RequestRecord) Proto() github_com_gogo_protobuf_proto.Message { - return this -} - -func (this *RequestRecord) TestProto() github_com_gogo_protobuf_proto.Message { - return NewRequestRecordFromFace(this) -} - -func (this *RequestRecord) GetVersion() string { - return this.Version -} - -func (this *RequestRecord) GetRulespackId() string { - return this.RulespackId -} - -func (this *RequestRecord) GetClientIp() string { - return this.ClientIp -} - -func (this *RequestRecord) GetRequest() RequestRecord_Request { - return this.Request -} - -func (this *RequestRecord) GetResponse() RequestRecord_Response { - return this.Response -} - -func (this *RequestRecord) GetObserved() RequestRecord_Observed { - return this.Observed -} - -func NewRequestRecordFromFace(that RequestRecordFace) *RequestRecord { - this := &RequestRecord{} - this.Version = that.GetVersion() - this.RulespackId = that.GetRulespackId() - this.ClientIp = that.GetClientIp() - this.Request = that.GetRequest() - this.Response = that.GetResponse() - this.Observed = that.GetObserved() - return this -} - -type RequestRecord_RequestFace interface { - Proto() github_com_gogo_protobuf_proto.Message - GetRid() string - GetHeaders() []RequestRecord_Request_Header - GetVerb() string - GetPath() string - GetRawPath() string - GetHost() string - GetPort() string - GetRemoteIp() string - GetRemotePort() string - GetScheme() string - GetUserAgent() string - GetReferer() string - GetParams() RequestRecord_Request_Params -} - -func (this *RequestRecord_Request) Proto() github_com_gogo_protobuf_proto.Message { - return this -} - -func (this *RequestRecord_Request) TestProto() github_com_gogo_protobuf_proto.Message { - return NewRequestRecord_RequestFromFace(this) -} - -func (this *RequestRecord_Request) GetRid() string { - return this.Rid -} - -func (this *RequestRecord_Request) GetHeaders() []RequestRecord_Request_Header { - return this.Headers -} - -func (this *RequestRecord_Request) GetVerb() string { - return this.Verb -} - -func (this *RequestRecord_Request) GetPath() string { - return this.Path -} - -func (this *RequestRecord_Request) GetRawPath() string { - return this.RawPath -} - -func (this *RequestRecord_Request) GetHost() string { - return this.Host -} - -func (this *RequestRecord_Request) GetPort() string { - return this.Port -} - -func (this *RequestRecord_Request) GetRemoteIp() string { - return this.RemoteIp -} - -func (this *RequestRecord_Request) GetRemotePort() string { - return this.RemotePort -} - -func (this *RequestRecord_Request) GetScheme() string { - return this.Scheme -} - -func (this *RequestRecord_Request) GetUserAgent() string { - return this.UserAgent -} - -func (this *RequestRecord_Request) GetReferer() string { - return this.Referer -} - -func (this *RequestRecord_Request) GetParams() RequestRecord_Request_Params { - return this.Params -} - -func NewRequestRecord_RequestFromFace(that RequestRecord_RequestFace) *RequestRecord_Request { - this := &RequestRecord_Request{} - this.Rid = that.GetRid() - this.Headers = that.GetHeaders() - this.Verb = that.GetVerb() - this.Path = that.GetPath() - this.RawPath = that.GetRawPath() - this.Host = that.GetHost() - this.Port = that.GetPort() - this.RemoteIp = that.GetRemoteIp() - this.RemotePort = that.GetRemotePort() - this.Scheme = that.GetScheme() - this.UserAgent = that.GetUserAgent() - this.Referer = that.GetReferer() - this.Params = that.GetParams() - return this -} - -type RequestRecord_Request_HeaderFace interface { - Proto() github_com_gogo_protobuf_proto.Message - GetKey() string - GetValue() string -} - -func (this *RequestRecord_Request_Header) Proto() github_com_gogo_protobuf_proto.Message { - return this -} - -func (this *RequestRecord_Request_Header) TestProto() github_com_gogo_protobuf_proto.Message { - return NewRequestRecord_Request_HeaderFromFace(this) -} - -func (this *RequestRecord_Request_Header) GetKey() string { - return this.Key -} - -func (this *RequestRecord_Request_Header) GetValue() string { - return this.Value -} - -func NewRequestRecord_Request_HeaderFromFace(that RequestRecord_Request_HeaderFace) *RequestRecord_Request_Header { - this := &RequestRecord_Request_Header{} - this.Key = that.GetKey() - this.Value = that.GetValue() - return this -} - -type RequestRecord_Request_ParamsFace interface { - Proto() github_com_gogo_protobuf_proto.Message -} - -func (this *RequestRecord_Request_Params) Proto() github_com_gogo_protobuf_proto.Message { - return this -} - -func (this *RequestRecord_Request_Params) TestProto() github_com_gogo_protobuf_proto.Message { - return NewRequestRecord_Request_ParamsFromFace(this) -} - -func NewRequestRecord_Request_ParamsFromFace(that RequestRecord_Request_ParamsFace) *RequestRecord_Request_Params { - this := &RequestRecord_Request_Params{} - return this -} - -type RequestRecord_ResponseFace interface { - Proto() github_com_gogo_protobuf_proto.Message - GetStatus() uint32 - GetContentLength() uint32 - GetContentType() string -} - -func (this *RequestRecord_Response) Proto() github_com_gogo_protobuf_proto.Message { - return this -} - -func (this *RequestRecord_Response) TestProto() github_com_gogo_protobuf_proto.Message { - return NewRequestRecord_ResponseFromFace(this) -} - -func (this *RequestRecord_Response) GetStatus() uint32 { - return this.Status -} - -func (this *RequestRecord_Response) GetContentLength() uint32 { - return this.ContentLength -} - -func (this *RequestRecord_Response) GetContentType() string { - return this.ContentType -} - -func NewRequestRecord_ResponseFromFace(that RequestRecord_ResponseFace) *RequestRecord_Response { - this := &RequestRecord_Response{} - this.Status = that.GetStatus() - this.ContentLength = that.GetContentLength() - this.ContentType = that.GetContentType() - return this -} - -type RequestRecord_ObservedFace interface { - Proto() github_com_gogo_protobuf_proto.Message - GetAttacks() []*RequestRecord_Observed_Attack - GetSdk() []*RequestRecord_Observed_SDKEvent - GetSqreenExceptions() []*RequestRecord_Observed_Exception - GetObservations() []*RequestRecord_Observed_Observation - GetDataPoints() []*RequestRecord_Observed_DataPoint -} - -func (this *RequestRecord_Observed) Proto() github_com_gogo_protobuf_proto.Message { - return this -} - -func (this *RequestRecord_Observed) TestProto() github_com_gogo_protobuf_proto.Message { - return NewRequestRecord_ObservedFromFace(this) -} - -func (this *RequestRecord_Observed) GetAttacks() []*RequestRecord_Observed_Attack { - return this.Attacks -} - -func (this *RequestRecord_Observed) GetSdk() []*RequestRecord_Observed_SDKEvent { - return this.Sdk -} - -func (this *RequestRecord_Observed) GetSqreenExceptions() []*RequestRecord_Observed_Exception { - return this.SqreenExceptions -} - -func (this *RequestRecord_Observed) GetObservations() []*RequestRecord_Observed_Observation { - return this.Observations -} - -func (this *RequestRecord_Observed) GetDataPoints() []*RequestRecord_Observed_DataPoint { - return this.DataPoints -} - -func NewRequestRecord_ObservedFromFace(that RequestRecord_ObservedFace) *RequestRecord_Observed { - this := &RequestRecord_Observed{} - this.Attacks = that.GetAttacks() - this.Sdk = that.GetSdk() - this.SqreenExceptions = that.GetSqreenExceptions() - this.Observations = that.GetObservations() - this.DataPoints = that.GetDataPoints() - return this -} - -type RequestRecord_Observed_AttackFace interface { - Proto() github_com_gogo_protobuf_proto.Message - GetRuleName() string - GetTest() bool - GetInfos() string - GetBacktrace() []string - GetTime() time.Time - GetBlock() bool -} - -func (this *RequestRecord_Observed_Attack) Proto() github_com_gogo_protobuf_proto.Message { - return this -} - -func (this *RequestRecord_Observed_Attack) TestProto() github_com_gogo_protobuf_proto.Message { - return NewRequestRecord_Observed_AttackFromFace(this) -} - -func (this *RequestRecord_Observed_Attack) GetRuleName() string { - return this.RuleName -} - -func (this *RequestRecord_Observed_Attack) GetTest() bool { - return this.Test -} - -func (this *RequestRecord_Observed_Attack) GetInfos() string { - return this.Infos -} - -func (this *RequestRecord_Observed_Attack) GetBacktrace() []string { - return this.Backtrace -} - -func (this *RequestRecord_Observed_Attack) GetTime() time.Time { - return this.Time -} - -func (this *RequestRecord_Observed_Attack) GetBlock() bool { - return this.Block -} - -func NewRequestRecord_Observed_AttackFromFace(that RequestRecord_Observed_AttackFace) *RequestRecord_Observed_Attack { - this := &RequestRecord_Observed_Attack{} - this.RuleName = that.GetRuleName() - this.Test = that.GetTest() - this.Infos = that.GetInfos() - this.Backtrace = that.GetBacktrace() - this.Time = that.GetTime() - this.Block = that.GetBlock() - return this -} - -type RequestRecord_Observed_SDKEventFace interface { - Proto() github_com_gogo_protobuf_proto.Message - GetTime() time.Time - GetName() string - GetArgs() RequestRecord_Observed_SDKEvent_Args -} - -func (this *RequestRecord_Observed_SDKEvent) Proto() github_com_gogo_protobuf_proto.Message { - return this -} - -func (this *RequestRecord_Observed_SDKEvent) TestProto() github_com_gogo_protobuf_proto.Message { - return NewRequestRecord_Observed_SDKEventFromFace(this) -} - -func (this *RequestRecord_Observed_SDKEvent) GetTime() time.Time { - return this.Time -} - -func (this *RequestRecord_Observed_SDKEvent) GetName() string { - return this.Name -} - -func (this *RequestRecord_Observed_SDKEvent) GetArgs() RequestRecord_Observed_SDKEvent_Args { - return this.Args -} - -func NewRequestRecord_Observed_SDKEventFromFace(that RequestRecord_Observed_SDKEventFace) *RequestRecord_Observed_SDKEvent { - this := &RequestRecord_Observed_SDKEvent{} - this.Time = that.GetTime() - this.Name = that.GetName() - this.Args = that.GetArgs() - return this -} - -type RequestRecord_Observed_SDKEvent_Args_TrackFace interface { - Proto() github_com_gogo_protobuf_proto.Message - GetEvent() string - GetOptions() *RequestRecord_Observed_SDKEvent_Args_Track_Options -} - -func (this *RequestRecord_Observed_SDKEvent_Args_Track) Proto() github_com_gogo_protobuf_proto.Message { - return this -} - -func (this *RequestRecord_Observed_SDKEvent_Args_Track) TestProto() github_com_gogo_protobuf_proto.Message { - return NewRequestRecord_Observed_SDKEvent_Args_TrackFromFace(this) -} - -func (this *RequestRecord_Observed_SDKEvent_Args_Track) GetEvent() string { - return this.Event -} - -func (this *RequestRecord_Observed_SDKEvent_Args_Track) GetOptions() *RequestRecord_Observed_SDKEvent_Args_Track_Options { - return this.Options -} - -func NewRequestRecord_Observed_SDKEvent_Args_TrackFromFace(that RequestRecord_Observed_SDKEvent_Args_TrackFace) *RequestRecord_Observed_SDKEvent_Args_Track { - this := &RequestRecord_Observed_SDKEvent_Args_Track{} - this.Event = that.GetEvent() - this.Options = that.GetOptions() - return this -} - -type RequestRecord_Observed_SDKEvent_Args_Track_OptionsFace interface { - Proto() github_com_gogo_protobuf_proto.Message - GetProperties() *Struct - GetUserIdentifiers() *Struct -} - -func (this *RequestRecord_Observed_SDKEvent_Args_Track_Options) Proto() github_com_gogo_protobuf_proto.Message { - return this -} - -func (this *RequestRecord_Observed_SDKEvent_Args_Track_Options) TestProto() github_com_gogo_protobuf_proto.Message { - return NewRequestRecord_Observed_SDKEvent_Args_Track_OptionsFromFace(this) -} - -func (this *RequestRecord_Observed_SDKEvent_Args_Track_Options) GetProperties() *Struct { - return this.Properties -} - -func (this *RequestRecord_Observed_SDKEvent_Args_Track_Options) GetUserIdentifiers() *Struct { - return this.UserIdentifiers -} - -func NewRequestRecord_Observed_SDKEvent_Args_Track_OptionsFromFace(that RequestRecord_Observed_SDKEvent_Args_Track_OptionsFace) *RequestRecord_Observed_SDKEvent_Args_Track_Options { - this := &RequestRecord_Observed_SDKEvent_Args_Track_Options{} - this.Properties = that.GetProperties() - this.UserIdentifiers = that.GetUserIdentifiers() - return this -} - -type RequestRecord_Observed_SDKEvent_Args_IdentifyFace interface { - Proto() github_com_gogo_protobuf_proto.Message - GetUserIdentifiers() *Struct -} - -func (this *RequestRecord_Observed_SDKEvent_Args_Identify) Proto() github_com_gogo_protobuf_proto.Message { - return this -} - -func (this *RequestRecord_Observed_SDKEvent_Args_Identify) TestProto() github_com_gogo_protobuf_proto.Message { - return NewRequestRecord_Observed_SDKEvent_Args_IdentifyFromFace(this) -} - -func (this *RequestRecord_Observed_SDKEvent_Args_Identify) GetUserIdentifiers() *Struct { - return this.UserIdentifiers -} - -func NewRequestRecord_Observed_SDKEvent_Args_IdentifyFromFace(that RequestRecord_Observed_SDKEvent_Args_IdentifyFace) *RequestRecord_Observed_SDKEvent_Args_Identify { - this := &RequestRecord_Observed_SDKEvent_Args_Identify{} - this.UserIdentifiers = that.GetUserIdentifiers() - return this -} - -type RequestRecord_Observed_ExceptionFace interface { - Proto() github_com_gogo_protobuf_proto.Message - GetMessage() string - GetKlass() string - GetRuleName() string - GetTest() bool - GetInfos() string - GetBacktrace() []string - GetTime() time.Time -} - -func (this *RequestRecord_Observed_Exception) Proto() github_com_gogo_protobuf_proto.Message { - return this -} - -func (this *RequestRecord_Observed_Exception) TestProto() github_com_gogo_protobuf_proto.Message { - return NewRequestRecord_Observed_ExceptionFromFace(this) -} - -func (this *RequestRecord_Observed_Exception) GetMessage() string { - return this.Message -} - -func (this *RequestRecord_Observed_Exception) GetKlass() string { - return this.Klass -} - -func (this *RequestRecord_Observed_Exception) GetRuleName() string { - return this.RuleName -} - -func (this *RequestRecord_Observed_Exception) GetTest() bool { - return this.Test -} - -func (this *RequestRecord_Observed_Exception) GetInfos() string { - return this.Infos -} - -func (this *RequestRecord_Observed_Exception) GetBacktrace() []string { - return this.Backtrace -} - -func (this *RequestRecord_Observed_Exception) GetTime() time.Time { - return this.Time -} - -func NewRequestRecord_Observed_ExceptionFromFace(that RequestRecord_Observed_ExceptionFace) *RequestRecord_Observed_Exception { - this := &RequestRecord_Observed_Exception{} - this.Message = that.GetMessage() - this.Klass = that.GetKlass() - this.RuleName = that.GetRuleName() - this.Test = that.GetTest() - this.Infos = that.GetInfos() - this.Backtrace = that.GetBacktrace() - this.Time = that.GetTime() - return this -} - -type RequestRecord_Observed_ObservationFace interface { - Proto() github_com_gogo_protobuf_proto.Message - GetCategory() string - GetKey() string - GetValue() string - GetTime() time.Time -} - -func (this *RequestRecord_Observed_Observation) Proto() github_com_gogo_protobuf_proto.Message { - return this -} - -func (this *RequestRecord_Observed_Observation) TestProto() github_com_gogo_protobuf_proto.Message { - return NewRequestRecord_Observed_ObservationFromFace(this) -} - -func (this *RequestRecord_Observed_Observation) GetCategory() string { - return this.Category -} - -func (this *RequestRecord_Observed_Observation) GetKey() string { - return this.Key -} - -func (this *RequestRecord_Observed_Observation) GetValue() string { - return this.Value -} - -func (this *RequestRecord_Observed_Observation) GetTime() time.Time { - return this.Time -} - -func NewRequestRecord_Observed_ObservationFromFace(that RequestRecord_Observed_ObservationFace) *RequestRecord_Observed_Observation { - this := &RequestRecord_Observed_Observation{} - this.Category = that.GetCategory() - this.Key = that.GetKey() - this.Value = that.GetValue() - this.Time = that.GetTime() - return this -} - -type RequestRecord_Observed_DataPointFace interface { - Proto() github_com_gogo_protobuf_proto.Message - GetRulespackId() string - GetRuleName() string - GetTime() time.Time - GetInfos() string -} - -func (this *RequestRecord_Observed_DataPoint) Proto() github_com_gogo_protobuf_proto.Message { - return this -} - -func (this *RequestRecord_Observed_DataPoint) TestProto() github_com_gogo_protobuf_proto.Message { - return NewRequestRecord_Observed_DataPointFromFace(this) -} - -func (this *RequestRecord_Observed_DataPoint) GetRulespackId() string { - return this.RulespackId -} - -func (this *RequestRecord_Observed_DataPoint) GetRuleName() string { - return this.RuleName -} - -func (this *RequestRecord_Observed_DataPoint) GetTime() time.Time { - return this.Time -} - -func (this *RequestRecord_Observed_DataPoint) GetInfos() string { - return this.Infos -} - -func NewRequestRecord_Observed_DataPointFromFace(that RequestRecord_Observed_DataPointFace) *RequestRecord_Observed_DataPoint { - this := &RequestRecord_Observed_DataPoint{} - this.RulespackId = that.GetRulespackId() - this.RuleName = that.GetRuleName() - this.Time = that.GetTime() - this.Infos = that.GetInfos() - return this -} - -func NewPopulatedAppLoginRequest(r randyApi, easy bool) *AppLoginRequest { - this := &AppLoginRequest{} - this.BundleSignature = string(randStringApi(r)) - v1 := NewPopulatedAppLoginRequest_VariousInfos(r, easy) - this.VariousInfos = *v1 - this.AgentType = string(randStringApi(r)) - this.AgentVersion = string(randStringApi(r)) - this.OsType = string(randStringApi(r)) - this.Hostname = string(randStringApi(r)) - this.RuntimeType = string(randStringApi(r)) - this.RuntimeVersion = string(randStringApi(r)) - this.FrameworkType = string(randStringApi(r)) - this.FrameworkVersion = string(randStringApi(r)) - this.Environment = string(randStringApi(r)) - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedApi(r, 12) - } - return this -} - -func NewPopulatedAppLoginRequest_VariousInfos(r randyApi, easy bool) *AppLoginRequest_VariousInfos { - this := &AppLoginRequest_VariousInfos{} - v2 := github_com_gogo_protobuf_types.NewPopulatedStdTime(r, easy) - this.Time = *v2 - this.Pid = uint32(r.Uint32()) - this.Ppid = uint32(r.Uint32()) - this.Euid = uint32(r.Uint32()) - this.Egid = uint32(r.Uint32()) - this.Uid = uint32(r.Uint32()) - this.Gid = uint32(r.Uint32()) - this.Name = string(randStringApi(r)) - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedApi(r, 10) - } - return this -} - -func NewPopulatedAppLoginResponse(r randyApi, easy bool) *AppLoginResponse { - this := &AppLoginResponse{} - this.SessionId = string(randStringApi(r)) - this.Status = bool(bool(r.Intn(2) == 0)) - if r.Intn(10) != 0 { - v3 := r.Intn(5) - this.Commands = make([]CommandRequest, v3) - for i := 0; i < v3; i++ { - v4 := NewPopulatedCommandRequest(r, easy) - this.Commands[i] = *v4 - } - } - v5 := NewPopulatedAppLoginResponse_Feature(r, easy) - this.Features = *v5 - this.PackId = string(randStringApi(r)) - if r.Intn(10) != 0 { - v6 := r.Intn(5) - this.Rules = make([]Rule, v6) - for i := 0; i < v6; i++ { - v7 := NewPopulatedRule(r, easy) - this.Rules[i] = *v7 - } - } - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedApi(r, 7) - } - return this -} - -func NewPopulatedAppLoginResponse_Feature(r randyApi, easy bool) *AppLoginResponse_Feature { - this := &AppLoginResponse_Feature{} - this.BatchSize = uint32(r.Uint32()) - this.MaxStaleness = uint32(r.Uint32()) - this.HeartbeatDelay = uint32(r.Uint32()) - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedApi(r, 4) - } - return this -} - -func NewPopulatedCommandRequest(r randyApi, easy bool) *CommandRequest { - this := &CommandRequest{} - this.Name = string(randStringApi(r)) - v8 := r.Intn(10) - this.Params = make([]string, v8) - for i := 0; i < v8; i++ { - this.Params[i] = string(randStringApi(r)) - } - this.Uuid = string(randStringApi(r)) - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedApi(r, 4) - } - return this -} - -func NewPopulatedCommandResult(r randyApi, easy bool) *CommandResult { - this := &CommandResult{} - this.Output = string(randStringApi(r)) - this.Status = bool(bool(r.Intn(2) == 0)) - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedApi(r, 3) - } - return this -} - -func NewPopulatedMetricResponse(r randyApi, easy bool) *MetricResponse { - this := &MetricResponse{} - this.Name = string(randStringApi(r)) - v9 := github_com_gogo_protobuf_types.NewPopulatedStdTime(r, easy) - this.Start = *v9 - v10 := github_com_gogo_protobuf_types.NewPopulatedStdTime(r, easy) - this.Finish = *v10 - v11 := NewPopulatedStruct(r) - this.Observation = *v11 - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedApi(r, 5) - } - return this -} - -func NewPopulatedAppBeatRequest(r randyApi, easy bool) *AppBeatRequest { - this := &AppBeatRequest{} - if r.Intn(10) != 0 { - v12 := r.Intn(10) - this.CommandResults = make(map[string]CommandResult) - for i := 0; i < v12; i++ { - this.CommandResults[randStringApi(r)] = *NewPopulatedCommandResult(r, easy) - } - } - if r.Intn(10) != 0 { - v13 := r.Intn(5) - this.Metrics = make([]MetricResponse, v13) - for i := 0; i < v13; i++ { - v14 := NewPopulatedMetricResponse(r, easy) - this.Metrics[i] = *v14 - } - } - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedApi(r, 3) - } - return this -} - -func NewPopulatedAppBeatResponse(r randyApi, easy bool) *AppBeatResponse { - this := &AppBeatResponse{} - if r.Intn(10) != 0 { - v15 := r.Intn(5) - this.Commands = make([]CommandRequest, v15) - for i := 0; i < v15; i++ { - v16 := NewPopulatedCommandRequest(r, easy) - this.Commands[i] = *v16 - } - } - this.Status = bool(bool(r.Intn(2) == 0)) - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedApi(r, 3) - } - return this -} - -func NewPopulatedBatchRequest(r randyApi, easy bool) *BatchRequest { - this := &BatchRequest{} - if r.Intn(10) != 0 { - v17 := r.Intn(5) - this.Batch = make([]BatchRequest_Event, v17) - for i := 0; i < v17; i++ { - v18 := NewPopulatedBatchRequest_Event(r, easy) - this.Batch[i] = *v18 - } - } - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedApi(r, 2) - } - return this -} - -func NewPopulatedBatchRequest_Event(r randyApi, easy bool) *BatchRequest_Event { - this := &BatchRequest_Event{} - this.EventType = string(randStringApi(r)) - v19 := NewPopulatedStruct(r) - this.Event = *v19 - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedApi(r, 3) - } - return this -} - -func NewPopulatedRule(r randyApi, easy bool) *Rule { - this := &Rule{} - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedApi(r, 1) - } - return this -} - -func NewPopulatedDependency(r randyApi, easy bool) *Dependency { - this := &Dependency{} - this.Name = string(randStringApi(r)) - this.Version = string(randStringApi(r)) - this.Homepage = string(randStringApi(r)) - if r.Intn(10) != 0 { - this.Source = NewPopulatedDependency_Source(r, easy) - } - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedApi(r, 5) - } - return this -} - -func NewPopulatedDependency_Source(r randyApi, easy bool) *Dependency_Source { - this := &Dependency_Source{} - this.Name = string(randStringApi(r)) - v20 := r.Intn(10) - this.Remotes = make([]string, v20) - for i := 0; i < v20; i++ { - this.Remotes[i] = string(randStringApi(r)) - } - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedApi(r, 3) - } - return this -} - -func NewPopulatedRequestRecord(r randyApi, easy bool) *RequestRecord { - this := &RequestRecord{} - this.Version = string(randStringApi(r)) - this.RulespackId = string(randStringApi(r)) - this.ClientIp = string(randStringApi(r)) - v21 := NewPopulatedRequestRecord_Request(r, easy) - this.Request = *v21 - v22 := NewPopulatedRequestRecord_Response(r, easy) - this.Response = *v22 - v23 := NewPopulatedRequestRecord_Observed(r, easy) - this.Observed = *v23 - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedApi(r, 7) - } - return this -} - -func NewPopulatedRequestRecord_Request(r randyApi, easy bool) *RequestRecord_Request { - this := &RequestRecord_Request{} - this.Rid = string(randStringApi(r)) - if r.Intn(10) != 0 { - v24 := r.Intn(5) - this.Headers = make([]RequestRecord_Request_Header, v24) - for i := 0; i < v24; i++ { - v25 := NewPopulatedRequestRecord_Request_Header(r, easy) - this.Headers[i] = *v25 - } - } - this.Verb = string(randStringApi(r)) - this.Path = string(randStringApi(r)) - this.RawPath = string(randStringApi(r)) - this.Host = string(randStringApi(r)) - this.Port = string(randStringApi(r)) - this.RemoteIp = string(randStringApi(r)) - this.RemotePort = string(randStringApi(r)) - this.Scheme = string(randStringApi(r)) - this.UserAgent = string(randStringApi(r)) - this.Referer = string(randStringApi(r)) - v26 := NewPopulatedRequestRecord_Request_Params(r, easy) - this.Params = *v26 - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedApi(r, 14) - } - return this -} - -func NewPopulatedRequestRecord_Request_Header(r randyApi, easy bool) *RequestRecord_Request_Header { - this := &RequestRecord_Request_Header{} - this.Key = string(randStringApi(r)) - this.Value = string(randStringApi(r)) - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedApi(r, 3) - } - return this -} - -func NewPopulatedRequestRecord_Request_Params(r randyApi, easy bool) *RequestRecord_Request_Params { - this := &RequestRecord_Request_Params{} - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedApi(r, 1) - } - return this -} - -func NewPopulatedRequestRecord_Response(r randyApi, easy bool) *RequestRecord_Response { - this := &RequestRecord_Response{} - this.Status = uint32(r.Uint32()) - this.ContentLength = uint32(r.Uint32()) - this.ContentType = string(randStringApi(r)) - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedApi(r, 4) - } - return this -} - -func NewPopulatedRequestRecord_Observed(r randyApi, easy bool) *RequestRecord_Observed { - this := &RequestRecord_Observed{} - if r.Intn(10) != 0 { - v27 := r.Intn(5) - this.Attacks = make([]*RequestRecord_Observed_Attack, v27) - for i := 0; i < v27; i++ { - this.Attacks[i] = NewPopulatedRequestRecord_Observed_Attack(r, easy) - } - } - if r.Intn(10) != 0 { - v28 := r.Intn(5) - this.Sdk = make([]*RequestRecord_Observed_SDKEvent, v28) - for i := 0; i < v28; i++ { - this.Sdk[i] = NewPopulatedRequestRecord_Observed_SDKEvent(r, easy) - } - } - if r.Intn(10) != 0 { - v29 := r.Intn(5) - this.SqreenExceptions = make([]*RequestRecord_Observed_Exception, v29) - for i := 0; i < v29; i++ { - this.SqreenExceptions[i] = NewPopulatedRequestRecord_Observed_Exception(r, easy) - } - } - if r.Intn(10) != 0 { - v30 := r.Intn(5) - this.Observations = make([]*RequestRecord_Observed_Observation, v30) - for i := 0; i < v30; i++ { - this.Observations[i] = NewPopulatedRequestRecord_Observed_Observation(r, easy) - } - } - if r.Intn(10) != 0 { - v31 := r.Intn(5) - this.DataPoints = make([]*RequestRecord_Observed_DataPoint, v31) - for i := 0; i < v31; i++ { - this.DataPoints[i] = NewPopulatedRequestRecord_Observed_DataPoint(r, easy) - } - } - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedApi(r, 6) - } - return this -} - -func NewPopulatedRequestRecord_Observed_Attack(r randyApi, easy bool) *RequestRecord_Observed_Attack { - this := &RequestRecord_Observed_Attack{} - this.RuleName = string(randStringApi(r)) - this.Test = bool(bool(r.Intn(2) == 0)) - this.Infos = string(randStringApi(r)) - v32 := r.Intn(10) - this.Backtrace = make([]string, v32) - for i := 0; i < v32; i++ { - this.Backtrace[i] = string(randStringApi(r)) - } - v33 := github_com_gogo_protobuf_types.NewPopulatedStdTime(r, easy) - this.Time = *v33 - this.Block = bool(bool(r.Intn(2) == 0)) - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedApi(r, 7) - } - return this -} - -func NewPopulatedRequestRecord_Observed_SDKEvent(r randyApi, easy bool) *RequestRecord_Observed_SDKEvent { - this := &RequestRecord_Observed_SDKEvent{} - v34 := github_com_gogo_protobuf_types.NewPopulatedStdTime(r, easy) - this.Time = *v34 - this.Name = string(randStringApi(r)) - v35 := NewPopulatedRequestRecord_Observed_SDKEvent_Args(r, easy) - this.Args = *v35 - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedApi(r, 4) - } - return this -} - -func NewPopulatedRequestRecord_Observed_SDKEvent_Args(r randyApi, easy bool) *RequestRecord_Observed_SDKEvent_Args { - this := &RequestRecord_Observed_SDKEvent_Args{} - oneofNumber_Args := []int32{1, 2}[r.Intn(2)] - switch oneofNumber_Args { - case 1: - this.Args = NewPopulatedRequestRecord_Observed_SDKEvent_Args_Track_(r, easy) - case 2: - this.Args = NewPopulatedRequestRecord_Observed_SDKEvent_Args_Identify_(r, easy) - } - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedApi(r, 3) - } - return this -} - -func NewPopulatedRequestRecord_Observed_SDKEvent_Args_Track_(r randyApi, easy bool) *RequestRecord_Observed_SDKEvent_Args_Track_ { - this := &RequestRecord_Observed_SDKEvent_Args_Track_{} - this.Track = NewPopulatedRequestRecord_Observed_SDKEvent_Args_Track(r, easy) - return this -} -func NewPopulatedRequestRecord_Observed_SDKEvent_Args_Identify_(r randyApi, easy bool) *RequestRecord_Observed_SDKEvent_Args_Identify_ { - this := &RequestRecord_Observed_SDKEvent_Args_Identify_{} - this.Identify = NewPopulatedRequestRecord_Observed_SDKEvent_Args_Identify(r, easy) - return this -} -func NewPopulatedRequestRecord_Observed_SDKEvent_Args_Track(r randyApi, easy bool) *RequestRecord_Observed_SDKEvent_Args_Track { - this := &RequestRecord_Observed_SDKEvent_Args_Track{} - this.Event = string(randStringApi(r)) - if r.Intn(10) != 0 { - this.Options = NewPopulatedRequestRecord_Observed_SDKEvent_Args_Track_Options(r, easy) - } - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedApi(r, 3) - } - return this -} - -func NewPopulatedRequestRecord_Observed_SDKEvent_Args_Track_Options(r randyApi, easy bool) *RequestRecord_Observed_SDKEvent_Args_Track_Options { - this := &RequestRecord_Observed_SDKEvent_Args_Track_Options{} - if r.Intn(10) != 0 { - this.Properties = NewPopulatedStruct(r) - } - if r.Intn(10) != 0 { - this.UserIdentifiers = NewPopulatedStruct(r) - } - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedApi(r, 3) - } - return this -} - -func NewPopulatedRequestRecord_Observed_SDKEvent_Args_Identify(r randyApi, easy bool) *RequestRecord_Observed_SDKEvent_Args_Identify { - this := &RequestRecord_Observed_SDKEvent_Args_Identify{} - if r.Intn(10) != 0 { - this.UserIdentifiers = NewPopulatedStruct(r) - } - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedApi(r, 2) - } - return this -} - -func NewPopulatedRequestRecord_Observed_Exception(r randyApi, easy bool) *RequestRecord_Observed_Exception { - this := &RequestRecord_Observed_Exception{} - this.Message = string(randStringApi(r)) - this.Klass = string(randStringApi(r)) - this.RuleName = string(randStringApi(r)) - this.Test = bool(bool(r.Intn(2) == 0)) - this.Infos = string(randStringApi(r)) - v36 := r.Intn(10) - this.Backtrace = make([]string, v36) - for i := 0; i < v36; i++ { - this.Backtrace[i] = string(randStringApi(r)) - } - v37 := github_com_gogo_protobuf_types.NewPopulatedStdTime(r, easy) - this.Time = *v37 - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedApi(r, 8) - } - return this -} - -func NewPopulatedRequestRecord_Observed_Observation(r randyApi, easy bool) *RequestRecord_Observed_Observation { - this := &RequestRecord_Observed_Observation{} - this.Category = string(randStringApi(r)) - this.Key = string(randStringApi(r)) - this.Value = string(randStringApi(r)) - v38 := github_com_gogo_protobuf_types.NewPopulatedStdTime(r, easy) - this.Time = *v38 - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedApi(r, 5) - } - return this -} - -func NewPopulatedRequestRecord_Observed_DataPoint(r randyApi, easy bool) *RequestRecord_Observed_DataPoint { - this := &RequestRecord_Observed_DataPoint{} - this.RulespackId = string(randStringApi(r)) - this.RuleName = string(randStringApi(r)) - v39 := github_com_gogo_protobuf_types.NewPopulatedStdTime(r, easy) - this.Time = *v39 - this.Infos = string(randStringApi(r)) - if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedApi(r, 5) - } - return this -} - -type randyApi interface { - Float32() float32 - Float64() float64 - Int63() int64 - Int31() int32 - Uint32() uint32 - Intn(n int) int -} - -func randUTF8RuneApi(r randyApi) rune { - ru := r.Intn(62) - if ru < 10 { - return rune(ru + 48) - } else if ru < 36 { - return rune(ru + 55) - } - return rune(ru + 61) -} -func randStringApi(r randyApi) string { - v40 := r.Intn(100) - tmps := make([]rune, v40) - for i := 0; i < v40; i++ { - tmps[i] = randUTF8RuneApi(r) - } - return string(tmps) -} -func randUnrecognizedApi(r randyApi, maxFieldNumber int) (dAtA []byte) { - l := r.Intn(5) - for i := 0; i < l; i++ { - wire := r.Intn(4) - if wire == 3 { - wire = 5 - } - fieldNumber := maxFieldNumber + r.Intn(100) - dAtA = randFieldApi(dAtA, r, fieldNumber, wire) - } - return dAtA -} -func randFieldApi(dAtA []byte, r randyApi, fieldNumber int, wire int) []byte { - key := uint32(fieldNumber)<<3 | uint32(wire) - switch wire { - case 0: - dAtA = encodeVarintPopulateApi(dAtA, uint64(key)) - v41 := r.Int63() - if r.Intn(2) == 0 { - v41 *= -1 - } - dAtA = encodeVarintPopulateApi(dAtA, uint64(v41)) - case 1: - dAtA = encodeVarintPopulateApi(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) - case 2: - dAtA = encodeVarintPopulateApi(dAtA, uint64(key)) - ll := r.Intn(100) - dAtA = encodeVarintPopulateApi(dAtA, uint64(ll)) - for j := 0; j < ll; j++ { - dAtA = append(dAtA, byte(r.Intn(256))) - } - default: - dAtA = encodeVarintPopulateApi(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) - } - return dAtA -} -func encodeVarintPopulateApi(dAtA []byte, v uint64) []byte { - for v >= 1<<7 { - dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) - v >>= 7 - } - dAtA = append(dAtA, uint8(v)) - return dAtA -} diff --git a/agent/internal/backend/api/jsonpb.go b/agent/internal/backend/api/jsonpb.go index a43d8cae..d2e44235 100644 --- a/agent/internal/backend/api/jsonpb.go +++ b/agent/internal/backend/api/jsonpb.go @@ -4,22 +4,11 @@ import ( "encoding/json" fmt "fmt" - "github.com/gogo/protobuf/jsonpb" + fuzz "github.com/google/gofuzz" ) -// DefaultJSONPBMarshaler is the default JSON to Protocol-Buffer marsahler. It -// uses the fields original names and includes zero values of empty fields. -var DefaultJSONPBMarshaler = jsonpb.Marshaler{ - OrigName: true, - EmitDefaults: true, -} - var RequestRecordVersion = "20171208" -func (h *RequestRecord_Request_Header) MarshalJSONPB(_ *jsonpb.Marshaler) ([]byte, error) { - return h.MarshalJSON() -} - func (h *RequestRecord_Request_Header) MarshalJSON() ([]byte, error) { if h == nil { return []byte("[]"), nil @@ -29,20 +18,18 @@ func (h *RequestRecord_Request_Header) MarshalJSON() ([]byte, error) { type ListValue []interface{} -func NewPopulatedListValue(_ randyApi) *ListValue { - return (*ListValue)(&[]interface{}{}) +func (l ListValue) Fuzz(c fuzz.Continue) { + var a []int + c.Fuzz(a) + for _, v := range a { + l = append(l, v) + } } func (l ListValue) MarshalJSON() ([]byte, error) { return json.Marshal(([]interface{})(l)) } -func (l ListValue) MarshalJSONPB(_ *jsonpb.Marshaler) ([]byte, error) { - return l.MarshalJSON() -} - -func (l ListValue) ProtoMessage() {} - func (l ListValue) String() string { return fmt.Sprintf("%v", ([]interface{})(l)) } @@ -58,20 +45,16 @@ type Struct struct { Value interface{} } -func NewPopulatedStruct(_ randyApi) *Struct { - return &Struct{} -} - -func (s *Struct) MarshalJSONPB(_ *jsonpb.Marshaler) ([]byte, error) { - return s.MarshalJSON() +func (s *Struct) Fuzz(c fuzz.Continue) { + var v map[string]string + c.Fuzz(&v) + s.Value = v } func (s *Struct) MarshalJSON() ([]byte, error) { return json.Marshal(s.Value) } -func (s *Struct) ProtoMessage() {} - func (s *Struct) String() string { return fmt.Sprintf("%+v", s.Value) } @@ -80,10 +63,6 @@ func (s *Struct) Reset() { s.Value = nil } -func (e *BatchRequest_Event) MarshalJSONPB(_ *jsonpb.Marshaler) ([]byte, error) { - return e.MarshalJSON() -} - func (e *BatchRequest_Event) MarshalJSON() ([]byte, error) { buf, err := e.Event.MarshalJSON() if err != nil { @@ -107,10 +86,6 @@ func (e *RequestRecord_Observed_SDKEvent_Args) MarshalJSON() ([]byte, error) { return args.MarshalJSON() } -func (e *RequestRecord_Observed_SDKEvent_Args) MarshalJSONPB(_ *jsonpb.Marshaler) ([]byte, error) { - return e.MarshalJSON() -} - func (track *RequestRecord_Observed_SDKEvent_Args_Track) MarshalJSON() ([]byte, error) { var args ListValue if track != nil { @@ -123,10 +98,6 @@ func (track *RequestRecord_Observed_SDKEvent_Args_Track) MarshalJSON() ([]byte, return args.MarshalJSON() } -func (e *RequestRecord_Observed_SDKEvent_Args_Track) MarshalJSONPB(_ *jsonpb.Marshaler) ([]byte, error) { - return e.MarshalJSON() -} - func (identify *RequestRecord_Observed_SDKEvent_Args_Identify) MarshalJSON() ([]byte, error) { var args ListValue if identify != nil { @@ -134,7 +105,3 @@ func (identify *RequestRecord_Observed_SDKEvent_Args_Identify) MarshalJSON() ([] } return args.MarshalJSON() } - -func (e *RequestRecord_Observed_SDKEvent_Args_Identify) MarshalJSONPB(_ *jsonpb.Marshaler) ([]byte, error) { - return e.MarshalJSON() -} diff --git a/agent/internal/backend/api/jsonpb_test.go b/agent/internal/backend/api/jsonpb_test.go index c404666d..538b8f41 100644 --- a/agent/internal/backend/api/jsonpb_test.go +++ b/agent/internal/backend/api/jsonpb_test.go @@ -1,6 +1,8 @@ package api_test import ( + "encoding/json" + . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -21,9 +23,9 @@ var _ = Describe("API", func() { }, }, } - str, err := api.DefaultJSONPBMarshaler.MarshalToString(pb) + buf, err := json.Marshal(pb) Expect(err).NotTo(HaveOccurred()) - Expect(str).To(Equal(`{"batch":[{"event_type":"request_record","A":16,"B":22}]}`)) + Expect(string(buf)).To(Equal(`{"batch":[{"event_type":"request_record","A":16,"B":22}]}`)) }) }) @@ -35,9 +37,9 @@ var _ = Describe("API", func() { Key: "my key", Value: "my value", } - str, err := api.DefaultJSONPBMarshaler.MarshalToString(pb) + buf, err := json.Marshal(pb) Expect(err).NotTo(HaveOccurred()) - Expect(str).To(Equal(`["my key", "my value"]`)) + Expect(string(buf)).To(Equal(`["my key","my value"]`)) }) }) }) @@ -52,7 +54,9 @@ var _ = Describe("API", func() { ) JustBeforeEach(func() { - str, err = api.DefaultJSONPBMarshaler.MarshalToString(pb) + var buf []byte + buf, err = json.Marshal(pb) + str = string(buf) }) Describe("Track event", func() { @@ -149,9 +153,9 @@ var _ = Describe("API", func() { }, } - str, err := api.DefaultJSONPBMarshaler.MarshalToString(pb) + buf, err := json.Marshal(pb) Expect(err).NotTo(HaveOccurred()) - Expect(str).To(Equal(`[{"key 1":33,"key 2":"value 2","key 3":[1,2,3],"key 4":{"A":16,"B":22}}]`)) + Expect(string(buf)).To(Equal(`[{"key 1":33,"key 2":"value 2","key 3":[1,2,3],"key 4":{"A":16,"B":22}}]`)) }) }) }) diff --git a/agent/internal/backend/client.go b/agent/internal/backend/client.go index 678a2634..0dbdf176 100644 --- a/agent/internal/backend/client.go +++ b/agent/internal/backend/client.go @@ -2,14 +2,13 @@ package backend import ( "bytes" + "encoding/json" "io" "io/ioutil" "net/http" "net/http/httputil" "net/url" - "github.com/gogo/protobuf/jsonpb" - "github.com/gogo/protobuf/proto" "github.com/sqreen/go-agent/agent/internal/backend/api" "github.com/sqreen/go-agent/agent/internal/config" "github.com/sqreen/go-agent/agent/internal/plog" @@ -17,10 +16,9 @@ import ( ) type Client struct { - client *http.Client - backendURL string - pbMarshaler jsonpb.Marshaler - logger *plog.Logger + client *http.Client + backendURL string + logger *plog.Logger } func NewClient(backendURL string, cfg *config.Config, logger *plog.Logger) (*Client, error) { @@ -51,9 +49,8 @@ func NewClient(backendURL string, cfg *config.Config, logger *plog.Logger) (*Cli Timeout: config.BackendHTTPAPIRequestTimeout, Transport: transport, }, - backendURL: backendURL, - pbMarshaler: api.DefaultJSONPBMarshaler, - logger: plog.NewLogger("client", logger), + backendURL: backendURL, + logger: plog.NewLogger("client", logger), } return client, nil @@ -112,11 +109,15 @@ func (c *Client) Batch(req *api.BatchRequest, session string) error { return nil } -func (c *Client) Do(req *http.Request, pbs ...proto.Message) error { +// Do performs the request whose body is pbs[0] pointer, while the expected +// response is pbs[1] pointer. They are optional, and must be used according to +// the cases request case. +func (c *Client) Do(req *http.Request, pbs ...interface{}) error { var buf bytes.Buffer + pbMarshaler := json.NewEncoder(&buf) if len(pbs) >= 1 { - err := c.pbMarshaler.Marshal(&buf, pbs[0]) + err := pbMarshaler.Encode(pbs[0]) if err != nil { return err } @@ -142,7 +143,7 @@ func (c *Client) Do(req *http.Request, pbs ...proto.Message) error { // json parsers may stop before. // See also: https://github.com/google/go-github/pull/317 defer func() { - // fixme: log when n > 00 + // FIXME: log when n > 00 io.CopyN(ioutil.Discard, res.Body, 1) res.Body.Close() }() @@ -152,7 +153,8 @@ func (c *Client) Do(req *http.Request, pbs ...proto.Message) error { } if len(pbs) >= 2 { - err = jsonpb.Unmarshal(res.Body, pbs[1]) + pbUnmarshaler := json.NewDecoder(res.Body) + err = pbUnmarshaler.Decode(pbs[1]) if err != nil && err != io.EOF { return err } diff --git a/agent/internal/backend/client_test.go b/agent/internal/backend/client_test.go index 5ec3cc59..c2d7d0d4 100644 --- a/agent/internal/backend/client_test.go +++ b/agent/internal/backend/client_test.go @@ -1,16 +1,11 @@ package backend_test import ( - "io/ioutil" - math_rand "math/rand" "net/http" "os" - "reflect" "testing" - "time" - "github.com/gogo/protobuf/jsonpb" - "github.com/gogo/protobuf/proto" + fuzz "github.com/google/gofuzz" . "github.com/onsi/gomega" "github.com/onsi/gomega/ghttp" "github.com/sqreen/go-agent/agent/internal/backend" @@ -24,8 +19,7 @@ import ( var ( logger = plog.NewLogger("test", nil) cfg = config.New(logger) - seed = time.Now().UnixNano() - popr = math_rand.New(math_rand.NewSource(seed)) + fuzzer = fuzz.New() ) func TestClient(t *testing.T) { @@ -40,13 +34,8 @@ func TestClient(t *testing.T) { endpointCfg := &config.BackendHTTPAPIEndpoint.AppLogin - response := api.NewPopulatedAppLoginResponse(popr, false) - err := JSONPBLoopback(response) - g.Expect(err).ToNot(HaveOccurred()) - - request := api.NewPopulatedAppLoginRequest(popr, false) - err = JSONPBLoopback(request) - g.Expect(err).ToNot(HaveOccurred()) + response := NewRandomAppLoginResponse() + request := NewRandomAppLoginRequest() headers := http.Header{ config.BackendHTTPAPIHeaderToken: []string{token}, @@ -73,13 +62,8 @@ func TestClient(t *testing.T) { endpointCfg := &config.BackendHTTPAPIEndpoint.AppBeat - response := api.NewPopulatedAppBeatResponse(popr, false) - err := JSONPBLoopback(response) - g.Expect(err).ToNot(HaveOccurred()) - - request := api.NewPopulatedAppBeatRequest(popr, false) - err = JSONPBLoopback(request) - g.Expect(err).ToNot(HaveOccurred()) + response := NewRandomAppBeatResponse() + request := NewRandomAppBeatRequest() headers := http.Header{ config.BackendHTTPAPIHeaderSession: []string{session}, @@ -106,9 +90,7 @@ func TestClient(t *testing.T) { endpointCfg := &config.BackendHTTPAPIEndpoint.Batch - request := api.NewPopulatedBatchRequest(popr, false) - err := JSONPBLoopback(request) - g.Expect(err).ToNot(HaveOccurred()) + request := NewRandomBatchRequest() headers := http.Header{ config.BackendHTTPAPIHeaderSession: []string{session}, @@ -150,30 +132,18 @@ func TestClient(t *testing.T) { }) } -// JSONPBLoopback passes msg through the JSON-PB marshaler and unmarshaler so -// that msg then has the same data has another protobuf parsed from a JSONPB -// source. Used by loopback tests of API calls. -func JSONPBLoopback(msg proto.Message) error { - msgJSON, err := api.DefaultJSONPBMarshaler.MarshalToString(msg) - if err != nil { - return err - } - msg.Reset() - return jsonpb.UnmarshalString(msgJSON, msg) -} - -func initFakeServer(endpointCfg *config.HTTPAPIEndpoint, request, response proto.Message, statusCode int, headers http.Header) *ghttp.Server { +func initFakeServer(endpointCfg *config.HTTPAPIEndpoint, request, response interface{}, statusCode int, headers http.Header) *ghttp.Server { handlers := []http.HandlerFunc{ ghttp.VerifyRequest(endpointCfg.Method, endpointCfg.URL), ghttp.VerifyHeader(headers), } if request != nil { - handlers = append(handlers, VerifyJSONPBRepresenting(request)) + handlers = append(handlers, ghttp.VerifyJSONRepresenting(request)) } if response != nil { - handlers = append(handlers, RespondWithJSONPB(statusCode, response)) + handlers = append(handlers, ghttp.RespondWithJSONEncoded(statusCode, response)) } else { handlers = append(handlers, ghttp.RespondWith(statusCode, nil)) } @@ -183,47 +153,6 @@ func initFakeServer(endpointCfg *config.HTTPAPIEndpoint, request, response proto return server } -func RespondWithJSONPB(statusCode int, object proto.Message, optionalHeader ...http.Header) http.HandlerFunc { - return func(w http.ResponseWriter, req *http.Request) { - data, err := api.DefaultJSONPBMarshaler.MarshalToString(object) - Expect(err).ShouldNot(HaveOccurred()) - var headers http.Header - if len(optionalHeader) == 1 { - headers = optionalHeader[0] - } else { - headers = make(http.Header) - } - if _, found := headers["Content-Type"]; !found { - headers["Content-Type"] = []string{"application/json"} - } - copyHeader(headers, w.Header()) - w.WriteHeader(statusCode) - w.Write([]byte(data)) - } -} - -func VerifyJSONPBRepresenting(expected proto.Message) http.HandlerFunc { - return ghttp.CombineHandlers( - ghttp.VerifyContentType("application/json"), - func(w http.ResponseWriter, req *http.Request) { - body, err := ioutil.ReadAll(req.Body) - Expect(err).ShouldNot(HaveOccurred()) - req.Body.Close() - - expectedType := reflect.TypeOf(expected) - actualValuePtr := reflect.New(expectedType.Elem()) - - actual, ok := actualValuePtr.Interface().(proto.Message) - Expect(ok).Should(BeTrue(), "Message value is not a proto.Message") - - err = jsonpb.UnmarshalString(string(body), actual) - Expect(err).ShouldNot(HaveOccurred(), "Failed to unmarshal protobuf") - - Expect(actual).Should(Equal(expected), "ProtoBuf Mismatch") - }, - ) -} - func copyHeader(src http.Header, dst http.Header) { for key, value := range src { dst[key] = value @@ -271,9 +200,39 @@ func testProxy(t *testing.T, envVar string) { client, err := backend.NewClient(cfg.BackendHTTPAPIBaseURL(), cfg, logger) require.Equal(t, err, nil) // Perform a request that should go through the proxy. - request := api.NewPopulatedAppLoginRequest(popr, false) + request := NewRandomAppLoginRequest() _, err = client.AppLogin(request, "my-token", "my-app") // A request has been received: //require.NotEqual(t, len(back.ReceivedRequests()), 0, "0 request received") require.NotEqual(t, len(proxy.ReceivedRequests()), 0, "0 request received") } + +func NewRandomAppLoginResponse() *api.AppLoginResponse { + pb := new(api.AppLoginResponse) + fuzzer.Fuzz(pb) + return pb +} + +func NewRandomAppLoginRequest() *api.AppLoginRequest { + pb := new(api.AppLoginRequest) + fuzzer.Fuzz(pb) + return pb +} + +func NewRandomAppBeatResponse() *api.AppBeatResponse { + pb := new(api.AppBeatResponse) + fuzzer.Fuzz(pb) + return pb +} + +func NewRandomAppBeatRequest() *api.AppBeatRequest { + pb := new(api.AppBeatRequest) + fuzzer.Fuzz(pb) + return pb +} + +func NewRandomBatchRequest() *api.BatchRequest { + pb := new(api.BatchRequest) + fuzzer.Fuzz(pb) + return pb +} diff --git a/agent/internal/request.go b/agent/internal/request.go index 1c9463cd..83e9b097 100644 --- a/agent/internal/request.go +++ b/agent/internal/request.go @@ -9,7 +9,6 @@ import ( "sync" "time" - "github.com/gogo/protobuf/proto" "github.com/google/uuid" "github.com/sqreen/go-agent/agent/internal/backend/api" "github.com/sqreen/go-agent/agent/internal/config" @@ -239,10 +238,6 @@ func (e *HTTPRequestEvent) GetUserIdentifiers() *api.Struct { return &api.Struct{e.userIdentifiers} } -func (e *HTTPRequestEvent) Proto() proto.Message { - return api.NewRequestRecord_Observed_SDKEventFromFace(e) -} - type httpRequestRecord struct { ctx *HTTPRequestRecord rulespackID string @@ -389,10 +384,6 @@ func (r *httpRequestRecord) GetObserved() api.RequestRecord_Observed { } } -func (r *httpRequestRecord) Proto() proto.Message { - return api.NewRequestRecordFromFace(r) -} - func isGlobal(ip net.IP) bool { if len(ip) == 4 && config.IPv4PublicNetwork.Contains(ip) { return false diff --git a/go.mod b/go.mod index 25668e02..edd0adb6 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,7 @@ require ( github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7 // indirect github.com/gin-gonic/gin v1.3.0 github.com/gogo/protobuf v1.2.0 + github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf github.com/google/uuid v1.1.0 github.com/json-iterator/go v1.1.5 // indirect github.com/labstack/echo v3.3.10+incompatible From c93dd2ca009d5a37d11c45897830319cb69f187e Mon Sep 17 00:00:00 2001 From: Julio Guerra Date: Tue, 19 Mar 2019 10:51:55 +0100 Subject: [PATCH 13/25] agent/config: configurable stripping of the referer http header Add a new configuration key `strip_http_referer` (env key being `SQREEN_STRIP_HTTP_REFERER`) whose boolean value true when set to any non-empty value, false otherwise. --- agent/internal/config/config.go | 9 ++++++ agent/internal/config/config_test.go | 47 +++++++++++++++++++++++++++- 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/agent/internal/config/config.go b/agent/internal/config/config.go index b0ed703b..9469711f 100644 --- a/agent/internal/config/config.go +++ b/agent/internal/config/config.go @@ -191,6 +191,7 @@ const ( configKeyHTTPClientIPHeader = `ip_header` configKeyBackendHTTPAPIProxy = `proxy` configKeyDisable = `disable` + configKeyStripHTTPReferer = `strip_http_referer` ) // User configuration's default values. @@ -233,6 +234,7 @@ func New(logger *plog.Logger) *Config { manager.SetDefault(configKeyHTTPClientIPHeader, "") manager.SetDefault(configKeyBackendHTTPAPIProxy, "") manager.SetDefault(configKeyDisable, "") + manager.SetDefault(configKeyStripHTTPReferer, "") err := manager.ReadInConfig() if err != nil { @@ -278,6 +280,13 @@ func (c *Config) Disable() bool { return disable != "" || c.BackendHTTPAPIToken() == "" } +// Disable returns true when the agent should be strip the `Referer` HTTP +// header, false otherwise. +func (c *Config) StripHTTPReferer() bool { + strip := sanitizeString(c.GetString(configKeyStripHTTPReferer)) + return strip != "" +} + func sanitizeString(s string) string { return strings.TrimSpace(s) } diff --git a/agent/internal/config/config_test.go b/agent/internal/config/config_test.go index 5faacb21..90d51e0f 100644 --- a/agent/internal/config/config_test.go +++ b/agent/internal/config/config_test.go @@ -61,11 +61,34 @@ func TestUserConfig(t *testing.T) { SomeValue: testlib.RandString(2, 30), }, } - for _, tc := range stringValueTests { testStringValue(t, cfg, tc.Name, tc.GetCfgValue, tc.ConfigKey, tc.DefaultValue, tc.SomeValue) } + // The reflect package could be used instead + boolValueTests := []struct { + Name string + GetCfgValue func() bool + ConfigKey string + DefaultValue bool + CfgValue string + ExpectedValue bool + }{ + { + Name: "Strip the Referer HTTP Header", + GetCfgValue: cfg.StripHTTPReferer, + ConfigKey: configKeyStripHTTPReferer, + DefaultValue: false, + CfgValue: testlib.RandString(1, 30), + ExpectedValue: true, + }, + } + for _, tc := range boolValueTests { + testBoolValue(t, cfg, tc.Name, tc.GetCfgValue, tc.ConfigKey, tc.DefaultValue, tc.CfgValue, tc.ExpectedValue) + } + + // The disable which is a special config case which also depends on the sqreen + // token value. t.Run("Disable", func(t *testing.T) { os.Setenv("SQREEN_TOKEN", testlib.RandString(2, 30)) defer os.Unsetenv("SQREEN_TOKEN") @@ -154,6 +177,28 @@ func testStringValue(t *testing.T, cfg *Config, name string, getCfgValue func() }) } +func testBoolValue(t *testing.T, cfg *Config, name string, getCfgValue func() bool, envKey string, defaultValue bool, cfgValue string, expectedValue bool) { + t.Run(name, func(t *testing.T) { + t.Run("Default value", func(t *testing.T) { + require.Equal(t, getCfgValue(), defaultValue) + }) + + t.Run("Set through environment variable", func(t *testing.T) { + envVar := strings.ToUpper(configEnvPrefix) + "_" + strings.ToUpper(envKey) + os.Setenv(envVar, cfgValue) + defer os.Unsetenv(envVar) + require.Equal(t, getCfgValue(), expectedValue) + }) + + t.Run("Set through configuration file", func(t *testing.T) { + filename := newCfgFile(t, ".", envKey+`: `+cfgValue) + defer os.Remove(filename) + cfg.ReadInConfig() + require.Equal(t, getCfgValue(), expectedValue) + }) + }) +} + func newCfgFile(t *testing.T, path string, content string) string { os.MkdirAll(path, 0700) cfg, err := os.Create(path + "/sqreen.yml") From 3bf3547844368fac0d4cece654d696ed4b8d1469 Mon Sep 17 00:00:00 2001 From: Julio Guerra Date: Tue, 19 Mar 2019 10:55:09 +0100 Subject: [PATCH 14/25] agent: configurable sending of the referer header Do not send the referer header when explicitly configured by the user. --- agent/internal/request.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/agent/internal/request.go b/agent/internal/request.go index 83e9b097..398fff5d 100644 --- a/agent/internal/request.go +++ b/agent/internal/request.go @@ -352,7 +352,12 @@ func (r *httpRequestRecord) GetRequest() api.RequestRecord_Request { requestId = hex.EncodeToString(uuid[:]) } - // FIXME: create it from an interface for compile-time errors. + var referer string + if !r.ctx.agent.config.StripHTTPReferer() { + referer = req.Referer() + } + + // FIXME: create it from an interface for compile-time error-checking. return api.RequestRecord_Request{ Rid: requestId, Headers: headers, @@ -365,7 +370,7 @@ func (r *httpRequestRecord) GetRequest() api.RequestRecord_Request { RemotePort: remotePort, Scheme: scheme, UserAgent: req.UserAgent(), - Referer: req.Referer(), + Referer: referer, } } From ed1e0465ba482d2a110f3e7b8b7bb25a2c583632 Mon Sep 17 00:00:00 2001 From: Julio Guerra Date: Tue, 19 Mar 2019 11:08:49 +0100 Subject: [PATCH 15/25] agent/backend/api: fix missing expected backend message keys Remove `omitempty` json tags as the backend expects them, even if the value is the zero value. --- agent/internal/backend/api/api.go | 161 ++++++++++++++---------------- 1 file changed, 77 insertions(+), 84 deletions(-) diff --git a/agent/internal/backend/api/api.go b/agent/internal/backend/api/api.go index e7e9b91a..e704d7a2 100644 --- a/agent/internal/backend/api/api.go +++ b/agent/internal/backend/api/api.go @@ -4,76 +4,75 @@ import ( "time" // _ "github.com/gogo/protobuf/gogoproto" github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" - fuzz "github.com/google/gofuzz" // _ "github.com/gogo/protobuf/types" ) type AppLoginRequest struct { - BundleSignature string `protobuf:"bytes,1,opt,name=bundle_signature,json=bundleSignature,proto3" json:"bundle_signature,omitempty"` + BundleSignature string `protobuf:"bytes,1,opt,name=bundle_signature,json=bundleSignature,proto3" json:"bundle_signature"` VariousInfos AppLoginRequest_VariousInfos `protobuf:"bytes,2,opt,name=various_infos,json=variousInfos,proto3" json:"various_infos"` - AgentType string `protobuf:"bytes,3,opt,name=agent_type,json=agentType,proto3" json:"agent_type,omitempty"` - AgentVersion string `protobuf:"bytes,4,opt,name=agent_version,json=agentVersion,proto3" json:"agent_version,omitempty"` - OsType string `protobuf:"bytes,5,opt,name=os_type,json=osType,proto3" json:"os_type,omitempty"` - Hostname string `protobuf:"bytes,6,opt,name=hostname,proto3" json:"hostname,omitempty"` - RuntimeType string `protobuf:"bytes,7,opt,name=runtime_type,json=runtimeType,proto3" json:"runtime_type,omitempty"` - RuntimeVersion string `protobuf:"bytes,8,opt,name=runtime_version,json=runtimeVersion,proto3" json:"runtime_version,omitempty"` - FrameworkType string `protobuf:"bytes,9,opt,name=framework_type,json=frameworkType,proto3" json:"framework_type,omitempty"` - FrameworkVersion string `protobuf:"bytes,10,opt,name=framework_version,json=frameworkVersion,proto3" json:"framework_version,omitempty"` - Environment string `protobuf:"bytes,11,opt,name=environment,proto3" json:"environment,omitempty"` + AgentType string `protobuf:"bytes,3,opt,name=agent_type,json=agentType,proto3" json:"agent_type"` + AgentVersion string `protobuf:"bytes,4,opt,name=agent_version,json=agentVersion,proto3" json:"agent_version"` + OsType string `protobuf:"bytes,5,opt,name=os_type,json=osType,proto3" json:"os_type"` + Hostname string `protobuf:"bytes,6,opt,name=hostname,proto3" json:"hostname"` + RuntimeType string `protobuf:"bytes,7,opt,name=runtime_type,json=runtimeType,proto3" json:"runtime_type"` + RuntimeVersion string `protobuf:"bytes,8,opt,name=runtime_version,json=runtimeVersion,proto3" json:"runtime_version"` + FrameworkType string `protobuf:"bytes,9,opt,name=framework_type,json=frameworkType,proto3" json:"framework_type"` + FrameworkVersion string `protobuf:"bytes,10,opt,name=framework_version,json=frameworkVersion,proto3" json:"framework_version"` + Environment string `protobuf:"bytes,11,opt,name=environment,proto3" json:"environment"` } type AppLoginRequest_VariousInfos struct { Time time.Time `protobuf:"bytes,1,opt,name=time,proto3,stdtime" json:"time"` - Pid uint32 `protobuf:"varint,3,opt,name=pid,proto3" json:"pid,omitempty"` - Ppid uint32 `protobuf:"varint,4,opt,name=ppid,proto3" json:"ppid,omitempty"` - Euid uint32 `protobuf:"varint,5,opt,name=euid,proto3" json:"euid,omitempty"` - Egid uint32 `protobuf:"varint,6,opt,name=egid,proto3" json:"egid,omitempty"` - Uid uint32 `protobuf:"varint,7,opt,name=uid,proto3" json:"uid,omitempty"` - Gid uint32 `protobuf:"varint,8,opt,name=gid,proto3" json:"gid,omitempty"` - Name string `protobuf:"bytes,9,opt,name=name,proto3" json:"name,omitempty"` + Pid uint32 `protobuf:"varint,3,opt,name=pid,proto3" json:"pid"` + Ppid uint32 `protobuf:"varint,4,opt,name=ppid,proto3" json:"ppid"` + Euid uint32 `protobuf:"varint,5,opt,name=euid,proto3" json:"euid"` + Egid uint32 `protobuf:"varint,6,opt,name=egid,proto3" json:"egid"` + Uid uint32 `protobuf:"varint,7,opt,name=uid,proto3" json:"uid"` + Gid uint32 `protobuf:"varint,8,opt,name=gid,proto3" json:"gid"` + Name string `protobuf:"bytes,9,opt,name=name,proto3" json:"name"` } type AppLoginResponse struct { - SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` - Status bool `protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"` + SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id"` + Status bool `protobuf:"varint,2,opt,name=status,proto3" json:"status"` Commands []CommandRequest `protobuf:"bytes,3,rep,name=commands,proto3" json:"commands"` Features AppLoginResponse_Feature `protobuf:"bytes,4,opt,name=features,proto3" json:"features"` - PackId string `protobuf:"bytes,5,opt,name=pack_id,json=packId,proto3" json:"pack_id,omitempty"` + PackId string `protobuf:"bytes,5,opt,name=pack_id,json=packId,proto3" json:"pack_id"` Rules []Rule `protobuf:"bytes,6,rep,name=rules,proto3" json:"rules"` } type AppLoginResponse_Feature struct { - BatchSize uint32 `protobuf:"varint,1,opt,name=batch_size,json=batchSize,proto3" json:"batch_size,omitempty"` - MaxStaleness uint32 `protobuf:"varint,2,opt,name=max_staleness,json=maxStaleness,proto3" json:"max_staleness,omitempty"` - HeartbeatDelay uint32 `protobuf:"varint,3,opt,name=heartbeat_delay,json=heartbeatDelay,proto3" json:"heartbeat_delay,omitempty"` + BatchSize uint32 `protobuf:"varint,1,opt,name=batch_size,json=batchSize,proto3" json:"batch_size"` + MaxStaleness uint32 `protobuf:"varint,2,opt,name=max_staleness,json=maxStaleness,proto3" json:"max_staleness"` + HeartbeatDelay uint32 `protobuf:"varint,3,opt,name=heartbeat_delay,json=heartbeatDelay,proto3" json:"heartbeat_delay"` } type CommandRequest struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Params []string `protobuf:"bytes,2,rep,name=params,proto3" json:"params,omitempty"` - Uuid string `protobuf:"bytes,3,opt,name=uuid,proto3" json:"uuid,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name"` + Params []string `protobuf:"bytes,2,rep,name=params,proto3" json:"params"` + Uuid string `protobuf:"bytes,3,opt,name=uuid,proto3" json:"uuid"` } type CommandResult struct { - Output string `protobuf:"bytes,1,opt,name=output,proto3" json:"output,omitempty"` - Status bool `protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"` + Output string `protobuf:"bytes,1,opt,name=output,proto3" json:"output"` + Status bool `protobuf:"varint,2,opt,name=status,proto3" json:"status"` } type MetricResponse struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name"` Start time.Time `protobuf:"bytes,2,opt,name=start,proto3,stdtime" json:"start"` Finish time.Time `protobuf:"bytes,3,opt,name=finish,proto3,stdtime" json:"finish"` Observation Struct `protobuf:"bytes,4,opt,name=observation,proto3,customtype=Struct" json:"observation"` } type AppBeatRequest struct { - CommandResults map[string]CommandResult `protobuf:"bytes,1,rep,name=command_results,json=commandResults,proto3" json:"command_results" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + CommandResults map[string]CommandResult `protobuf:"bytes,1,rep,name=command_results,json=commandResults,proto3" json:"command_results,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` Metrics []MetricResponse `protobuf:"bytes,2,rep,name=metrics,proto3" json:"metrics"` } type AppBeatResponse struct { Commands []CommandRequest `protobuf:"bytes,1,rep,name=commands,proto3" json:"commands"` - Status bool `protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"` + Status bool `protobuf:"varint,2,opt,name=status,proto3" json:"status"` } type BatchRequest struct { @@ -81,7 +80,7 @@ type BatchRequest struct { } type BatchRequest_Event struct { - EventType string `protobuf:"bytes,1,opt,name=event_type,json=eventType,proto3" json:"event_type,omitempty"` + EventType string `protobuf:"bytes,1,opt,name=event_type,json=eventType,proto3" json:"event_type"` Event Struct `protobuf:"bytes,2,opt,name=event,proto3,customtype=Struct" json:"event"` } @@ -89,19 +88,19 @@ type Rule struct { } type Dependency struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` - Homepage string `protobuf:"bytes,3,opt,name=homepage,proto3" json:"homepage,omitempty"` - Source *Dependency_Source `protobuf:"bytes,4,opt,name=source,proto3" json:"source,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name"` + Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version"` + Homepage string `protobuf:"bytes,3,opt,name=homepage,proto3" json:"homepage"` + Source *Dependency_Source `protobuf:"bytes,4,opt,name=source,proto3" json:"source"` } type Dependency_Source struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Remotes []string `protobuf:"bytes,2,rep,name=remotes,proto3" json:"remotes,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name"` + Remotes []string `protobuf:"bytes,2,rep,name=remotes,proto3" json:"remotes"` } type RequestRecord struct { - Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version"` RulespackId string `protobuf:"bytes,2,opt,name=rulespack_id,json=rulespackId,proto3" json:"rulespack_id"` ClientIp string `protobuf:"bytes,3,opt,name=client_ip,json=clientIp,proto3" json:"client_ip"` Request RequestRecord_Request `protobuf:"bytes,4,opt,name=request,proto3" json:"request"` @@ -110,33 +109,33 @@ type RequestRecord struct { } type RequestRecord_Request struct { - Rid string `protobuf:"bytes,1,opt,name=rid,proto3" json:"rid,omitempty"` + Rid string `protobuf:"bytes,1,opt,name=rid,proto3" json:"rid"` Headers []RequestRecord_Request_Header `protobuf:"bytes,2,rep,name=headers,proto3" json:"headers"` - Verb string `protobuf:"bytes,3,opt,name=verb,proto3" json:"verb,omitempty"` - Path string `protobuf:"bytes,4,opt,name=path,proto3" json:"path,omitempty"` - RawPath string `protobuf:"bytes,5,opt,name=raw_path,json=rawPath,proto3" json:"raw_path,omitempty"` - Host string `protobuf:"bytes,6,opt,name=host,proto3" json:"host,omitempty"` - Port string `protobuf:"bytes,7,opt,name=port,proto3" json:"port,omitempty"` - RemoteIp string `protobuf:"bytes,8,opt,name=remote_ip,json=remoteIp,proto3" json:"remote_ip,omitempty"` - RemotePort string `protobuf:"bytes,9,opt,name=remote_port,json=remotePort,proto3" json:"remote_port,omitempty"` - Scheme string `protobuf:"bytes,10,opt,name=scheme,proto3" json:"scheme,omitempty"` - UserAgent string `protobuf:"bytes,11,opt,name=user_agent,json=userAgent,proto3" json:"user_agent,omitempty"` - Referer string `protobuf:"bytes,12,opt,name=referer,proto3" json:"referer,omitempty"` + Verb string `protobuf:"bytes,3,opt,name=verb,proto3" json:"verb"` + Path string `protobuf:"bytes,4,opt,name=path,proto3" json:"path"` + RawPath string `protobuf:"bytes,5,opt,name=raw_path,json=rawPath,proto3" json:"raw_path"` + Host string `protobuf:"bytes,6,opt,name=host,proto3" json:"host"` + Port string `protobuf:"bytes,7,opt,name=port,proto3" json:"port"` + RemoteIp string `protobuf:"bytes,8,opt,name=remote_ip,json=remoteIp,proto3" json:"remote_ip"` + RemotePort string `protobuf:"bytes,9,opt,name=remote_port,json=remotePort,proto3" json:"remote_port"` + Scheme string `protobuf:"bytes,10,opt,name=scheme,proto3" json:"scheme"` + UserAgent string `protobuf:"bytes,11,opt,name=user_agent,json=userAgent,proto3" json:"user_agent"` + Referer string `protobuf:"bytes,12,opt,name=referer,proto3" json:"referer"` Params RequestRecord_Request_Params `protobuf:"bytes,13,opt,name=params,proto3" json:"params"` } type RequestRecord_Request_Header struct { - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key"` + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value"` } type RequestRecord_Request_Params struct { } type RequestRecord_Response struct { - Status uint32 `protobuf:"varint,1,opt,name=status,proto3" json:"status,omitempty"` - ContentLength uint32 `protobuf:"varint,2,opt,name=content_length,json=contentLength,proto3" json:"content_length,omitempty"` - ContentType string `protobuf:"bytes,3,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"` + Status uint32 `protobuf:"varint,1,opt,name=status,proto3" json:"status"` + ContentLength uint32 `protobuf:"varint,2,opt,name=content_length,json=contentLength,proto3" json:"content_length"` + ContentType string `protobuf:"bytes,3,opt,name=content_type,json=contentType,proto3" json:"content_type"` } type RequestRecord_Observed struct { @@ -148,17 +147,17 @@ type RequestRecord_Observed struct { } type RequestRecord_Observed_Attack struct { - RuleName string `protobuf:"bytes,1,opt,name=rule_name,json=ruleName,proto3" json:"rule_name,omitempty"` - Test bool `protobuf:"varint,2,opt,name=test,proto3" json:"test,omitempty"` - Infos string `protobuf:"bytes,3,opt,name=infos,proto3" json:"infos,omitempty"` - Backtrace []string `protobuf:"bytes,4,rep,name=backtrace,proto3" json:"backtrace,omitempty"` + RuleName string `protobuf:"bytes,1,opt,name=rule_name,json=ruleName,proto3" json:"rule_name"` + Test bool `protobuf:"varint,2,opt,name=test,proto3" json:"test"` + Infos string `protobuf:"bytes,3,opt,name=infos,proto3" json:"infos"` + Backtrace []string `protobuf:"bytes,4,rep,name=backtrace,proto3" json:"backtrace"` Time time.Time `protobuf:"bytes,5,opt,name=time,proto3,stdtime" json:"time"` - Block bool `protobuf:"varint,6,opt,name=block,proto3" json:"block,omitempty"` + Block bool `protobuf:"varint,6,opt,name=block,proto3" json:"block"` } type RequestRecord_Observed_SDKEvent struct { Time time.Time `protobuf:"bytes,1,opt,name=time,proto3,stdtime" json:"time"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name"` Args RequestRecord_Observed_SDKEvent_Args `protobuf:"bytes,3,opt,name=args,proto3" json:"args"` } @@ -182,14 +181,8 @@ type RequestRecord_Observed_SDKEvent_Args_Identify_ struct { Identify *RequestRecord_Observed_SDKEvent_Args_Identify `protobuf:"bytes,2,opt,name=identify,proto3,oneof"` } -func (*RequestRecord_Observed_SDKEvent_Args_Track_) isRequestRecord_Observed_SDKEvent_Args_Args() {} -func (pb *RequestRecord_Observed_SDKEvent_Args_Track_) Fuzz(c fuzz.Continue) { - c.Fuzz(pb) -} +func (*RequestRecord_Observed_SDKEvent_Args_Track_) isRequestRecord_Observed_SDKEvent_Args_Args() {} func (*RequestRecord_Observed_SDKEvent_Args_Identify_) isRequestRecord_Observed_SDKEvent_Args_Args() {} -func (pb *RequestRecord_Observed_SDKEvent_Args_Identify_) Fuzz(c fuzz.Continue) { - c.Fuzz(pb) -} func (m *RequestRecord_Observed_SDKEvent_Args) GetArgs() isRequestRecord_Observed_SDKEvent_Args_Args { if m != nil { @@ -221,8 +214,8 @@ func (m *RequestRecord_Observed_SDKEvent_Args) GetIdentify() *RequestRecord_Obse // } // ] type RequestRecord_Observed_SDKEvent_Args_Track struct { - Event string `protobuf:"bytes,1,opt,name=event,proto3" json:"event,omitempty"` - Options *RequestRecord_Observed_SDKEvent_Args_Track_Options `protobuf:"bytes,2,opt,name=options,proto3" json:"options,omitempty"` + Event string `protobuf:"bytes,1,opt,name=event,proto3" json:"event"` + Options *RequestRecord_Observed_SDKEvent_Args_Track_Options `protobuf:"bytes,2,opt,name=options,proto3" json:"options"` } type RequestRecord_Observed_SDKEvent_Args_Track_Options struct { @@ -233,31 +226,31 @@ type RequestRecord_Observed_SDKEvent_Args_Track_Options struct { // Serialized into: // [ ] type RequestRecord_Observed_SDKEvent_Args_Identify struct { - UserIdentifiers *Struct `protobuf:"bytes,1,opt,name=user_identifiers,json=userIdentifiers,proto3,customtype=Struct" json:"user_identifiers,omitempty"` + UserIdentifiers *Struct `protobuf:"bytes,1,opt,name=user_identifiers,json=userIdentifiers,proto3,customtype=Struct" json:"user_identifiers"` } type RequestRecord_Observed_Exception struct { - Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` - Klass string `protobuf:"bytes,2,opt,name=klass,proto3" json:"klass,omitempty"` - RuleName string `protobuf:"bytes,3,opt,name=rule_name,json=ruleName,proto3" json:"rule_name,omitempty"` - Test bool `protobuf:"varint,4,opt,name=test,proto3" json:"test,omitempty"` - Infos string `protobuf:"bytes,5,opt,name=infos,proto3" json:"infos,omitempty"` - Backtrace []string `protobuf:"bytes,6,rep,name=backtrace,proto3" json:"backtrace,omitempty"` + Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message"` + Klass string `protobuf:"bytes,2,opt,name=klass,proto3" json:"klass"` + RuleName string `protobuf:"bytes,3,opt,name=rule_name,json=ruleName,proto3" json:"rule_name"` + Test bool `protobuf:"varint,4,opt,name=test,proto3" json:"test"` + Infos string `protobuf:"bytes,5,opt,name=infos,proto3" json:"infos"` + Backtrace []string `protobuf:"bytes,6,rep,name=backtrace,proto3" json:"backtrace"` Time time.Time `protobuf:"bytes,7,opt,name=time,proto3,stdtime" json:"time"` } type RequestRecord_Observed_Observation struct { - Category string `protobuf:"bytes,1,opt,name=category,proto3" json:"category,omitempty"` - Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` - Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` + Category string `protobuf:"bytes,1,opt,name=category,proto3" json:"category"` + Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key"` + Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value"` Time time.Time `protobuf:"bytes,4,opt,name=time,proto3,stdtime" json:"time"` } type RequestRecord_Observed_DataPoint struct { - RulespackId string `protobuf:"bytes,1,opt,name=rulespack_id,json=rulespackId,proto3" json:"rulespack_id,omitempty"` - RuleName string `protobuf:"bytes,2,opt,name=rule_name,json=ruleName,proto3" json:"rule_name,omitempty"` + RulespackId string `protobuf:"bytes,1,opt,name=rulespack_id,json=rulespackId,proto3" json:"rulespack_id"` + RuleName string `protobuf:"bytes,2,opt,name=rule_name,json=ruleName,proto3" json:"rule_name"` Time time.Time `protobuf:"bytes,3,opt,name=time,proto3,stdtime" json:"time"` - Infos string `protobuf:"bytes,4,opt,name=infos,proto3" json:"infos,omitempty"` + Infos string `protobuf:"bytes,4,opt,name=infos,proto3" json:"infos"` } type AppLoginRequestFace interface { From a309e36a9c760e2a9aeee24b25ff1bbf25b12db8 Mon Sep 17 00:00:00 2001 From: Julio Guerra Date: Tue, 19 Mar 2019 14:40:30 +0100 Subject: [PATCH 16/25] agent: fix empty request records with metrics or identify events Add simple logic to add and send the request record only when necessary, ie. only when there are some events other than a single identify. To do so, add a simple boolean value in the record to keep track of when the record should be sent of not. --- agent/internal/agent.go | 2 +- agent/internal/request.go | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/agent/internal/agent.go b/agent/internal/agent.go index 9b36c000..b1d7640a 100644 --- a/agent/internal/agent.go +++ b/agent/internal/agent.go @@ -258,7 +258,7 @@ func (m *eventManager) send(client *backend.Client, sessionID string) { m.req.Batch = m.req.Batch[0:0] } -func (a *Agent) addTrackEvent(r *httpRequestRecord) { +func (a *Agent) addRecord(r *httpRequestRecord) { if a.config.Disable() || a.eventMng == nil { // Disabled or not yet initialized agent return diff --git a/agent/internal/request.go b/agent/internal/request.go index 398fff5d..c864cf65 100644 --- a/agent/internal/request.go +++ b/agent/internal/request.go @@ -23,6 +23,7 @@ type HTTPRequestRecord struct { events []*HTTPRequestEvent identifyOnce sync.Once agent *Agent + shouldSend bool } func (a *Agent) newHTTPRequestRecord(req *http.Request) *HTTPRequestRecord { @@ -127,7 +128,7 @@ func (ctx *HTTPRequestRecord) Identify(id map[string]string) { timestamp: time.Now(), userIdentifiers: id, } - ctx.addEvent(evt) + ctx.addSilentEvent(evt) }) } @@ -165,13 +166,26 @@ func (ctx *HTTPRequestRecord) NewUserSignup(id map[string]string) { } func (ctx *HTTPRequestRecord) Close() { - ctx.agent.addTrackEvent(newHTTPRequestRecord(ctx)) + if !ctx.shouldSend { + return + } + + ctx.agent.addRecord(newHTTPRequestRecord(ctx)) +} + +func (ctx *HTTPRequestRecord) addSilentEvent(event *HTTPRequestEvent) { + ctx.addEvent_(event, true) } func (ctx *HTTPRequestRecord) addEvent(event *HTTPRequestEvent) { + ctx.addEvent_(event, false) +} + +func (ctx *HTTPRequestRecord) addEvent_(event *HTTPRequestEvent, silent bool) { ctx.eventsLock.Lock() defer ctx.eventsLock.Unlock() ctx.events = append(ctx.events, event) + ctx.shouldSend = !silent } func (ctx *HTTPRequestRecord) addUserEvent(event userEventFace) { From e5a0f57c5d3b7a92df9ea6b6cd3cb05516d909b0 Mon Sep 17 00:00:00 2001 From: Julio Guerra Date: Tue, 19 Mar 2019 15:34:16 +0100 Subject: [PATCH 17/25] agent/plog: fix early logs not showing up Early logs happening before the agent actual starting do not show up because the loggers are not yet enabled. Move the enabling in the agent initialization so that we can see early logs. --- agent/internal/agent.go | 5 ++-- agent/internal/plog/plog.go | 46 +++++++++++++++++++++++++++++-------- 2 files changed, 39 insertions(+), 12 deletions(-) diff --git a/agent/internal/agent.go b/agent/internal/agent.go index 9b36c000..0639a9d2 100644 --- a/agent/internal/agent.go +++ b/agent/internal/agent.go @@ -31,6 +31,8 @@ func New() *Agent { logger := plog.NewLogger("agent", nil) cfg := config.New(logger) + plog.SetLevelFromString(cfg.LogLevel()) + plog.SetOutput(os.Stderr) if cfg.Disable() { return nil @@ -70,9 +72,6 @@ func (a *Agent) start() { close(a.isDone) }() - plog.SetLevelFromString(a.config.LogLevel()) - plog.SetOutput(os.Stderr) - client, err := backend.NewClient(a.config.BackendHTTPAPIBaseURL(), a.config, a.logger) if checkErr(err, a.logger) { return diff --git a/agent/internal/plog/plog.go b/agent/internal/plog/plog.go index 491260d8..0950c65d 100644 --- a/agent/internal/plog/plog.go +++ b/agent/internal/plog/plog.go @@ -10,6 +10,7 @@ import ( "fmt" "io" "log" + "sync" ) // LogLevel represents the log level. Higher levels include lowers. @@ -114,7 +115,6 @@ type OutputSetter interface { // NewLogger returns a Logger instance wrapping one logger instance per level. // They can thus be individually enabled or disabled. func NewLogger(namespace string, parent *Logger) *Logger { - namespace = canonicalNamespace(namespace, parent) logger := &Logger{ PanicLogger: disabledLogger{}, ErrorLogger: disabledLogger{}, @@ -123,18 +123,19 @@ func NewLogger(namespace string, parent *Logger) *Logger { DebugLogger: disabledLogger{}, namespace: namespace, } - loggers[namespace] = logger - return logger -} -func canonicalNamespace(namespace string, parent *Logger) string { - var fullNS string if parent == nil { - fullNS = "sqreen/" + namespace + namespace = "sqreen/" + namespace } else { - fullNS = parent.namespace + "/" + namespace + namespace = parent.namespace + "/" + namespace + logger.SetLevel(parent.getLevel()) + logger.SetOutput(parent.output) } - return fullNS + + lock.Lock() + defer lock.Unlock() + loggers[namespace] = logger + return logger } // SetOutput sets the output of all loggers created so far. @@ -213,6 +214,32 @@ func (l *Logger) SetLevelFromString(level string) { l.SetLevel(lvl) } +// SetLevel changes the level of the logger to `level`, possibly disabling it +// when `Disabled` is passed. +func (l *Logger) getLevel() LogLevel { + if _, disabled := l.DebugLogger.(disabledLogger); !disabled { + return Debug + } + + if _, disabled := l.InfoLogger.(disabledLogger); !disabled { + return Info + } + + if _, disabled := l.WarnLogger.(disabledLogger); !disabled { + return Warn + } + + if _, disabled := l.ErrorLogger.(disabledLogger); !disabled { + return Error + } + + if _, disabled := l.PanicLogger.(disabledLogger); !disabled { + return Panic + } + + return Disabled +} + // SetLevel changes the level of the logger to `level`, possibly disabling it // when `Disabled` is passed. func (l *Logger) SetLevel(level LogLevel) { @@ -267,6 +294,7 @@ const flags = log.LUTC | log.Ldate | log.Lmicroseconds // Map of loggers. var loggers = make(map[string]*Logger) +var lock sync.Mutex // Enabled logger instance. type logger struct { From a43c15f49f4b6fe24bc873110d5fd58ba7e6afea Mon Sep 17 00:00:00 2001 From: Julio Guerra Date: Wed, 20 Mar 2019 16:58:33 +0100 Subject: [PATCH 18/25] agent: fix wrong IP address length checks The length of an IP address cannot be read using `len(ip)` because some `net` package functions return a 16-byte slice even for IPv4 addresses. The only way to safely check if an IP address is a v4 or v6 is to use `ip.To4()` which checks the internals and returns nil if it's not. --- agent/internal/config/config.go | 9 +- agent/internal/request.go | 22 ++++- agent/internal/request_test.go | 151 ++++++++++++++++++++++++++++++++ 3 files changed, 176 insertions(+), 6 deletions(-) create mode 100644 agent/internal/request_test.go diff --git a/agent/internal/config/config.go b/agent/internal/config/config.go index 9469711f..96a4743c 100644 --- a/agent/internal/config/config.go +++ b/agent/internal/config/config.go @@ -146,7 +146,7 @@ func ipnet(s string) *net.IPNet { // IP networks allowing to compute whether to var ( - IPPrivateNetworks = []*net.IPNet{ + IPv4PrivateNetworks = []*net.IPNet{ ipnet("0.0.0.0/8"), ipnet("10.0.0.0/8"), ipnet("127.0.0.0/8"), @@ -161,6 +161,11 @@ var ( ipnet("203.0.113.0/24"), ipnet("240.0.0.0/4"), ipnet("255.255.255.255/32"), + } + + IPv4PublicNetwork = ipnet("100.64.0.0/10") + + IPv6PrivateNetworks = []*net.IPNet{ ipnet("::1/128"), ipnet("::/128"), ipnet("::ffff:0:0/96"), @@ -172,8 +177,6 @@ var ( ipnet("fc00::/7"), ipnet("fe80::/10"), } - - IPv4PublicNetwork = ipnet("100.64.0.0/10") ) const ( diff --git a/agent/internal/request.go b/agent/internal/request.go index c864cf65..a0284348 100644 --- a/agent/internal/request.go +++ b/agent/internal/request.go @@ -279,7 +279,12 @@ func (r *httpRequestRecord) GetClientIp() string { return getClientIP(r.ctx.request, r.ctx.agent.config) } -func getClientIP(req *http.Request, cfg *config.Config) string { +type getClientIPConfigFace interface { + HTTPClientIPHeader() string + HTTPClientIPHeaderFormat() string +} + +func getClientIP(req *http.Request, cfg getClientIPConfigFace) string { var privateIP net.IP check := func(value string) net.IP { for _, ip := range strings.Split(value, ",") { @@ -404,14 +409,25 @@ func (r *httpRequestRecord) GetObserved() api.RequestRecord_Observed { } func isGlobal(ip net.IP) bool { - if len(ip) == 4 && config.IPv4PublicNetwork.Contains(ip) { + if ipv4 := ip.To4(); ipv4 != nil && config.IPv4PublicNetwork.Contains(ipv4) { return false } return !isPrivate(ip) } func isPrivate(ip net.IP) bool { - for _, network := range config.IPPrivateNetworks { + var privateNetworks []*net.IPNet + // We cannot rely on `len(ip)` to know what type of IP address this is. + // `net.ParseIP()` or `net.IPv4()` can return internal 16-byte representations + // of an IP address even if it is an IPv4. So the trick is to use `ip.To4()` + // which returns nil if the address in not an IPv4 address. + if ipv4 := ip.To4(); ipv4 != nil { + privateNetworks = config.IPv4PrivateNetworks + } else { + privateNetworks = config.IPv6PrivateNetworks + } + + for _, network := range privateNetworks { if network.Contains(ip) { return true } diff --git a/agent/internal/request_test.go b/agent/internal/request_test.go new file mode 100644 index 00000000..fe2f22dc --- /dev/null +++ b/agent/internal/request_test.go @@ -0,0 +1,151 @@ +package internal + +import ( + "crypto/rand" + "fmt" + "net" + "net/http" + "testing" + + fuzz "github.com/google/gofuzz" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" +) + +func TestParseClientIPHeaderHeaderValue(t *testing.T) { + // Tests with malformed values + // A buffer of random bytes. + var randBuf []byte + fuzz.New().NilChance(0).NumElements(1, 10000).Fuzz(&randBuf) + require.NotEmpty(t, randBuf) + // A random IPv4 value without the expected `:` separator + randIPv4 := fmt.Sprintf("%X", []byte(RandIPv4())) + + for _, tc := range []string{ + "", + string(randBuf), + string(randBuf) + ":", + randIPv4, + } { + tc := tc // new scope + t.Run("malformed", func(t *testing.T) { + _, err := parseClientIPHeaderHeaderValue("", tc) + require.Error(t, err) + }) + } +} + +func TestGetClientIP(t *testing.T) { + newRequest := func(remoteAddr string) *http.Request { + header := make(http.Header) + return &http.Request{ + RemoteAddr: remoteAddr, + Header: header, + } + } + + t.Run("Without prioritized header", func(t *testing.T) { + globalIP := RandGlobalIPv4() + require.True(t, isGlobal(globalIP)) + require.False(t, isPrivate(globalIP)) + + privateIP := RandPrivateIPv4() + require.False(t, isGlobal(privateIP)) + require.True(t, isPrivate(privateIP)) + + for _, tc := range []struct { + expected, remoteAddr string + extraHeaders map[string]string + }{ + // Only a private IP in remote address + {expected: privateIP.String(), remoteAddr: privateIP.String()}, + // Only a global IP in remote address + {expected: globalIP.String(), remoteAddr: globalIP.String()}, + // Global IP in XFF + { + expected: globalIP.String(), + remoteAddr: RandPrivateIPv4().String(), + extraHeaders: map[string]string{ + "X-Forwarded-For": globalIP.String() + "," + RandIPv4().String() + "," + RandIPv4().String(), + }, + }, + // Private IPs everywhere. + { + expected: privateIP.String(), + remoteAddr: RandPrivateIPv4().String(), + extraHeaders: map[string]string{ + "X-Forwarded-For": privateIP.String() + "," + RandPrivateIPv4().String() + "," + RandPrivateIPv4().String(), + }, + }, + // Private IPs everywhere but in the remote addr. + { + expected: globalIP.String(), + remoteAddr: globalIP.String(), + extraHeaders: map[string]string{ + "X-Forwarded-For": RandPrivateIPv4().String() + "," + RandPrivateIPv4().String() + "," + RandPrivateIPv4().String(), + }, + }, + // Globa IP in the middle of XFF and private IPs everywhere else. + { + expected: globalIP.String(), + remoteAddr: RandPrivateIPv4().String(), + extraHeaders: map[string]string{ + "X-Forwarded-For": RandPrivateIPv4().String() + "," + RandPrivateIPv4().String() + "," + globalIP.String() + "," + RandPrivateIPv4().String(), + }, + }, + } { + tc := tc + t.Run(tc.expected, func(t *testing.T) { + cfg := &GetClientIPConfigMockup{} + defer cfg.AssertExpectations(t) + cfg.On("HTTPClientIPHeader").Return("") + + req := newRequest(tc.remoteAddr) + for k, v := range tc.extraHeaders { + req.Header.Set(k, v) + } + + ip := getClientIP(req, cfg) + require.Equal(t, tc.expected, ip) + }) + } + }) +} + +func RandIPv4() net.IP { + ip := make([]byte, net.IPv4len) + rand.Read(ip) + return net.IP(ip) +} + +func RandGlobalIPv4() net.IP { + for { + ip := RandIPv4() + if isGlobal(ip) { + return ip + } + } +} + +func RandPrivateIPv4() net.IP { + for { + ip := RandIPv4() + if isPrivate(ip) { + return ip + } + } +} + +type GetClientIPConfigMockup struct { + mock.Mock +} + +func (m *GetClientIPConfigMockup) HTTPClientIPHeader() string { + ret := m.Called() + return ret.String(0) +} + +func (m *GetClientIPConfigMockup) HTTPClientIPHeaderFormat() string { + ret := m.Called() + return ret.String(0) +} From 3f8eaa5eb14b77c56edc2818477ac8f97c9c535f Mon Sep 17 00:00:00 2001 From: Julio Guerra Date: Wed, 20 Mar 2019 18:24:01 +0100 Subject: [PATCH 19/25] agent: add custom IP header parser to support HA Proxy Unique Request ID The HA Proxy header `X-Unique-Id` can be added using a user-configured format that may include the IP address. To be able to properly parse it, the agent needs to be given the format string that is used to generate the header value so that it can parse it back and find the IP address in it. The configuration should be: ``` ip_header: X-Unique-Id ip_header_format: ``` For now, `ip_header_format` value is only used as a boolean value to activate this behaviour, but with a hard-coded format: the client IP address first, in hexadecimal number, followed by a semicolon (port number separator). --- agent/internal/config/config.go | 25 +++++---- agent/internal/request.go | 42 ++++++++++++++- agent/internal/request_test.go | 91 +++++++++++++++++++++++++++++++++ go.mod | 1 + 4 files changed, 148 insertions(+), 11 deletions(-) diff --git a/agent/internal/config/config.go b/agent/internal/config/config.go index 96a4743c..6d6d4bd2 100644 --- a/agent/internal/config/config.go +++ b/agent/internal/config/config.go @@ -187,14 +187,15 @@ const ( const ( configEnvKeyConfigFile = `config_file` - configKeyBackendHTTPAPIBaseURL = `url` - configKeyBackendHTTPAPIToken = `token` - configKeyLogLevel = `log_level` - configKeyAppName = `app_name` - configKeyHTTPClientIPHeader = `ip_header` - configKeyBackendHTTPAPIProxy = `proxy` - configKeyDisable = `disable` - configKeyStripHTTPReferer = `strip_http_referer` + configKeyBackendHTTPAPIBaseURL = `url` + configKeyBackendHTTPAPIToken = `token` + configKeyLogLevel = `log_level` + configKeyAppName = `app_name` + configKeyHTTPClientIPHeader = `ip_header` + configKeyHTTPClientIPHeaderFormat = `ip_header_format` + configKeyBackendHTTPAPIProxy = `proxy` + configKeyDisable = `disable` + configKeyStripHTTPReferer = `strip_http_referer` ) // User configuration's default values. @@ -235,6 +236,7 @@ func New(logger *plog.Logger) *Config { manager.SetDefault(configKeyLogLevel, configDefaultLogLevel) manager.SetDefault(configKeyAppName, "") manager.SetDefault(configKeyHTTPClientIPHeader, "") + manager.SetDefault(configKeyHTTPClientIPHeaderFormat, "") manager.SetDefault(configKeyBackendHTTPAPIProxy, "") manager.SetDefault(configKeyDisable, "") manager.SetDefault(configKeyStripHTTPReferer, "") @@ -267,11 +269,16 @@ func (c *Config) AppName() string { return sanitizeString(c.GetString(configKeyAppName)) } -// HTTPClientIPHeader IPHeader returns the header to first lookup to find the client ip of a HTTP request. +// HTTPClientIPHeader returns the header to first lookup to find the client ip of a HTTP request. func (c *Config) HTTPClientIPHeader() string { return sanitizeString(c.GetString(configKeyHTTPClientIPHeader)) } +// HTTPClientIPHeaderFormat returns the header format of the `ip_header` value. +func (c *Config) HTTPClientIPHeaderFormat() string { + return sanitizeString(c.GetString(configKeyHTTPClientIPHeaderFormat)) +} + // Proxy returns the proxy configuration to use for backend HTTP calls. func (c *Config) BackendHTTPAPIProxy() string { return sanitizeString(c.GetString(configKeyBackendHTTPAPIProxy)) diff --git a/agent/internal/request.go b/agent/internal/request.go index a0284348..75487842 100644 --- a/agent/internal/request.go +++ b/agent/internal/request.go @@ -3,6 +3,7 @@ package internal import ( "encoding/hex" "encoding/json" + "fmt" "net" "net/http" "strings" @@ -10,6 +11,7 @@ import ( "time" "github.com/google/uuid" + "github.com/pkg/errors" "github.com/sqreen/go-agent/agent/internal/backend/api" "github.com/sqreen/go-agent/agent/internal/config" "github.com/sqreen/go-agent/agent/types" @@ -307,8 +309,21 @@ func getClientIP(req *http.Request, cfg getClientIPConfigFace) string { if prioritizedHeader := cfg.HTTPClientIPHeader(); prioritizedHeader != "" { if value := req.Header.Get(prioritizedHeader); value != "" { - if ip := check(value); ip != nil { - return ip.String() + if fmt := cfg.HTTPClientIPHeaderFormat(); fmt != "" { + parsed, err := parseClientIPHeaderHeaderValue(fmt, value) + if err == nil { + // Parsing ok, keep its returned value. + value = parsed + } else { + // An error occured while parsing the header value, so ignore it. + value = "" + } + } + + if value != "" { + if ip := check(value); ip != nil { + return ip.String() + } } } } @@ -334,6 +349,29 @@ func getClientIP(req *http.Request, cfg getClientIPConfigFace) string { return privateIP.String() } +func parseClientIPHeaderHeaderValue(format, value string) (string, error) { + sep := strings.IndexRune(value, ':') + if sep == -1 { + return "", errors.Errorf("unexpected IP address value `%s`", value) + } + + clientIPHexStr := value[:sep] + // Optimize for the best case: there will be an IP address, so allocate size + // for at least an IPv4 address. + clientIPBuf := make([]byte, 0, net.IPv4len) + _, err := fmt.Sscanf(clientIPHexStr, "%x", &clientIPBuf) + if err != nil { + return "", errors.Wrap(err, "could not parse the IP address value") + } + + switch len(clientIPBuf) { + case net.IPv4len, net.IPv6len: + return net.IP(clientIPBuf).String(), nil + default: + return "", errors.Errorf("unexpected IP address value `%s`", clientIPBuf) + } +} + func (r *httpRequestRecord) GetRequest() api.RequestRecord_Request { req := r.ctx.request diff --git a/agent/internal/request_test.go b/agent/internal/request_test.go index fe2f22dc..ec9d0875 100644 --- a/agent/internal/request_test.go +++ b/agent/internal/request_test.go @@ -110,6 +110,85 @@ func TestGetClientIP(t *testing.T) { }) } }) + + t.Run("Custom IP header format", func(t *testing.T) { + t.Run("HA Proxy X-Unique-Id", func(t *testing.T) { + uniqueIDGlobalIP, uniqueID := RandHAProxyUniqueID() + require.True(t, isGlobal(uniqueIDGlobalIP)) + require.False(t, isPrivate(uniqueIDGlobalIP)) + + globalIP := RandGlobalIPv4() + require.True(t, isGlobal(globalIP)) + require.False(t, isPrivate(globalIP)) + + privateIP := RandPrivateIPv4() + require.False(t, isGlobal(privateIP)) + require.True(t, isPrivate(privateIP)) + + for _, tc := range []struct { + expected, remoteAddr, uniqueID string + extraHeaders map[string]string + }{ + // Empty X-Unique-Id value + {expected: "127.0.0.1", remoteAddr: "127.0.0.1", uniqueID: ""}, + // Global IP in X-Unique-Id + {expected: uniqueIDGlobalIP.String(), remoteAddr: "127.0.0.1", uniqueID: uniqueID}, + // Global IP in X-Unique-Id and XFF, but X-Unique-Id is prioritized by the config + { + expected: uniqueIDGlobalIP.String(), + remoteAddr: "127.0.0.1", + uniqueID: uniqueID, + extraHeaders: map[string]string{ + "X-Forwarded-For": globalIP.String() + "," + RandIPv4().String() + "," + RandIPv4().String(), + }, + }, + // Private IP in X-Unique-Id which is is prioritized by the config but XFF has a global IP + { + expected: globalIP.String(), + remoteAddr: "127.0.0.1", + uniqueID: HAProxyUniqueID(privateIP), + extraHeaders: map[string]string{ + "X-Forwarded-For": globalIP.String() + "," + RandIPv4().String() + "," + RandIPv4().String(), + }, + }, + // Private IPs everywhere. + { + expected: privateIP.String(), + remoteAddr: RandPrivateIPv4().String(), + uniqueID: HAProxyUniqueID(privateIP), + extraHeaders: map[string]string{ + "X-Forwarded-For": RandPrivateIPv4().String() + "," + RandPrivateIPv4().String() + "," + RandPrivateIPv4().String(), + }, + }, + // Private IPs everywhere but in the remote addr. + { + expected: globalIP.String(), + remoteAddr: globalIP.String(), + uniqueID: HAProxyUniqueID(privateIP), + extraHeaders: map[string]string{ + "X-Forwarded-For": RandPrivateIPv4().String() + "," + RandPrivateIPv4().String() + "," + RandPrivateIPv4().String(), + }, + }, + } { + tc := tc + t.Run(tc.expected, func(t *testing.T) { + cfg := &GetClientIPConfigMockup{} + defer cfg.AssertExpectations(t) + cfg.On("HTTPClientIPHeader").Return("x-uNiQue-iD") // check it works even with a random case + cfg.On("HTTPClientIPHeaderFormat").Return("it just needs to be set for now").Maybe() // depends on the testcase + + req := newRequest(tc.remoteAddr) + req.Header.Set("X-Unique-Id", tc.uniqueID) + for k, v := range tc.extraHeaders { + req.Header.Set(k, v) + } + + ip := getClientIP(req, cfg) + require.Equal(t, tc.expected, ip) + }) + } + }) + }) } func RandIPv4() net.IP { @@ -136,6 +215,18 @@ func RandPrivateIPv4() net.IP { } } +func RandHAProxyUniqueID() (net.IP, string) { + ip := RandGlobalIPv4() + return ip, HAProxyUniqueID(ip) +} + +func HAProxyUniqueID(ip net.IP) string { + var randStr string + fuzz.New().NilChance(0).Fuzz(&randStr) + value := fmt.Sprintf("%X:%s", []byte(ip.To4()), randStr) + return value +} + type GetClientIPConfigMockup struct { mock.Mock } diff --git a/go.mod b/go.mod index edd0adb6..01ce29dd 100644 --- a/go.mod +++ b/go.mod @@ -16,6 +16,7 @@ require ( github.com/modern-go/reflect2 v1.0.1 // indirect github.com/onsi/ginkgo v1.7.0 github.com/onsi/gomega v1.4.3 + github.com/pkg/errors v0.8.1 github.com/spf13/viper v1.3.1 github.com/stretchr/objx v0.1.1 // indirect github.com/stretchr/testify v1.3.0 From 288f1365be510cbaea203228926f9ab5a68147f3 Mon Sep 17 00:00:00 2001 From: Julio Guerra Date: Wed, 20 Mar 2019 18:35:45 +0100 Subject: [PATCH 20/25] agent: remove the User-Agent stored twice in the request record The User-Agent is already included in the request record, so remove it from the list of tracked headers to avoid sending it twice in the same request record. --- agent/internal/config/config.go | 1 - 1 file changed, 1 deletion(-) diff --git a/agent/internal/config/config.go b/agent/internal/config/config.go index 96a4743c..af774ca5 100644 --- a/agent/internal/config/config.go +++ b/agent/internal/config/config.go @@ -102,7 +102,6 @@ var ( "Forwarded-For", "Forwarded", "Via", - "User-Agent", "Content-Type", "Content-Length", "Host", From 2f1ad93203c00ce8e6b63ecab952cad2a1dd81e6 Mon Sep 17 00:00:00 2001 From: Julio Guerra Date: Thu, 21 Mar 2019 10:05:12 +0100 Subject: [PATCH 21/25] agent: comment that the ip format configuration is hard-coded --- agent/internal/request.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/agent/internal/request.go b/agent/internal/request.go index 75487842..18cb462f 100644 --- a/agent/internal/request.go +++ b/agent/internal/request.go @@ -350,6 +350,9 @@ func getClientIP(req *http.Request, cfg getClientIPConfigFace) string { } func parseClientIPHeaderHeaderValue(format, value string) (string, error) { + // Hard-coded HA Proxy format for now: `%ci:%cp...` so we expect the value to + // start with the client IP in hexadecimal format (eg. 7F000001) separated by + // the client port number with a semicolon `:`. sep := strings.IndexRune(value, ':') if sep == -1 { return "", errors.Errorf("unexpected IP address value `%s`", value) From 9d54893e7644e2170d67eda19a8ef897024c083c Mon Sep 17 00:00:00 2001 From: Julio Guerra Date: Thu, 21 Mar 2019 23:59:56 +0100 Subject: [PATCH 22/25] agent: fix a false failing test --- agent/internal/request_test.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/agent/internal/request_test.go b/agent/internal/request_test.go index ec9d0875..d70a31c3 100644 --- a/agent/internal/request_test.go +++ b/agent/internal/request_test.go @@ -1,8 +1,8 @@ package internal import ( - "crypto/rand" "fmt" + "math/rand" "net" "net/http" "testing" @@ -53,7 +53,7 @@ func TestGetClientIP(t *testing.T) { require.False(t, isGlobal(privateIP)) require.True(t, isPrivate(privateIP)) - for _, tc := range []struct { + for i, tc := range []struct { expected, remoteAddr string extraHeaders map[string]string }{ @@ -85,7 +85,7 @@ func TestGetClientIP(t *testing.T) { "X-Forwarded-For": RandPrivateIPv4().String() + "," + RandPrivateIPv4().String() + "," + RandPrivateIPv4().String(), }, }, - // Globa IP in the middle of XFF and private IPs everywhere else. + // Global IP in the middle of XFF and private IPs everywhere else. { expected: globalIP.String(), remoteAddr: RandPrivateIPv4().String(), @@ -96,6 +96,7 @@ func TestGetClientIP(t *testing.T) { } { tc := tc t.Run(tc.expected, func(t *testing.T) { + t.Logf("%d %+v", i, tc) cfg := &GetClientIPConfigMockup{} defer cfg.AssertExpectations(t) cfg.On("HTTPClientIPHeader").Return("") @@ -125,7 +126,7 @@ func TestGetClientIP(t *testing.T) { require.False(t, isGlobal(privateIP)) require.True(t, isPrivate(privateIP)) - for _, tc := range []struct { + for i, tc := range []struct { expected, remoteAddr, uniqueID string extraHeaders map[string]string }{ @@ -172,6 +173,7 @@ func TestGetClientIP(t *testing.T) { } { tc := tc t.Run(tc.expected, func(t *testing.T) { + t.Logf("%d %+v", i, tc) cfg := &GetClientIPConfigMockup{} defer cfg.AssertExpectations(t) cfg.On("HTTPClientIPHeader").Return("x-uNiQue-iD") // check it works even with a random case @@ -192,15 +194,13 @@ func TestGetClientIP(t *testing.T) { } func RandIPv4() net.IP { - ip := make([]byte, net.IPv4len) - rand.Read(ip) - return net.IP(ip) + return net.IPv4(uint8(rand.Uint32()), uint8(rand.Uint32()), uint8(rand.Uint32()), uint8(rand.Uint32())) } func RandGlobalIPv4() net.IP { for { ip := RandIPv4() - if isGlobal(ip) { + if isGlobal(ip) && !isPrivate(ip) { return ip } } @@ -209,7 +209,7 @@ func RandGlobalIPv4() net.IP { func RandPrivateIPv4() net.IP { for { ip := RandIPv4() - if isPrivate(ip) { + if !isGlobal(ip) && isPrivate(ip) { return ip } } From 6c019aa7e91003703a456eaf425de3896f3aa367 Mon Sep 17 00:00:00 2001 From: Julio Guerra Date: Fri, 22 Mar 2019 00:00:59 +0100 Subject: [PATCH 23/25] repo: update the changelog --- CHANGELOG.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index af5fd1b1..0a385313 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,40 @@ +# v0.1.0-beta.3 + +## New Features + +- Get the client IP address out of the HAProxy header `X-Unique-Id` using the + new configuration variable `ip_header_format`. (#41) + +- New configuration option `strip_http_referer`/`SQREEN_STRIP_HTTP_REFERER` + allowing to avoid sending the `Referer` HTTP header to the Sqreen backend when + it contains sensitive data. (#36) + +- Ability to disable/enable the agent through the [dashboard + settings](https://my.sqreen.com/application/goto/settings/global) using the + Sqreen status button. (#29) + +## Breaking Changes + +- Agent internals are now under a private Go package and can no longer be + imported. Any sub-package under `github.com/sqreen/go-agent/agent` was not + supposed to be imported and is now private to avoid future confusions. (#27) + +## Fixes + +- Remove duplicate `User-Agent` entry sent twice in the request record. (#42) + +- Fix IPv4 and IPv6 matching against private network definitions. (#38) + +- Remove useless empty request records mistakenly created while not carrying + any SDK observation. (#38) + +## Minor Changes + +- Better memory management and footprint when the agent is disabled by removing + globals. This will be also required to be able to cleanly restart the agent by + self-managing the initializations. (#28) + + # v0.1.0-beta.2 ## New feature From f5e5d86854b6f5851a1f9ae68db557da6acc8eca Mon Sep 17 00:00:00 2001 From: Julio Guerra Date: Fri, 22 Mar 2019 00:09:33 +0100 Subject: [PATCH 24/25] go: add go.sum file --- go.sum | 104 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 go.sum diff --git a/go.sum b/go.sum new file mode 100644 index 00000000..e0e5e9c0 --- /dev/null +++ b/go.sum @@ -0,0 +1,104 @@ +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7 h1:AzN37oI0cOS+cougNAV9szl6CVoj2RYwzS3DpUQNtlY= +github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= +github.com/gin-gonic/gin v1.3.0 h1:kCmZyPklC0gVdL728E6Aj20uYBJV93nj/TkwBTKhFbs= +github.com/gin-gonic/gin v1.3.0/go.mod h1:7cKuhb5qV2ggCFctp2fJQ+ErvciLZrIeoOSOm6mUr7Y= +github.com/gogo/protobuf v1.2.0 h1:xU6/SpYbvkNYiptHJYEDRseDLvYE7wSqhYYNy0QSUzI= +github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf h1:+RRA9JqSOZFfKrOeqr2z77+8R2RKyh8PG66dcu1V0ck= +github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= +github.com/google/uuid v1.1.0 h1:Jf4mxPC/ziBnoPIdpQdPJ9OeiomAUHLvxmPRSPH9m4s= +github.com/google/uuid v1.1.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/json-iterator/go v1.1.5 h1:gL2yXlmiIo4+t+y32d4WGwOjKGYcGOuyrg46vadswDE= +github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/labstack/echo v3.3.10+incompatible h1:pGRcYk231ExFAyoAjAfD85kQzRJCRI8bbnE7CX5OEgg= +github.com/labstack/echo v3.3.10+incompatible/go.mod h1:0INS7j/VjnFxD4E2wkz67b8cVwCLbBmJyDaka6Cmk1s= +github.com/labstack/gommon v0.2.8 h1:JvRqmeZcfrHC5u6uVleB4NxxNbzx6gpbJiQknDbKQu0= +github.com/labstack/gommon v0.2.8/go.mod h1:/tj9csK2iPSBvn+3NLM9e52usepMtrd5ilFYA+wQNJ4= +github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs= +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= +github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/viper v1.3.1 h1:5+8j8FTpnFV4nEImW/ofkzEt8VoOiLXxdYIDsB73T38= +github.com/spf13/viper v1.3.1/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8 h1:3SVOIvH7Ae1KRYyQWRjXWJEA9sS/c/pjvH++55Gr648= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= +github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= +github.com/valyala/fasttemplate v0.0.0-20170224212429-dcecefd839c4 h1:gKMu1Bf6QINDnvyZuTaACm9ofY+PRh+5vFz4oxBZeF8= +github.com/valyala/fasttemplate v0.0.0-20170224212429-dcecefd839c4/go.mod h1:50wTf68f99/Zt14pr046Tgt3Lp2vLyFZKzbFXTOabXw= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9 h1:mKdxBk7AujPs8kU4m80U72y/zjbZ3UcXC7dClwKbUI0= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3 h1:eH6Eip3UpmR+yM/qI9Ijluzb1bNv/cAU/n+6l8tRSis= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a h1:1n5lsVfiQW3yfsRGu98756EH1YthsFqr/5mxHduZW2A= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM= +gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= +gopkg.in/go-playground/validator.v8 v8.18.2 h1:lFB4DoMU6B626w8ny76MV7VX6W2VHct2GVOI3xgiMrQ= +gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= From 834d25ebba6942bff7693bcf531a7be6bebc736e Mon Sep 17 00:00:00 2001 From: Julio Guerra Date: Fri, 22 Mar 2019 00:49:34 +0100 Subject: [PATCH 25/25] agent: update version number --- agent/internal/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agent/internal/version.go b/agent/internal/version.go index 5c99ceb8..2a53bc91 100644 --- a/agent/internal/version.go +++ b/agent/internal/version.go @@ -1,3 +1,3 @@ package internal -const version = "0.1.0-beta.2" +const version = "0.1.0-beta.3"