-
Notifications
You must be signed in to change notification settings - Fork 184
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
[RPCRequest] Replay protection #1143
base: develop
Are you sure you want to change the base?
Conversation
@@ -193,7 +193,15 @@ public class NetworkingInteractor: NetworkInteracting { | |||
|
|||
private func manageSubscription(_ topic: String, _ encodedEnvelope: String, _ publishedAt: Date) { | |||
if let (deserializedJsonRpcRequest, derivedTopic, decryptedPayload): (RPCRequest, String?, Data) = serializer.tryDeserialize(topic: topic, encodedEnvelope: encodedEnvelope) { | |||
handleRequest(topic: topic, request: deserializedJsonRpcRequest, decryptedPayload: decryptedPayload, publishedAt: publishedAt, derivedTopic: derivedTopic) | |||
if let rpcRequestTopic = deserializedJsonRpcRequest.topic { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check if the subscription topic matches the request's topic.
If there is no request topic - the request will be handled to support backward compatibility.
@alexander-lsvk can you add the section, how it's been tested? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good but need to be manually tested with all the platforms.
also, how about writing a unit test to ensure backward compatibility?
if rpcRequestTopic == topic { | ||
handleRequest(topic: topic, request: deserializedJsonRpcRequest, decryptedPayload: decryptedPayload, publishedAt: publishedAt, derivedTopic: derivedTopic) | ||
} else { | ||
logger.debug("Networking Interactor - Mismatched topic decoded from message") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we log it as an error or warning?
Quality Gate passedIssues Measures |
Description
Gist: https://gist.github.com/jakubuid/4d111f02503a48508d22ff7cb2dcca32
Thread: https://walletconnect.slack.com/archives/C04E3TVLHU7/p1694246632728979
How Has This Been Tested?
Due Dilligence