From d2a7b9a334ce1d5824fce8549338a205c5d6c927 Mon Sep 17 00:00:00 2001 From: Sanja Kosier Date: Wed, 27 Mar 2024 12:53:02 +0100 Subject: [PATCH 1/2] fix(plugins/github): add length check in if statement Signed-off-by: Sanja Kosier --- plugins/github/pkg/github/extract.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/github/pkg/github/extract.go b/plugins/github/pkg/github/extract.go index b0e23d3f..785fb8e3 100644 --- a/plugins/github/pkg/github/extract.go +++ b/plugins/github/pkg/github/extract.go @@ -72,7 +72,7 @@ func getMatchField(jdata *fastjson.Value, matchField string, fType string) (bool res += "," } - if res[len(res)-1] == ',' { + if len(res) != 0 && res[len(res)-1] == ',' { res = res[0 : len(res)-1] } } @@ -97,7 +97,7 @@ func getMinerTypes(jdata *fastjson.Value) (bool, string) { res += fmt.Sprintf("%s", t) res += "," } - if res[len(res)-1] == ',' { + if len(res) != 0 && res[len(res)-1] == ',' { res = res[0 : len(res)-1] } @@ -146,7 +146,7 @@ func getfieldStr(jdata *fastjson.Value, field string) (bool, string) { res += string(fname.GetStringBytes()) res += "," } - if res[len(res)-1] == ',' { + if len(res) != 0 && res[len(res)-1] == ',' { res = res[0 : len(res)-1] } } @@ -188,7 +188,7 @@ func getfieldStr(jdata *fastjson.Value, field string) (bool, string) { cinfo.GetUint64("line")) res += "," } - if res[len(res)-1] == ',' { + if len(res) != 0 && res[len(res)-1] == ',' { res = res[0 : len(res)-1] } } From 6e2928fefac697394d62bcfa958f3923db599fd4 Mon Sep 17 00:00:00 2001 From: Sanja Kosier Date: Wed, 27 Mar 2024 14:33:48 +0100 Subject: [PATCH 2/2] bump plugin version Signed-off-by: Sanja Kosier --- plugins/github/CHANGELOG.md | 5 +++++ plugins/github/pkg/github/github.go | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/github/CHANGELOG.md b/plugins/github/CHANGELOG.md index 739a387c..3a6a24d4 100644 --- a/plugins/github/CHANGELOG.md +++ b/plugins/github/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## v0.7.1 + +* [`d2a7b9a`](https://github.com/falcosecurity/plugins/pull/439/commits/d2a7b9a) fix(plugins/github): add length check in if statement + + ## v0.6.1 diff --git a/plugins/github/pkg/github/github.go b/plugins/github/pkg/github/github.go index 2b1f0ebb..6ee23eca 100644 --- a/plugins/github/pkg/github/github.go +++ b/plugins/github/pkg/github/github.go @@ -39,7 +39,7 @@ const ( PluginName = "github" PluginDescription = "Reads github webhook events, by listening on a socket or by reading events from disk" PluginContact = "github.com/falcosecurity/plugins" - PluginVersion = "0.7.0" + PluginVersion = "0.7.1" PluginEventSource = "github" ExtractEventSource = "github" )