Allow blank tags with severity

dev
Ice3man543 2021-03-14 00:53:55 +05:30
parent d8bb580618
commit 000e3a305e
2 changed files with 6 additions and 1 deletions

View File

@ -48,7 +48,7 @@ func Parse(filePath string, options protocols.ExecuterOptions) (*Template, error
if len(options.Options.Tags) > 0 {
templateTags, ok := template.Info["tags"]
if !ok {
return nil, nil
templateTags = ""
}
if err := matchTemplateWithTags(types.ToString(templateTags), types.ToString(template.Info["severity"]), options.Options); err != nil {
return nil, nil

View File

@ -34,4 +34,9 @@ func TestMatchTemplateWithTags(t *testing.T) {
err = matchTemplateWithTags("lang:php,os:linux,cms:symfony", "low", &types.Options{Tags: []string{"low"}})
require.Nil(t, err, "could get key value tag for severity")
})
t.Run("blank-tags", func(t *testing.T) {
err = matchTemplateWithTags("", "low", &types.Options{Tags: []string{"jira"}})
require.NotNil(t, err, "could get value tag for blank severity")
})
}