Conversation
instead of a single progress. Will help for keywords such as http.header which can act on headers and trailers progress Tx engines are inspected between min_progress and max_progress So, we do not give up and says a signature does not match when it will match on later max_progress And we can match as early as possible, especially in IPS mode.
Function to register a app engine with a min and max progress
as it registers the app engine up to the trailers progress Ticket: 8256
and make scan-build happy
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #14724 +/- ##
==========================================
- Coverage 82.17% 82.17% -0.01%
==========================================
Files 1008 1008
Lines 263916 263941 +25
==========================================
+ Hits 216868 216882 +14
- Misses 47048 47059 +11
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
ERROR: ERROR: QA failed on SURI_TLPR1_alerts_cmp. Pipeline = 29352 |
victorjulien
left a comment
There was a problem hiding this comment.
QA failure needs investigating. Further comments inline. We need more docs on this code in general, but for this update specifically to be able to understand how it affects things.
| if (tx->tx_progress > engine->progress) { | ||
| if (tx->tx_progress > engine->max_progress) { | ||
| TRACE_SID_TXS(s->id, tx, | ||
| "engine->mpm: t->tx_progress %u > engine->progress %u, so set " |
There was a problem hiding this comment.
these messages need updating as well
There was a problem hiding this comment.
actually this can be removed...
| tx->tx_progress, engine->max_progress); | ||
| mpm_before_progress = true; | ||
| } else if (tx->tx_progress == engine->progress) { | ||
| } else if (tx->tx_progress == engine->min_progress) { |
There was a problem hiding this comment.
not sure how this relates to max_progress now, should it be >= min progress && <= max_progress?
There was a problem hiding this comment.
I will add a comment
If it were >= min progress && <= max_progress, with no other changes, it fails DetectHttpClientBodyTest14
DetectHttpClientBodyTest14 uses method, header and body in signature with a header being the fast_pattern.
So, we may match the fast_pattern, then the method, then have not enough data for additional header, but if we do not store the signature, we never go back to rerunning the prefilter which already matched...
| uint16_t sm_list; | ||
| uint16_t sm_list_base; /**< base buffer being transformed */ | ||
| uint8_t progress; | ||
| uint8_t min_progress; |
| } | ||
| } | ||
|
|
||
| void DetectAppLayerInspectEngineRegisterMax(const char *name, AppProto alproto, uint32_t dir, |
| sigmatch_table[DETECT_HTTP_HEADER].flags |= SIGMATCH_NOOPT; | ||
| sigmatch_table[DETECT_HTTP_HEADER].flags |= SIGMATCH_INFO_STICKY_BUFFER; | ||
|
|
||
| DetectAppLayerInspectEngineRegister("http_header", ALPROTO_HTTP1, SIG_FLAG_TOSERVER, |
There was a problem hiding this comment.
commit message should explain better why this is needed
| SCJbSetBool(ctx.js, "is_mpm", app->mpm); | ||
| SCJbSetString(ctx.js, "app_proto", AppProtoToString(app->alproto)); | ||
| SCJbSetUint(ctx.js, "progress", app->progress); | ||
| SCJbSetUint(ctx.js, "progress", app->min_progress); |
There was a problem hiding this comment.
should be named progress_min?
There was a problem hiding this comment.
I did not want to break compatibility, I will just add min and max if they are different
|
@ct0br0 asking you help about this QA result ;-) |
|
Status : I have the review changes ready in detect-http-trailers-8256-v3 |
Link to ticket: https://redmine.openinfosecfoundation.org/issues/
https://redmine.openinfosecfoundation.org/issues/8256
Describe changes:
To do so :
DetectEngineAppInspectionEngineDetectAppLayerInspectEngineRegisterMaxfunction to register an app engine with a min_progress < max_progressSV_BRANCH=OISF/suricata-verify#2894
#14717 clean and rebased