-
-
Notifications
You must be signed in to change notification settings - Fork 509
feat: add --out-of-scope domain filtering option #876
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add --out-of-scope domain filtering option #876
Conversation
Add --out-of-scope and --out-of-scope-file flags to exclude domains from scanning. Supports wildcard patterns (e.g., *.stg.example.com)
Summary of ChangesHello @sheikhshaheerimran, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the scanning tool by providing a robust mechanism to define and enforce out-of-scope domains. This feature allows users to precisely control which targets are scanned, preventing unintended operations on excluded environments and improving the focus and efficiency of security assessments. It offers flexibility through both direct input and file-based exclusion lists, accommodating various use cases. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
@hahwul requesting your review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a new feature to exclude domains from scanning using --out-of-scope and --out-of-scope-file flags. The implementation is solid and includes comprehensive tests for the new logic. My feedback focuses on minor code improvements to reduce redundancy and improve maintainability. I've pointed out a couple of places where a redundant check can be removed, and also suggested refactoring duplicated code into a helper function for better code reuse.
| if len(options.OutOfScope) > 0 { | ||
| targets = optimization.FilterOutOfScopeTargets(options, targets) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if len(options.OutOfScope) > 0 { | ||
| targets = optimization.FilterOutOfScopeTargets(options, targets) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if optimization.IsOutOfScope(options, args[0]) { | ||
| printing.DalLog("INFO", "Target is out of scope, skipping", options) | ||
| return | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This out-of-scope check logic is duplicated across multiple command files (url.go, sxss.go, pipe.go, file.go). To improve maintainability and reduce code duplication, consider extracting this into a shared helper function within the cmd package. For example:
func isTargetOutOfScope(options model.Options, target string) bool {
if optimization.IsOutOfScope(options, target) {
printing.DalLog("INFO", "Target is out of scope, skipping", options)
return true
}
return false
}Then you could simplify this block to:
if isTargetOutOfScope(options, args[0]) {
return
}
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
hahwul
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Approved.
Test./dalfox file ./samples/sample_target.txt --out-of-scope "*.hahwul.com"
# www.hahwul.com was skipped |
Add --out-of-scope and --out-of-scope-file flags to exclude domains
from scanning. Supports wildcard patterns (e.g., *.staging.example.com)
Closes #867