IMAP protocol parser, logger and sticky buffers v5#15209
Conversation
This introduces a parser for IMAP protocol. Ticket OISF#8276
This introduces a logger for IMAP protocol. Ticket OISF#8276
This implements the following sticky buffers for IMAP protocol: - imap.request - imap.response The following frames have been added: - imap.body - imap.headers - imap.pdu The following email sticky buffers have been updated to work with IMAP: - email.from - email.subject - email.to - email.cc - email.date - email.message_id - email.x_mailer The following email sticky buffers have been added and are supported only for IMAP: - email.command - email.body - email.header - email.header.name - email.header.value Ticket OISF#8276
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #15209 +/- ##
==========================================
- Coverage 82.69% 82.67% -0.02%
==========================================
Files 993 996 +3
Lines 271697 274203 +2506
==========================================
+ Hits 224667 226686 +2019
- Misses 47030 47517 +487
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
Information: QA ran without warnings. Pipeline = 30954 |
|
There are missing tickets that should relate to https://redmine.openinfosecfoundation.org/issues/8276
|
|
There are unanswered questions in the previous PR like #15064 (comment) |
|
|
||
| if let Some(email_data) = message_email { | ||
| let command_bytes = extract_command_from_requests(&tx.requests); | ||
| let command = String::from_utf8_lossy(&command_bytes).into_owned(); |
There was a problem hiding this comment.
As proposed in #15064 (comment), I checked :
diff --git a/rust/src/imap/logger.rs b/rust/src/imap/logger.rs
index 1f7d91bf5c..54eeae7b2f 100644
--- a/rust/src/imap/logger.rs
+++ b/rust/src/imap/logger.rs
@@ -126,7 +126,7 @@ fn log_imap(tx: &ImapTransaction, js: &mut JsonBuilder) -> Result<(), JsonError>
if let Some(email_data) = message_email {
let command_bytes = extract_command_from_requests(&tx.requests);
- let command = String::from_utf8_lossy(&command_bytes).into_owned();
+ let command = String::from_utf8_lossy(&command_bytes);
js.open_object("email")?;
js.set_string("command", &command)?;compiles for me
|
Main concern in previous remarks was bounding the stateful structures ;-) |
| tx.parsed_email = Some(parsed_email); | ||
| } | ||
| } | ||
| tx.responses.push(response); |
catenacyber
left a comment
There was a problem hiding this comment.
needs a rebase now for the rules range
|
Replaced with #15400 |
Changes:
direction,bodyandoptionalfields from schema.jsonIncompleteDataeventtx.requestsandtx.responsesare boundedGetImapEmailBodyDataand useSCDetectImapEmailGetBodydirectlySCAppLayerRequestProtocolTLSUpgradewhen TLS is requested andImapResponseStatus::Okis seenLink to ticket: https://redmine.openinfosecfoundation.org/issues/8276
Previous PR: #15064
SV_BRANCH=OISF/suricata-verify#2908