Skip to content
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

Adding advanced template filtering #2374

Merged
merged 16 commits into from
Aug 25, 2022
Merged

Conversation

Mzack9999
Copy link
Member

@Mzack9999 Mzack9999 commented Jul 30, 2022

Proposed changes

This PR adds support for advanced template filtering. Available fields are the following standard ones + all those from info metadata section:

id string
name string
description string
tags slice of strings
authors slice of strings
severity string

All fields can be combined with logical operators (|| and &&) and used with DSL helper functions. As an initial prototype implementation

Checklist

  • Pull request is created against the dev branch
  • All checks passed (lint, unit/integration/regression tests etc.) with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Examples

nuclei -tc "contains(id,'xss') || contains(tags,'xss')"
nuclei -tc "contains(tags,'cve') && contains(tags,'ssrf')"
nuclei -tc "contains(name, 'Local File Inclusion')"

@Mzack9999 Mzack9999 added Status: In Progress This issue is being worked on, and has someone assigned. Type: Enhancement Most issues will probably ask for additions or changes. labels Jul 30, 2022
@Mzack9999 Mzack9999 self-assigned this Jul 30, 2022
@Mzack9999 Mzack9999 linked an issue Jul 30, 2022 that may be closed by this pull request
@Mzack9999 Mzack9999 added Status: Review Needed The issue has a PR attached to it which needs to be reviewed and removed Status: In Progress This issue is being worked on, and has someone assigned. labels Jul 31, 2022
Copy link
Contributor

@forgedhallpass forgedhallpass left a comment

Choose a reason for hiding this comment

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

I know this is WIP, but still I'd like to mention that this will require extensive testing (multiple positive and negative scenarios) through both unit and integration tests.

v2/pkg/catalog/loader/filter/tag_filter.go Show resolved Hide resolved
Copy link
Member

@ehsandeep ehsandeep left a comment

Choose a reason for hiding this comment

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

@ehsandeep ehsandeep added Status: Revision Needed Submitter of PR needs to revise the PR related to the issue. and removed Status: Review Needed The issue has a PR attached to it which needs to be reviewed labels Aug 24, 2022
@ehsandeep ehsandeep merged commit 30054d1 into dev Aug 25, 2022
@ehsandeep ehsandeep deleted the issue-2358-template-filtering branch August 25, 2022 11:22
@ehsandeep ehsandeep added Status: Completed Nothing further to be done with this issue. Awaiting to be closed. and removed Status: Revision Needed Submitter of PR needs to revise the PR related to the issue. labels Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Completed Nothing further to be done with this issue. Awaiting to be closed. Type: Enhancement Most issues will probably ask for additions or changes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Advanced template filtering
4 participants