Skip to content

feat(client): add Logger to client options - #1472

Merged
Mzack9999 merged 2 commits into
projectdiscovery:devfrom
Geertiebear:allow-custom-logger
Oct 25, 2026
Merged

Mzack9999 merged 2 commits into
projectdiscovery:devfrom
Geertiebear:allow-custom-logger

Conversation

@Geertiebear

@Geertiebear Geertiebear commented Oct 7, 2026 •

Copy link
Copy Markdown

Fixes #1491

Embedded clients (for example in Nuclei) currently cannot pass a logger instance through. All logs go through the global logging instance instead. This PR adds an optional logger argument to options, allowing a consumer to pass through a logging instance themselves.

Summary by CodeRabbit

  • Refactor
    • Client log output is now handled through a configurable logger, with a default logger used when none is provided.
    • Registration, polling, decryption, and interaction messages continue to be logged with existing behavior.

@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: aec148a0-46b4-443d-b8ab-10594ecba93b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review.

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 58df0243-7bd1-42e3-8919-e8ebadd1a75d
📥 Commits

Reviewing files that changed from the base of the PR and between a5b78b2 and 1252a14.

📒 Files selected for processing (3)
  • cmd/interactsh-client/main.go
  • pkg/client/client.go
  • pkg/client/upload_test.go

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Walkthrough

The client now accepts and stores a logger, using the default logger when none is provided. Registration, polling, and interaction-decoding diagnostics use the client’s logger. The command-line client and upload tests set the default logger.

Changes

Client Logger Configuration

Layer / File(s) Summary
Configure the client logger
pkg/client/client.go, cmd/interactsh-client/main.go
Options.Logger is used to initialize the client logger. If it is nil, New uses gologger.DefaultLogger. The command-line client sets the default logger.
Use the client logger for diagnostics
pkg/client/client.go, pkg/client/upload_test.go
Registration, polling, and interaction-decoding diagnostics use the client logger. Upload tests initialize clients with gologger.DefaultLogger; URL expectations remain unchanged.

Priority: Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Merge Risk: Minimal · up to 1252a

The client now uses its configured logger for diagnostics and falls back to the default when none is supplied. No actionable merge-blocking regression is established.

Security architecture risk: Low · up to 1252a

The change is limited to caller-selected diagnostic output and preserves existing authentication, transport, and client lifecycle behavior. No security regression was identified in the inspected paths. External logger configuration and downstream consumer compatibility remain unverified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The direct change concerns diagnostics emitted by each configured client and the output destination chosen by its embedding caller. Sharing the default logger remains possible; distinct injected instances permit separate diagnostic routing but do not establish a tenant-isolation guarantee.

Trust Boundaries and Controls

  • observed — Logger authority comes from construction options, not server responses. Remote registration errors and malformed polling data can trigger existing diagnostics, but the PR does not give those inputs authority over logger selection or weaken the inspected authentication and transport controls.
Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "feat(client): add Logger to client options" matches the main change. The changeset adds a Logger field to Options in pkg/client/client.go, defaults it to gologger.DefaultLogger when nil, an…
Full details: Title check

Explanation

The title "feat(client): add Logger to client options" matches the main change. The changeset adds a Logger field to Options in pkg/client/client.go, defaults it to gologger.DefaultLogger when nil, and routes registration, polling, decryption, and decoding messages through the client's logger. The PR objective confirms the goal: let embedded clients such as Nuclei pass their own logger instead of the global one. The title is concise and specific, and it follows a conventional-commit style.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checks the logger's place,
And sets the default in its case.
Registration messages now flow,
Polling and decoding follow.
The tests keep their URLs in view,
While logs use the client logger too.

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

@Geertiebear
Geertiebear changed the base branch from main to dev October 8, 2026 08:03
@Mzack9999
Mzack9999 merged commit 75b9a6e into projectdiscovery:dev Oct 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants