-
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
pgsql: don't error out with PDU parsing errors - v3 #12614
Conversation
Some backend messages can be the shortest pgsql length possible, 4 bytes, but the parser expectd all messages to be longer than that. Related to Bug OISF#5524
The initial parsing for message type checking was more complex than needed be. Related to Bug OISF#5524
Building on top of work done by Jason Ish. Related to Bug OISF#5524
Even if unknown, if the message is properly parsed, allow the parser to proceed. Related to Bug OISF#5524
This allows the app-proto to continue onto parsing next PDUs, if possible. Bug OISF#5524
Events for: - parsing error when parsing pgsql packet length - parsing error for pgsql requests (post length parsing) - parsing error for pgsql responses (post length parsing) - too many transactions Include `pgsql-events.rules` file, and PGSQL events SID range definition Task OISF#5566
This may happen in some situations if the app-layer parser only sees unknown messages and sets an event: there will be an empty transaction, but nothing to log. Related to Task OISF#5566
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #12614 +/- ##
==========================================
+ Coverage 80.74% 80.75% +0.01%
==========================================
Files 931 931
Lines 259144 259208 +64
==========================================
+ Hits 209242 209328 +86
+ Misses 49902 49880 -22
Flags with carried forward coverage won't be shown. Click here to find out more. |
WARNING:
Pipeline 24779 |
Merged in #12625, thanks! |
if let PgsqlFEMessage::UnknownMessageType(_) = request { | ||
return ALPROTO_FAILED; | ||
} | ||
Ok((_, _)) => { |
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.
This does not look right to me : the code does not match the commit message : this is probing, not parsing
I do not think we want to detect pgsql when we see unknown messages
// TODO Log anomaly event instead? | ||
js.set_bool("request", false)?; | ||
js.set_bool("response", false)?; | ||
// TODO Log anomaly event? |
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.
return Error so that caller returns false ?
Previous PR: #12609
Link to ticket: https://redmine.openinfosecfoundation.org/issues/
https://redmine.openinfosecfoundation.org/issues/5524
https://redmine.openinfosecfoundation.org/issues/5566
Describe changes:
#12609, fixing:
Provide values to any of the below to override the defaults.
SV_BRANCH=OISF/suricata-verify#2299