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

detect-flowbits: add details for flowbits v7 #10018

Closed

Conversation

hadiqaalamdar
Copy link
Contributor

@hadiqaalamdar hadiqaalamdar commented Dec 8, 2023

Task #6309

Link to redmine ticket: https://redmine.openinfosecfoundation.org/issues/6309
Previous PR: #10008

Describe changes:

  • added the recommended changes from the last PR. The operator string is working correctly for or operator
  • did get rebase appropriately.

SV_BRANCH=OISF/suricata-verify#1529

Copy link
Contributor

@jufajardini jufajardini left a comment

Choose a reason for hiding this comment

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

Kudos for the progress! :)

I'm still considering what should be the approach for the noalert case - might be we're missing documentation, maybe it's a case where we need a warning - like we have for the flowbits that haven't been set...

I think this has to be discussed with more mentors, for us to understand what approach to follow, here.

jb_set_string(js, "cmd", "toggle");
break;
}
int flag = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

As it's being used as a bool, let's declare it as such ;)
We can also use a more descriptive name, maybe is_or?
Could we move it into the if noalert context?

Copy link
Member

Choose a reason for hiding this comment

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

+1 to everything

break;
}
int flag = 0;
if (cd->cmd != DETECT_FLOWBITS_CMD_NOALERT) {
Copy link
Contributor

Choose a reason for hiding this comment

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

And now wondering if we need this noalert if, here.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think we do. I think we should also remove this constant though bc it gives me an impression that this is a valid flowbit specific command and while it is used w flowbits, it is never really used to set cmd.

Copy link
Member

Choose a reason for hiding this comment

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

wrt I have made #10021
If it gets accepted, please rebase your code on that PR and remove all usages of DETECT_FLOWBITS_CMD_NOALERT.
If it gets rejected, maybe just add some notes like Juliana mentioned about noalert control never getting to this part.

Comment on lines +871 to +873
case DETECT_FLOWBITS_CMD_NOALERT:
jb_set_string(js, "action", "noalert");
break;
Copy link
Contributor

Choose a reason for hiding this comment

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

Now, we know from our discussions elsewhere that we can't ever have this one here, so we can probably skip the jb call, maybe just add a comment that noalert doesn't lead to calling DumpMatches? 🤔

Comment on lines +904 to +907
if (flag == 1) {
jb_set_string(js, "operator", "or");
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I saw that this is working! :) Do you think we can move on to thinking about the and case implementation now, @inashivb ?

Copy link
Member

Choose a reason for hiding this comment

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

Indeed. We don't define it as a specific operator anyway like we do for or. It's only fair. 😛

@inashivb
Copy link
Member

inashivb commented Dec 9, 2023

Kudos for the progress! :)

I'm still considering what should be the approach for the noalert case - might be we're missing documentation, maybe it's a case where we need a warning - like we have for the flowbits that haven't been set...

I think it is fine as-is. We do mention in our docs that it is identical to standalone noalert;: https://docs.suricata.io/en/latest/rules/differences-from-snort.html#flowbits-noalert
If you'd also want to have this in flowbits section of docs, I'll support that. :)

@hadiqaalamdar
Copy link
Contributor Author

New PR: #10026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants