Skip to content

add custom fingerprint support - #2263

Merged
Mzack9999 merged 1 commit into
devfrom
1803_add_custom_fingerprint_support
Sep 10, 2025
Merged

Mzack9999 merged 1 commit into
devfrom
1803_add_custom_fingerprint_support

Conversation

@dogancanbakir

@dogancanbakir dogancanbakir commented Sep 9, 2025

Copy link
Copy Markdown
Member

closes #1803

Summary by CodeRabbit

  • New Features

    • Added a --custom-fingerprint-file (-cff) option to supply a custom fingerprint file for technology detection. When provided, the tool uses the specified fingerprints; default behavior remains unchanged if omitted.
  • Documentation

    • Updated PROBES section to document the new -cff/--custom-fingerprint-file option, including its purpose and usage.

@dogancanbakir dogancanbakir self-assigned this Sep 9, 2025
@coderabbitai

coderabbitai Bot commented Sep 9, 2025

Copy link
Copy Markdown

Walkthrough

Adds a new CLI option and Options field to load a custom Wappalyzer fingerprint file. Runner initialization now conditionally creates the Wappalyzer client from the user-provided file when set; otherwise it uses the default. Documentation updated to list the new -cff/--custom-fingerprint-file probe option.

Changes

Cohort / File(s) Summary of Changes
Documentation: PROBES flag
README.md
Added -cff/--custom-fingerprint-file description to PROBES section; no code logic.
Options and CLI flags
runner/options.go
Introduced Options.CustomFingerprintFile string; registered --custom-fingerprint-file/-cff flag in Probes group.
Runner Wappalyzer init
runner/runner.go
Modified Runner.New to create Wappalyzer from file via wappalyzer.NewFromFile when CustomFingerprintFile is provided; otherwise use wappalyzer.New; preserves error handling.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant CLI as CLI Parser
  participant Runner as Runner.New
  participant Wap as Wappalyzer

  User->>CLI: httpx ... -tech-detect [-cff finger.json]
  CLI->>Runner: Options{TechDetect, CustomFingerprintFile}
  alt CustomFingerprintFile provided
    Runner->>Wap: NewFromFile(file, includeCats=true, includeImplies=true)
    Wap-->>Runner: *Wappalyze / error
  else Default fingerprints
    Runner->>Wap: New()
    Wap-->>Runner: *Wappalyze / error
  end
  alt init error
    Runner-->>CLI: return wrapped error
  else success
    Runner-->>CLI: initialized runner with wappalyzer
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Pre-merge checks (3 passed, 2 inconclusive)

❌ Failed checks (2 inconclusive)
Check name Status Explanation Resolution
Linked Issues Check ❓ Inconclusive The implementation successfully adds a CLI flag to specify a custom fingerprint file and updates the runner to use that file instead of the built-in database, but it does not address the linked issue’s mention of supporting configuration through config.yaml, so it only partially fulfills the issue requirements. To fully comply with issue #1803’s objectives, please implement or document how the custom fingerprint file path can also be provided via config.yaml, or update the linked issue if CLI-only support is sufficient.
Description Check ❓ Inconclusive The current description only includes a closing reference to issue #1803 and does not summarize any of the changes or features introduced in this pull request, making it too terse to convey meaningful context to reviewers. Please expand the pull request description to include a brief summary of the changes made—such as the addition of the --custom-fingerprint-file flag, updates to the runner initialization to load custom fingerprints, and documentation updates—so that reviewers can quickly grasp the scope and purpose of the updates.
✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title “add custom fingerprint support” succinctly and accurately summarizes the primary change of the pull request, which is to allow users to supply and use a custom fingerprint file, making it clear and specific enough for reviewers to understand the main feature added without unnecessary detail.
Out of Scope Changes Check ✅ Passed All changes in the README, options struct, CLI flag parsing, and runner initialization directly relate to adding support for a custom fingerprint file; there are no unrelated or out-of-scope modifications included in this pull request.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

Poem

I twitch my whiskers, keen to detect,
New fingerprints loaded with hop-perfect respect.
A -cff nibble, a custom trail,
Through techy thickets I never fail.
Default or bespoke, I bound with delight—
Ears up, paws down, the scan’s set right. 🐇🔍

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 1803_add_custom_fingerprint_support

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
runner/options.go (1)

387-387: Early-validate -cff path and clarify help text

  • Suggest validating that the file exists upfront to fail fast with a precise message.
  • Minor: help text can mention the expected Wappalyzer fingerprints JSON format.

Apply in ValidateOptions (outside this hunk):

 func (options *Options) ValidateOptions() error {
+ if options.CustomFingerprintFile != "" && !fileutil.FileExists(options.CustomFingerprintFile) {
+   return fmt.Errorf("custom fingerprint file '%s' does not exist", options.CustomFingerprintFile)
+ }

Optional help-text tweak (this line):

- flagSet.StringVarP(&options.CustomFingerprintFile, "custom-fingerprint-file", "cff", "", "path to a custom fingerprint file for technology detection"),
+ flagSet.StringVarP(&options.CustomFingerprintFile, "custom-fingerprint-file", "cff", "", "path to a custom Wappalyzer fingerprints JSON file (fingerprints_data.json format) for technology detection"),
runner/runner.go (1)

122-127: Replace vs. merge semantics for custom fingerprints; wrap error with file path

Current call loads embedded fingerprints and then supersedes with the file. If the intent is “use instead of the built-in database,” prefer loadEmbedded=false (supersede ignored). Also wrap the error with the file path for clearer diagnostics. Signature: NewFromFile(filePath string, loadEmbedded, supersede bool). (pkg.go.dev)

- runner.wappalyzer, err = func() (*wappalyzer.Wappalyze, error) {
-   if options.CustomFingerprintFile != "" {
-     return wappalyzer.NewFromFile(options.CustomFingerprintFile, true, true)
-   }
-   return wappalyzer.New()
- }()
+ runner.wappalyzer, err = func() (*wappalyzer.Wappalyze, error) {
+   if options.CustomFingerprintFile != "" {
+     wa, err := wappalyzer.NewFromFile(options.CustomFingerprintFile, false, false)
+     if err != nil {
+       return nil, errors.Wrapf(err, "load custom fingerprints from %q", options.CustomFingerprintFile)
+     }
+     return wa, nil
+   }
+   return wappalyzer.New()
+ }()

If you actually want “overlay and override” behavior (keep built-ins + custom overrides), keep loadEmbedded=true, supersede=true, but please confirm this matches the product expectation.

README.md (1)

118-119: Help text: specify expected file format

To reduce ambiguity, note that the file should be a Wappalyzer fingerprints JSON (fingerprints_data.json-compatible). Keep README in sync with the CLI help string.

-   -cff, -custom-fingerprint-file string  path to a custom fingerprint file for technology detection
+   -cff, -custom-fingerprint-file string  path to a custom Wappalyzer fingerprints JSON file (fingerprints_data.json) for technology detection
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 174c748 and da1e3b2.

📒 Files selected for processing (3)
  • README.md (1 hunks)
  • runner/options.go (2 hunks)
  • runner/runner.go (1 hunks)
⏰ 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). (6)
  • GitHub Check: Test Builds (windows-latest)
  • GitHub Check: Test Builds (macOS-latest)
  • GitHub Check: Test Builds (ubuntu-latest)
  • GitHub Check: Functional Test (macOS-latest)
  • GitHub Check: Functional Test (windows-latest)
  • GitHub Check: Analyze (go)
🔇 Additional comments (1)
runner/options.go (1)

260-260: CustomFingerprintFile on Options — LGTM

Exported field is consistent with existing config/flag plumbing.

@Mzack9999
Mzack9999 merged commit d85379f into dev Sep 10, 2025
16 checks passed
@Mzack9999
Mzack9999 deleted the 1803_add_custom_fingerprint_support branch September 10, 2025 13:43
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.

Support adding custom fingerprint database files when use tech-detect flag

2 participants