Skip to content
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

Avoid race condition in ics27 handshakes via msg server and go apis #2674

Closed
3 tasks
damiannolan opened this issue Nov 4, 2022 · 0 comments · Fixed by #2682
Closed
3 tasks

Avoid race condition in ics27 handshakes via msg server and go apis #2674

damiannolan opened this issue Nov 4, 2022 · 0 comments · Fixed by #2682
Assignees
Milestone

Comments

@damiannolan
Copy link
Member

Summary

ICS27 handshakes should respect the entrypoint from which they were initiated.
With the introduction of the controller msg server the MiddlewareEnabled flag has been added to the legacy APIs and used for cb routing when enabled. This flag is only stored in state for account registration initiated via the legacy API.

Create MiddlewareEnabled flags such that there is something in state in the key regardless of whether it is enabled or disabled. We then check on the APIs, to make sure if there is a handshake in-flight, that the value is the same. If the values are not the same, we return an error.

Note we must also check the status of the active channel. If the active channel is closed then we must allow reopening via either API.

For Go APIs the pseudocode is:

if getMiddlewareFlag() != enabled && activeChannel != closed {
    return err
} else {
    setMiddlewareEnabled()
}

For Msg Server the pseudocode is:

if getMiddlewareFlag() != disabled && activeChannel != closed {
    return err
} else {
   setMiddlewareDisabled()
}

For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged/assigned
@damiannolan damiannolan added this to the v6.0.0 milestone Nov 4, 2022
@damiannolan damiannolan self-assigned this Nov 4, 2022
@damiannolan damiannolan changed the title Avoid potential race condition in ics27 handshakes via msg server and go apis Avoid race condition in ics27 handshakes via msg server and go apis Nov 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done 🥳
Development

Successfully merging a pull request may close this issue.

1 participant