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

feat: Notify local endpoints about certificate rotation #576

Merged
merged 5 commits into from
Apr 1, 2022

Conversation

Filmaluco
Copy link
Contributor

Closes #539

@Filmaluco Filmaluco requested review from sdsantos and gnarea March 1, 2022 16:38
@Filmaluco Filmaluco self-assigned this Mar 1, 2022
@Filmaluco Filmaluco force-pushed the feature/539_notify_local_endpoints_cert_renew branch from b219ac0 to 1cd4244 Compare March 1, 2022 17:01
@Filmaluco Filmaluco force-pushed the feature/539_notify_local_endpoints_cert_renew branch from 1cd4244 to 70abe07 Compare March 1, 2022 17:15
Copy link
Member

@gnarea gnarea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obrigado Filipe!

A few general notes, not tied to any specific file/line:

  • Per Notify local endpoints when the gateway's id certificate is renewed #539, even though the current use of this notification is to alert endpoints to the rotation of the gateway's certificate, the implementation should ideally be generic enough to be reused more generally when the gateway's cert changes for any reason. With this in mind, did you consider using Android broadcast messages instead, and if so, why was it ruled out? I'm probably being naive but I'd have thought they'd be easier to implement.

    I think they'd be more versatile as well: for example, if an Awala-compatible app is installed before the gateway is installed+registered, a broadcast could be used by that app to register with the gateway.

  • Since we seem to be changing the notification id for incoming parcels (tech.relaycorp.endpoint.NOTIFY), I wonder if we should take advantage of that to revisit the prefix used. Since this is using a messaging pattern, shouldn't the prefix correspond to the source of the message/notification as opposed to the target? That is, something like tech.relaycorp.gateway.endpoints instead of tech.relaycorp.endpoint.

  • Nitpick: I think the arrange/act/assert comments are superfluous, as that's what we do in the codebase anyway (including the JS code), except in rare cases where we can't follow that order. It's also inconsistently used (they're missing from NotifyEndpointsToRenewCertificate, for example)... Which is quite understandable because IMO they don't add anything we can't already see.

PS: You might want to consider registering gradle spotlessApply as a pre-commit hook to avoid ktlint errors, since kitlint is complaining again with the last commit.

package tech.relaycorp.gateway.domain.endpoint

enum class EndpointNotifyAction(val action: String) {
ParcelToReceive("tech.relaycorp.endpoint.NEW_PARCEL"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this replacing tech.relaycorp.endpoint.NOTIFY from the deleted file AwalaAndroid.kt? If so, that'd be a breaking change, which is OK at this stage of the project, but I'd prefer to have a PR ready for the Ping app as well so that we can merge it immediately after merging this PR. This is to minimise the period of time during which the production apps will be incompatible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember having the intel that for now breaking changes were ok and that's why I did. But yes this is from the deleted file AwalaAndroid.kt. I will start the PR for the Ping app ASAP

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need permissions for: relaycorp/relaynet-echo-android

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember having the intel that for now breaking changes were ok and that's why I did

Breaking changes are fine indeed, but if the breaking change also introduces an interoperability issue that breaks production, we should try to do a simultaneous release of the affected components to minimise the disruption.

need permissions for: relaycorp/relaynet-echo-android

We're not using that anymore so I should probably delete it. Or do you mean relaynet-ping-android? I think you do have access to that one.

@gnarea gnarea changed the title feat: Certificate renew notifies Local Endpoints feat: Notify local endpoints about certificate rotation Mar 3, 2022
Copy link
Member

@gnarea gnarea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes!

Let's hold off merging this one until relaycorp/awala-endpoint-android#199 is good to go.

@gnarea gnarea merged commit 2690206 into master Apr 1, 2022
@gnarea gnarea deleted the feature/539_notify_local_endpoints_cert_renew branch April 1, 2022 14:14
@github-actions
Copy link

github-actions bot commented Apr 1, 2022

🎉 This PR is included in version 1.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Notify local endpoints when the gateway's id certificate is renewed
2 participants