Skip to content

Commit

Permalink
use expand with env
Browse files Browse the repository at this point in the history
  • Loading branch information
tarunKoyalwar authored and alban-stourbe-wmx committed Nov 21, 2024
1 parent 6f83d45 commit 4fb62df
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions internal/runner/lazy.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package runner
import (
"context"
"fmt"
"os"
"strings"

"github.com/projectdiscovery/nuclei/v3/pkg/authprovider/authx"
Expand All @@ -16,6 +15,7 @@ import (
"github.com/projectdiscovery/nuclei/v3/pkg/protocols/common/helpers/writer"
"github.com/projectdiscovery/nuclei/v3/pkg/scan"
"github.com/projectdiscovery/nuclei/v3/pkg/types"
"github.com/projectdiscovery/utils/env"
errorutil "github.com/projectdiscovery/utils/errors"
)

Expand Down Expand Up @@ -88,11 +88,7 @@ func GetLazyAuthFetchCallback(opts *AuthLazyFetchOptions) authx.LazyFetchSecret
for _, v := range d.Variables {
// Check if the template has any env variables and expand them
if strings.HasPrefix(v.Value, "$") {
env := strings.TrimPrefix(v.Value, "$")
retrievedEnv := os.Getenv(env)
if retrievedEnv != "" {
v.Value = os.Getenv(env)
}
env.ExpandWithEnv(&v.Value)
}
if val, ok := cliVars[v.Key]; ok && val != "" {
v.Value = types.ToString(val)
Expand Down

0 comments on commit 4fb62df

Please sign in to comment.