Skip to content

Commit

Permalink
fix nuclei loading ignored templates (#4849)
Browse files Browse the repository at this point in the history
* fix tag include logic

* fix unit test

* remove quoting in extractor output

* remove quote in debug code command
  • Loading branch information
tarunKoyalwar committed Mar 10, 2024
1 parent a3a00d2 commit 1d56767
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion pkg/catalog/loader/filter/tag_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,8 @@ func New(config *Config) (*TagFilter, error) {
if _, ok := filter.allowedTags[val]; !ok {
filter.allowedTags[val] = struct{}{}
}
delete(filter.block, val)
// Note: only tags specified in IncludeTags should be removed from the block list
// not normal tags like config.Tags
}
}
for _, tag := range config.IncludeTags {
Expand Down
2 changes: 1 addition & 1 deletion pkg/catalog/loader/filter/tag_filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func TestTagBasedFilter(t *testing.T) {
})
t.Run("match-includes", func(t *testing.T) {
filter, err := New(&Config{
Tags: []string{"fuzz"},
IncludeTags: []string{"fuzz"},
ExcludeTags: []string{"fuzz"},
})
require.Nil(t, err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/output/format_screen.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (w *StandardWriter) formatScreen(output *ResultEvent) []byte {
for i, item := range output.ExtractedResults {
// trim trailing space
item = strings.TrimSpace(item)
item = strconv.QuoteToASCII(item)
item = strings.ReplaceAll(item, "\n", "\\n") // only replace newlines
builder.WriteString(w.aurora.BrightCyan(item).String())

if i != len(output.ExtractedResults)-1 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/protocols/code/code.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ func interpretEnvVars(source string, vars map[string]interface{}) string {
// bash mode
if strings.Contains(source, "$") {
for k, v := range vars {
source = strings.ReplaceAll(source, "$"+k, fmt.Sprintf("'%s'", v))
source = strings.ReplaceAll(source, "$"+k, fmt.Sprintf("%s", v))
}
}
// python mode
Expand Down

0 comments on commit 1d56767

Please sign in to comment.