Fix cipher context assignment in handlecipherconfig.go#3675
Fix cipher context assignment in handlecipherconfig.go#3675eriknordmark merged 1 commit intolf-edge:masterfrom
Conversation
The previous version was always assigning the last cipher context in the slice instead of the one with the correct ID. Signed-off-by: Paul Gaiduk <paulg@zededa.com>
rouming
left a comment
There was a problem hiding this comment.
Nice catch. Break was missing.
e1fdc5a to
b269798
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #3675 +/- ##
==========================================
- Coverage 19.62% 19.62% -0.01%
==========================================
Files 232 232
Lines 50746 50746
==========================================
- Hits 9959 9957 -2
- Misses 40064 40067 +3
+ Partials 723 722 -1 ☔ View full report in Codecov by Sentry. |
eriknordmark
left a comment
There was a problem hiding this comment.
Thanks.
Have you seen some failure this would cause, or this is purely from a code review?
If the former we should try to understand where it shoyld be back-ported to lts releases.
| continue | ||
| if cfgCipherContext.ContextID == cipherBlock.CipherContextID { | ||
| cipherBlock.CipherContext = &cfgCipherContext | ||
| break |
There was a problem hiding this comment.
For these cases, I prefer using the index in the loop, breaking on a match and then getting the object by the index. For me, it looks more explicit. But that's also fine.
There was a problem hiding this comment.
I would prefer to reference the copy here instead of the actual array element, in case the array might be subject to change.
I noticed the bug, while testing the change of signing certificate in the controller -> it introduces more cipher contexts and EVE ends up choosing the wrong one for the decryption. Since the certificate change in the controller is independent from EVE, this can also affect the older EVE versions. |
The previous version was always assigning the last cipher context in the slice instead of the one with the correct ID.