mirror of https://github.com/daffainfo/nuclei.git
Merge pull request #867 from projectdiscovery/fix-filter-exclude-issue
Fixed filter exclude issuedev
commit
25be233e34
|
@ -29,10 +29,9 @@ func (t *TagFilter) Match(tag, author, severity string) (bool, error) {
|
|||
matchedAny := false
|
||||
if len(t.allowedTags) > 0 {
|
||||
_, ok := t.allowedTags[tag]
|
||||
if !ok {
|
||||
return false, nil
|
||||
if ok {
|
||||
matchedAny = true
|
||||
}
|
||||
matchedAny = true
|
||||
}
|
||||
_, ok := t.block[tag]
|
||||
if ok {
|
||||
|
@ -76,10 +75,9 @@ func (t *TagFilter) MatchWithAllowedTags(allowed []string, tag, author, severity
|
|||
}
|
||||
if len(allowedMap) > 0 {
|
||||
_, ok := allowedMap[tag]
|
||||
if !ok {
|
||||
return false, nil
|
||||
if ok {
|
||||
matchedAny = true
|
||||
}
|
||||
matchedAny = true
|
||||
}
|
||||
_, ok := t.block[tag]
|
||||
if ok && !matchedAny {
|
||||
|
|
|
@ -40,16 +40,6 @@ func TestTagBasedFilter(t *testing.T) {
|
|||
require.Nil(t, err, "could not get match")
|
||||
require.True(t, matched, "could not get correct match")
|
||||
})
|
||||
t.Run("match-includes", func(t *testing.T) {
|
||||
config := &Config{
|
||||
Tags: []string{"fuzz"},
|
||||
ExcludeTags: []string{"fuzz"},
|
||||
}
|
||||
filter := New(config)
|
||||
matched, err := filter.Match("fuzz", "pdteam", "low")
|
||||
require.Nil(t, err, "could not get match")
|
||||
require.True(t, matched, "could not get correct match")
|
||||
})
|
||||
t.Run("match-author", func(t *testing.T) {
|
||||
config := &Config{
|
||||
Authors: []string{"pdteam"},
|
||||
|
@ -66,6 +56,15 @@ func TestTagBasedFilter(t *testing.T) {
|
|||
matched, _ := filter.Match("fuzz", "pdteam", "high")
|
||||
require.True(t, matched, "could not get correct match")
|
||||
})
|
||||
t.Run("match-exclude-with-tags", func(t *testing.T) {
|
||||
config := &Config{
|
||||
Tags: []string{"tag"},
|
||||
ExcludeTags: []string{"another"},
|
||||
}
|
||||
filter := New(config)
|
||||
matched, _ := filter.Match("another", "pdteam", "high")
|
||||
require.False(t, matched, "could not get correct match")
|
||||
})
|
||||
t.Run("match-conditions", func(t *testing.T) {
|
||||
config := &Config{
|
||||
Authors: []string{"pdteam"},
|
||||
|
|
Loading…
Reference in New Issue