Skip to content

Add -ais flag for all-input-scope functionality#1433

Closed
Vinayakp2001 wants to merge 2 commits intoprojectdiscovery:devfrom
Vinayakp2001:add-all-input-scope-flag
Closed

Add -ais flag for all-input-scope functionality#1433
Vinayakp2001 wants to merge 2 commits intoprojectdiscovery:devfrom
Vinayakp2001:add-all-input-scope-flag

Conversation

@Vinayakp2001
Copy link

@Vinayakp2001 Vinayakp2001 commented Oct 7, 2025

Introduces -ais/--all-input-scope flag that treats all input targets as explicit scope roots for the entire crawling session.

Features:

  • Supports CLI, file, and stdin input methods
  • Prevents conflicts with -fs flag (validation error)
  • Takes precedence over -ns flag when both specified
  • Compatible with existing -cs/-cos regex filters
  • Maintains backward compatibility

Fixes #1383

Summary by CodeRabbit

  • New Features
    • Added --js-interactions (-jsi) flag to enable clicking JavaScript-enabled elements for discovering hidden URLs.
    • Added --all-input-scope (-ais) flag to treat all input targets as explicit scope roots during crawling sessions.

✏️ Tip: You can customize this high-level summary in your review settings.

Introduces -ais/--all-input-scope flag that treats all input targets
as explicit scope roots for the entire crawling session.

Features:
- Supports CLI, file, and stdin input methods
- Prevents conflicts with -fs flag (validation error)
- Takes precedence over -ns flag when both specified
- Compatible with existing -cs/-cos regex filters
- Maintains backward compatibility

Fixes projectdiscovery#1383
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 7, 2025

Walkthrough

Two new command-line flags are introduced: --js-interactions enables clicking JavaScript-enabled elements to discover hidden URLs, and --all-input-scope treats input targets as explicit scope roots. Corresponding boolean fields are added to the Options struct, with validation logic enforcing that --all-input-scope conflicts with --field-scope unless set to "rdn" and takes precedence over --no-scope.

Changes

Cohort / File(s) Summary
Options Struct Definition
pkg/types/options.go
Added two public boolean fields: AllInputScope (treats input targets as explicit scope roots) and JavaScriptInteractions (enables clicking JS-enabled elements)
CLI Flag Registration
cmd/katana/main.go
Registered two new command-line flags: --js-interactions (-jsi) in Headless group and --all-input-scope (-ais) in Scope group
Options Validation
internal/runner/options.go
Added validation logic for --all-input-scope: enforces conflict with --field-scope (except when set to "rdn"), logs precedence when overriding --no-scope, and logs activation message

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 Two flags hop into view,
JavaScript clicks and scopes so true,
With validation checks in place,
The crawl now runs a swifter race,
Katana's reach expands anew! 🌟

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ 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%. 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 highlights the main change: adding a new command-line flag (-ais) for all-input-scope functionality, which is the primary feature introduced in this pull request.

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

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e4c68b5 and cfb42b9.

📒 Files selected for processing (3)
  • cmd/katana/main.go
  • internal/runner/options.go
  • pkg/types/options.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • cmd/katana/main.go
  • internal/runner/options.go
🔇 Additional comments (2)
pkg/types/options.go (2)

35-36: LGTM! Well-placed scope-related field.

The AllInputScope field is appropriately positioned among other scope configuration options and the comment clearly describes its purpose. The field name follows Go conventions and the boolean type is suitable for a flag option.


157-158: LGTM! Well-integrated browser interaction feature.

The JavaScriptInteractions field is logically placed near other JavaScript and headless browser options (like XhrExtraction). The comment is clear and the field follows established naming patterns in the codebase.


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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

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 (1)
internal/runner/options.go (1)

28-38: Document rationale for restricting -ais to the default -fs="rdn"
No existing comments or documentation explain why -ais cannot be combined with custom field‐scopes. If intentional, add a brief explanation in internal/runner/options.go and the README.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 00f90fb and e4c68b5.

📒 Files selected for processing (3)
  • cmd/katana/main.go (1 hunks)
  • internal/runner/options.go (1 hunks)
  • pkg/types/options.go (2 hunks)
🔇 Additional comments (4)
pkg/types/options.go (2)

35-36: LGTM!

The AllInputScope field addition is clear and aligns with the PR objectives for implementing the -ais flag functionality.


151-152: Verify if JavaScriptInteractions belongs in this PR.

The JavaScriptInteractions field is not mentioned in the PR summary (title: "Add -ais flag for all-input-scope functionality"). This suggests it may be unrelated scope creep or part of a different feature.

Please confirm whether this field should be included in PR #1433 or if it belongs to a separate change.

cmd/katana/main.go (2)

195-195: LGTM!

The -ais/--all-input-scope flag is correctly:

  • Placed in the Scope group
  • Mapped to options.AllInputScope
  • Documented with a clear description matching the PR objectives

187-187: Verify if js-interactions flag belongs in this PR.

Similar to the field addition in pkg/types/options.go, the --js-interactions flag is not mentioned in PR #1433's summary. This appears to be unrelated to the -ais flag functionality.

Please confirm whether this flag should be included in this PR or moved to a separate pull request focused on JavaScript interaction functionality.

Copy link
Member

@Mzack9999 Mzack9999 left a comment

Choose a reason for hiding this comment

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

The implementation seems to disable only the no-scope flag, but not adding or building the regex containing the in-scope domains

// XhrExtraction extract xhr requests
XhrExtraction bool
// JavaScriptInteractions enables clicking JavaScript-enabled elements to discover hidden URLs
JavaScriptInteractions bool
Copy link
Member

Choose a reason for hiding this comment

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

This flag seems unused

@Mzack9999
Copy link
Member

Closing as implementation is incomplete

@Mzack9999 Mzack9999 closed this Jan 9, 2026
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.

Add option to treat all input targets as default scope for entire crawl session

2 participants

Comments