fix: prevent stale activeFlowConfig reference in type-registered handler#5458
fix: prevent stale activeFlowConfig reference in type-registered handler#5458Dennis-SEG wants to merge 1 commit intonode-red:masterfrom
Conversation
Cache activeFlowConfig reference at handler start to prevent issues if activeFlowConfig is reassigned between indexOf and splice operations. Also check that config is still active before calling start() to avoid starting flows for an outdated configuration. Fixes: #6
knolleary
left a comment
There was a problem hiding this comment.
Not sure this is actually fixing the issue you've described. You have added line 58 which sets config to the current value of activeFlowConfig. But that's inside the callback handler, so I don't think it has any difference in behaviour to the existing code that references activeFlowConfig directly.
Have you seen an instance of this issue happen? Or is this fixed based on code-review only?
|
You're right. I traced through the code paths and The This was based on code review only, not an observed issue. Happy to close this PR if you prefer, or keep it as a minor defensive measure - your call. |
Summary
Fixes #5454 - The type-registered event handler could operate on a stale activeFlowConfig reference.
Changes
Cache the
activeFlowConfigreference at handler start and verify it hasn't changed before callingstart().Test Plan