Ensure graceful handling of serialization version mismatches on event trigger definitions#688
Open
konradkonrad wants to merge 1 commit intomainfrom
Open
Ensure graceful handling of serialization version mismatches on event trigger definitions#688konradkonrad wants to merge 1 commit intomainfrom
konradkonrad wants to merge 1 commit intomainfrom
Conversation
ylembachar
reviewed
Mar 30, 2026
|
|
||
| trigger := EventTriggerDefinition{} | ||
| err := trigger.UnmarshalBytes(triggerRegisteredEvent.Definition) | ||
| if len(triggerRegisteredEvent.Definition) > 0 && |
Contributor
There was a problem hiding this comment.
To avoid unmarshaling a definition that will anyway be skipped, the version check should happen before UnmarshalBytes(), similarily to your previous update: https://github.com/shutter-network/rolling-shutter/pull/688/changes#diff-bf9d9e2e61cab2782870a4b2cf9bf3feae73dfe74d1265c1eec16652699a7d9dR95
| return x | ||
| } | ||
|
|
||
| func TestInvalidVersionDoesNotCrash(t *testing.T) { |
Contributor
There was a problem hiding this comment.
Also, I don’t think this test would be relevant once we check the version before unmarshalling, as that code path would be dead. A more relevant test for this PR would verify that outdated versions are skipped in the processor path instead.
148764b to
f2e7119
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There are to my knowledge only two codepaths that unmarshal event trigger definitions. I've added an explicit version check that will log and skip any entries that do not match the currently implemented serialization version.
Fixes #687