Skip to content

Commit 01c62c6

Browse files
tarunKoyalwaralban-stourbe-wmx
authored andcommitted
fix missing replacer
1 parent 4fb62df commit 01c62c6

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

internal/runner/lazy.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"github.com/projectdiscovery/nuclei/v3/pkg/protocols/common/contextargs"
1414
"github.com/projectdiscovery/nuclei/v3/pkg/protocols/common/generators"
1515
"github.com/projectdiscovery/nuclei/v3/pkg/protocols/common/helpers/writer"
16+
"github.com/projectdiscovery/nuclei/v3/pkg/protocols/common/replacer"
1617
"github.com/projectdiscovery/nuclei/v3/pkg/scan"
1718
"github.com/projectdiscovery/nuclei/v3/pkg/types"
1819
"github.com/projectdiscovery/utils/env"
@@ -90,8 +91,12 @@ func GetLazyAuthFetchCallback(opts *AuthLazyFetchOptions) authx.LazyFetchSecret
9091
if strings.HasPrefix(v.Value, "$") {
9192
env.ExpandWithEnv(&v.Value)
9293
}
93-
if val, ok := cliVars[v.Key]; ok && val != "" {
94-
v.Value = types.ToString(val)
94+
if strings.Contains(v.Value, "{{") {
95+
// if variables had value like {{username}}, then replace it with the value from cliVars
96+
// variables:
97+
// - key: username
98+
// value: {{username}}
99+
v.Value = replacer.Replace(v.Value, cliVars)
95100
}
96101
vars[v.Key] = v.Value
97102
ctx.Input.Add(v.Key, v.Value)

0 commit comments

Comments
 (0)