From bf1e14fe15af995355d91d658c085a315e139e24 Mon Sep 17 00:00:00 2001 From: Valery Piashchynski Date: Wed, 9 Jun 2021 10:49:29 +0300 Subject: - Update regex Signed-off-by: Valery Piashchynski --- plugins/server/command.go | 2 +- plugins/server/command_test.go | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/server/command.go b/plugins/server/command.go index a3752e7b..e0b61896 100644 --- a/plugins/server/command.go +++ b/plugins/server/command.go @@ -8,7 +8,7 @@ import ( ) // pattern for the path finding -const pattern string = `^\/*([A-z0-9/.:-]+\.(php|sh|ph))$` +const pattern string = `^\/*([A-z/.:-]+\.(php|sh|ph))$` func (server *Plugin) scanCommand(cmd []string) error { const op = errors.Op("server_command_scan") diff --git a/plugins/server/command_test.go b/plugins/server/command_test.go index d226ae9c..74762ccd 100644 --- a/plugins/server/command_test.go +++ b/plugins/server/command_test.go @@ -33,4 +33,11 @@ func TestServerCommandChecker(t *testing.T) { if !errors.Is(errors.FileNotFound, err) { t.Fatal("should be of filenotfound type") } + + cmd6 := "php 0/../../tests/cluent.php --option1 --option2" + err = s.scanCommand(strings.Split(cmd6, " ")) + assert.Error(t, err) + if errors.Is(errors.FileNotFound, err) { + t.Fatal("should be of filenotfound type") + } } -- cgit v1.2.3