mirror of
https://github.com/projectdiscovery/nuclei
synced 2026-06-08 16:50:47 +00:00
9caa62ebd5
This commit fixes a race condition where templates start executing before the secret file's login flow completes when using -secret-file flag. Changes: - pkg/authprovider/authx/dynamic.go: Replace atomic.Bool-based synchronization with sync.Once to ensure fetch callback runs exactly once and all concurrent callers block until completion. This prevents the race where multiple goroutines would see fetching=true and return early with nil error before secrets were ready. - internal/runner/runner.go: Always prefetch secrets when AuthProvider exists, removing the PreFetchSecrets flag check. This ensures authentication completes before scanning starts regardless of flag settings. - lib/sdk_private.go: Same change as runner.go for SDK mode consistency. - pkg/authprovider/file_test.go: Add test for concurrent dynamic secret access to verify fetch happens exactly once and all workers get authenticated. - pkg/authprovider/authx/dynamic_test.go: Add concurrent fetch tests to verify proper synchronization behavior. Fixes #6592 Co-authored-by: Mzack9999 <mzack9999@protonmail.com>