Skip to content

fix: Consistently use overriden config paths with -config flag#1346

Open
jentfoo wants to merge 10 commits intoprojectdiscovery:devfrom
jentfoo:fix/startup-config-override
Open

fix: Consistently use overriden config paths with -config flag#1346
jentfoo wants to merge 10 commits intoprojectdiscovery:devfrom
jentfoo:fix/startup-config-override

Conversation

@jentfoo
Copy link

@jentfoo jentfoo commented Mar 13, 2026

When -config is provided, goflags' Parse() still attempts to read the default config path first, causing errors like:

    [FTL] Could not parse options: open /home/USER/.config/interactsh-server/config.yaml: read-only file system

This change scans os.Args for -config before Parse() and call SetConfigFilePath() so goflags uses the custom path from the start. The post-parse MergeConfigFile/FileExists checks are removed since Parse() already performs the same existence check and merge internally.

Applied to both interactsh-server and interactsh-client.

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced configuration file path detection for both client and server applications. Custom configuration files specified via -config or --config command-line flags are now properly recognized and loaded. Both the standard flag forms (e.g., -config=PATH and --config=PATH) are now correctly handled before command-line option processing.

orrk-litt and others added 10 commits November 10, 2025 15:25
…ion-strategy

feat(server) added eviction strategy
…-1275-feature/eviction-strategy

Revert "feat(server) added eviction strategy"
Bumps [github.com/refraction-networking/utls](https://github.com/refraction-networking/utls) from 1.8.0 to 1.8.2.
- [Release notes](https://github.com/refraction-networking/utls/releases)
- [Commits](refraction-networking/utls@v1.8.0...v1.8.2)

---
updated-dependencies:
- dependency-name: github.com/refraction-networking/utls
  dependency-version: 1.8.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
…abot/go_modules/github.com/refraction-networking/utls-1.8.2

chore(deps): bump github.com/refraction-networking/utls from 1.8.0 to 1.8.2
When -config is provided, goflags' Parse() still attempts to read the default config path first, causing errors like:
    [FTL] Could not parse options: open /home/USER/.config/interactsh-server/config.yaml: read-only file system

This change scans os.Args for -config before Parse() and call SetConfigFilePath() so goflags uses the custom path from the start. The post-parse MergeConfigFile/FileExists checks are removed since Parse() already performs the same existence check and merge internally.

Applied to both interactsh-server and interactsh-client.
@neo-by-projectdiscovery-dev
Copy link

neo-by-projectdiscovery-dev bot commented Mar 13, 2026

Neo - PR Security Review

No security issues found

Highlights

  • Adds pre-parse detection of -config flag to prevent goflags from attempting to read default config location when custom path is specified
  • Extracts config path from os.Args and calls SetConfigFilePath() before Parse() to fix read-only filesystem errors
  • Removes redundant post-parse config file checks since Parse() already performs these checks internally
Hardening Notes
  • Consider documenting that config files should have restrictive permissions (0600) to prevent information disclosure, though this is standard practice for config files containing tokens/credentials
  • The YAML parser used by goflags should be verified to use yaml.Unmarshal (safe) rather than yaml.Unmarshal with UnmarshalStrict or yaml.Decode which could have different behaviors

Comment @pdneo help for available commands. · Open in Neo

@coderabbitai
Copy link

coderabbitai bot commented Mar 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 00f4f3f8-a49d-4616-9ca5-88acd8984378

📥 Commits

Reviewing files that changed from the base of the PR and between 810180a and d1ec5c6.

📒 Files selected for processing (2)
  • cmd/interactsh-client/main.go
  • cmd/interactsh-server/main.go

Walkthrough

Configuration file handling is refactored in both client and server main modules to detect custom -config/--config flags before flag parsing rather than after, moving the configuration resolution logic earlier in the initialization sequence.

Changes

Cohort / File(s) Summary
Configuration File Pre-Parse Detection
cmd/interactsh-client/main.go, cmd/interactsh-server/main.go
Adds pre-Parse logic to detect custom config paths from -config or --config flags (including =PATH forms) and configures the flag parser accordingly. Removes post-Parse config file merging that occurred after flag parsing completed.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A twitch of the nose, a configuration quest,
From after to before, we've rearranged the test,
Config flags now parse with grace so early and bright,
Detecting the paths before options take flight!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: handling the -config flag override consistently across the codebase by moving config path detection before Parse() instead of after.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

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.

@jentfoo jentfoo changed the base branch from main to dev March 16, 2026 05:24
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.

4 participants