mirror of https://github.com/daffainfo/nuclei.git
Allow blank tags with severity
parent
d8bb580618
commit
000e3a305e
|
@ -48,7 +48,7 @@ func Parse(filePath string, options protocols.ExecuterOptions) (*Template, error
|
||||||
if len(options.Options.Tags) > 0 {
|
if len(options.Options.Tags) > 0 {
|
||||||
templateTags, ok := template.Info["tags"]
|
templateTags, ok := template.Info["tags"]
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, nil
|
templateTags = ""
|
||||||
}
|
}
|
||||||
if err := matchTemplateWithTags(types.ToString(templateTags), types.ToString(template.Info["severity"]), options.Options); err != nil {
|
if err := matchTemplateWithTags(types.ToString(templateTags), types.ToString(template.Info["severity"]), options.Options); err != nil {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
|
|
@ -34,4 +34,9 @@ func TestMatchTemplateWithTags(t *testing.T) {
|
||||||
err = matchTemplateWithTags("lang:php,os:linux,cms:symfony", "low", &types.Options{Tags: []string{"low"}})
|
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")
|
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")
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue