Skip to content

Using clone options for auth store - #6572

Merged
Mzack9999 merged 1 commit into
devfrom
bugfix-6568-secrets-file-path
Nov 2, 2025
Merged

Mzack9999 merged 1 commit into
devfrom
bugfix-6568-secrets-file-path

Conversation

@Mzack9999

@Mzack9999 Mzack9999 commented Nov 1, 2025 •

Copy link
Copy Markdown
Member

Proposed changes

Close #6568

Checklist

  • Pull request is created against the dev branch
  • All checks passed (lint, unit/integration/regression tests etc.) with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Summary by CodeRabbit

  • Bug Fixes
    • Fixed an issue where authentication options could be unintentionally modified during the enumeration process when using secrets file mode, ensuring configurations remain stable and unaltered.

@Mzack9999 Mzack9999 self-assigned this Nov 1, 2025
@Mzack9999 Mzack9999 added the Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors. label Nov 1, 2025
@coderabbitai

coderabbitai Bot commented Nov 1, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

The change fixes a bug where using the -secrets-file flag caused nuclei to ignore custom template directory settings. The fix passes a cloned copy of options to GetAuthTmplStore instead of the original options, preventing unintended modification of the original configuration.

Changes

Cohort / File(s) Change Summary
Options Cloning for Secrets File Handling
internal/runner/runner.go
Modified RunEnumeration to pass a cloned copy of options to GetAuthTmplStore when SecretsFile is set and not validating, ensuring the original options remain unmodified. Added explanatory comment.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Verify the cloning mechanism correctly preserves all necessary fields from the original options object
  • Confirm the cloned options are used only within the auth template store initialization scope
  • Ensure no other code paths depend on options being modified during this operation

Poem

A rabbit cloned the options with care,
Kept the original pristine and fair,
No more templates would go astray,
Custom paths are here to stay! 🐰✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "Using clone options for auth store" directly describes the primary code change made in this PR. The fix involves passing a cloned copy of options to GetAuthTmplStore instead of the original r.options, which is exactly what the title conveys. While the title is technical rather than user-focused, it is specific, clear, and accurately summarizes the main implementation change without vagueness or misleading information.
Linked Issues Check ✅ Passed The code change directly addresses the core issue from #6568. The bug was that custom template directories were ignored when a secrets file was provided, occurring because GetAuthTmplStore was apparently modifying the original r.options object. By cloning the options before passing them to GetAuthTmplStore, the fix preserves the original template directory setting in r.options, ensuring nuclei respects the user-specified custom template folder even when a secrets file is provided. This aligns perfectly with the expected behavior outlined in the issue.
Out of Scope Changes Check ✅ Passed The changes are contained to a single file (internal/runner/runner.go) with modifications only to the RunEnumeration function when SecretsFile is set. The change—cloning options for the auth store—is directly targeted at resolving the template directory issue described in #6568 and does not introduce unrelated modifications. No extraneous changes outside the scope of the bug fix are evident in the provided summary.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bugfix-6568-secrets-file-path

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b625a65 and 3c0b84b.

📒 Files selected for processing (1)
  • internal/runner/runner.go (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.go

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.go: Format Go code using go fmt
Run static analysis with go vet

Files:

  • internal/runner/runner.go
🧬 Code graph analysis (1)
internal/runner/runner.go (1)
internal/runner/lazy.go (1)
  • GetAuthTmplStore (31-65)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Tests (windows-latest)
  • GitHub Check: Tests (ubuntu-latest)
  • GitHub Check: Tests (macOS-latest)
🔇 Additional comments (1)
internal/runner/runner.go (1)

574-592: Shallow copy is adequate for this fix.

Verification confirms the fix is correct. The Copy() method performs a shallow copy, which is safe here because GetAuthTmplStore only reassigns field references (e.g., opts.Templates = tmpls, opts.Workflows = nil) rather than modifying slice/map contents. The cloned authOptions isolates these mutations from the original r.options, preserving custom template directory settings for main template loading, while SecretsFile is correctly sourced from the original options (line 581).


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Mzack9999
Mzack9999 marked this pull request as ready for review November 1, 2025 16:12
@ghost
ghost requested a review from dwisiswant0 November 1, 2025 16:12
@Mzack9999
Mzack9999 merged commit 6c05580 into dev Nov 2, 2025
@Mzack9999
Mzack9999 deleted the bugfix-6568-secrets-file-path branch November 2, 2025 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] enabling secrets file ignores custom template directory setting

2 participants