From 4fb62df4a2f60669ae85d4a6917a2d63b86cebe3 Mon Sep 17 00:00:00 2001 From: Tarun Koyalwar Date: Wed, 20 Nov 2024 17:45:19 +0530 Subject: [PATCH] use expand with env --- internal/runner/lazy.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/internal/runner/lazy.go b/internal/runner/lazy.go index ba9f8ae678..5ce6743f0e 100644 --- a/internal/runner/lazy.go +++ b/internal/runner/lazy.go @@ -3,7 +3,6 @@ package runner import ( "context" "fmt" - "os" "strings" "github.com/projectdiscovery/nuclei/v3/pkg/authprovider/authx" @@ -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" ) @@ -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)