-
Notifications
You must be signed in to change notification settings - Fork 19
Fix UUID equality check bug #45
Fix UUID equality check bug #45
Conversation
Signed-off-by: Josh Kim <kjosh@vmware.com>
UUID is used throughout the entire codebase of Transport and is especially important in filtering messages based on their destination. While implementing basic WASM bridge for the bus I realized that UUID comparison was failing, i.e. returning true for the equality check between two dififerent UUID instances. Turns out the use of .ID() method on the UUID object only returns the first 4 bytes of the underlying 16-byte slice. This means as long as the first 8 hexadecimal characters matched between two UUID instances, they would come out as equal, and it would therefore mean a significantly higher chance of UUID collision.. The fix introduced in this PR is to use the string comparison of the full UUID in places where .ID() was used. Signed-off-by: Josh Kim <kjosh@vmware.com>
Codecov Report
@@ Coverage Diff @@
## main #45 +/- ##
==========================================
+ Coverage 87.56% 87.60% +0.03%
==========================================
Files 52 52
Lines 2695 2695
==========================================
+ Hits 2360 2361 +1
+ Misses 335 334 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
config := &bridge.BrokerConnectorConfig{ | ||
Username: "guest", | ||
Password: "guest", | ||
ServerAddr: "appfabric.vmware.com", |
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.
I have seen a couple of these old references in here still. can we get rid of them?
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.
Looks good, it's a little hard to see what has changed because of legacy gofmt
issues overloading the review with formatting.
@daveshanley For that purpose I explicitly split this work into two commits. By choosing the latest commit you'll be able to see the changes only pertaining to this PR. |
UUID is used throughout the entire codebase of Transport and is
especially important in filtering messages based on their destination.
While implementing basic WASM bridge for the bus I realized that UUID
comparison was failing, i.e. returning true for the equality check
between two dififerent UUID instances. Turns out the use of .ID()
method on the UUID object only returns the first 4 bytes of the
underlying 16-byte slice. This means as long as the first 8
hexadecimal characters matched between two UUID instances, they would
come out as equal, and it would therefore mean a significantly higher
chance of UUID collision.. The fix introduced in this PR is to use
the string comparison of the full UUID in places where .ID() was used.
Also performs
gofmt
across all source files, which is done in a separate committo make reviewing the PR easier.
Signed-off-by: Josh Kim kjosh@vmware.com