-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
7.0.x: backport treating unknown requirements as unsatisfied with opt-out flag - v2 #12226
Closed
+99
−31
Closed
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev
Previous commit
requires: add option to ignore unknown requirements
The new behavior in 8, and backported is to treat unknown requirements as unsatisfied requirements. For 7.0.8, add a configuration option, "ignore-unknown-requirements" to completely ignore unknown requirements, effectively treating them as available. Ticket: #7434
commit 7b63231ef2bc921c520a45ef259191f8c1e9cc88
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,10 @@ | |
#include "detect-engine.h" | ||
#include "rust.h" | ||
|
||
/* Set to true if unknown requirements should be ingored. In Suricata | ||
* 8, unknown requirements are treated as unsatisfied requirements. */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah I think this answers my question. So do we need a warning/doc reference about this being 7 only behavior? |
||
static int g_ignore_unknown_requirements = 0; | ||
|
||
static int DetectRequiresSetup(DetectEngineCtx *de_ctx, Signature *s, const char *rawstr) | ||
{ | ||
if (de_ctx->requirements == NULL) { | ||
|
@@ -28,7 +32,8 @@ static int DetectRequiresSetup(DetectEngineCtx *de_ctx, Signature *s, const char | |
} | ||
|
||
const char *errmsg = NULL; | ||
int res = SCDetectCheckRequires(rawstr, PROG_VER, &errmsg, de_ctx->requirements); | ||
int res = SCDetectCheckRequires( | ||
rawstr, PROG_VER, &errmsg, de_ctx->requirements, g_ignore_unknown_requirements); | ||
if (res == -1) { | ||
// The requires expression is bad, log an error. | ||
SCLogError("%s: %s", errmsg, rawstr); | ||
|
@@ -43,6 +48,8 @@ static int DetectRequiresSetup(DetectEngineCtx *de_ctx, Signature *s, const char | |
|
||
void DetectRequiresRegister(void) | ||
{ | ||
ConfGetBool("ignore-unknown-requirements", &g_ignore_unknown_requirements); | ||
|
||
sigmatch_table[DETECT_REQUIRES].name = "requires"; | ||
sigmatch_table[DETECT_REQUIRES].desc = "require Suricata version or features"; | ||
sigmatch_table[DETECT_REQUIRES].url = "/rules/meta-keywords.html#requires"; | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
are you thinking about making this a 7.0.x only option? If so, we should probably state that this is not behavior that will continue in 8
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 we want to keep this in 8 and beyond, I'd like it to live under
detect.
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.
Ideally we wouldn't have it at all. So will add a note that it won't be around in 8.
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.
Also note the reasoning for the location: #12226 (comment)