-
Notifications
You must be signed in to change notification settings - Fork 26
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
Validate WRP.Source for inbound messages #507
Conversation
Codecov Report
@@ Coverage Diff @@
## main #507 +/- ##
==========================================
+ Coverage 86.58% 86.61% +0.02%
==========================================
Files 186 186
Lines 8321 8360 +39
==========================================
+ Hits 7205 7241 +36
- Misses 912 913 +1
- Partials 204 206 +2
Continue to review full report at Codecov.
|
As long as it isn't some sort of coding error on our part, there shouldn't be a device identifier that is different between a message (simple event message or otherwise) source and the device identifier of the "connection" (connection context). The only possible exception is an empty source. I think it's OK to populate an empty source field, but a different source is an indication of something malicious. Log a security exception and drop the message on the floor. |
5beae25
to
2444d66
Compare
@@ -27,6 +27,10 @@ const ( | |||
DefaultDeviceMessageQueueSize = 100 | |||
) | |||
|
|||
type wrpSourceCheckConfig struct { |
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.
why is this private?
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.
We don't need it elsewhere outside the package. We do need the "Type" to be exported for viper to work properly.
The main logic introduced is summarized here: https://github.com/xmidt-org/webpa-common/pull/507/files#diff-4908257ccaf67982253a9806f535dd1dR75