-
Notifications
You must be signed in to change notification settings - Fork 53
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: dos protected topic relay msgs based on meta field #1614
Conversation
Are you planning to use the The idea is to use a generalized version of the |
Additionally, the "formalization" of the
|
@LNSD Thanks for the input. I actually haven't thought about it, was using meta since I initially thought it was a good idea, but goes against So I was initially using So I'm fine with both of your suggestions:
So perhaps I would lean towards a generalized version of |
9f443f2
to
39359c9
Compare
I think it's important that (apart from the new field) the actual validation functionality gets removed from the protocol itself as much as possible. This imply some mechanism to pass validation-like functionality from the configured app ( The implementation itself should be much simpler if we don't try to do signing ourselves and don't have to deal with public keys. |
@jm-clius thanks for the comments, will try to move it to the app layer. Note that I added message signing for completeness, since it feels weird that the node can validate signed messages but not publish them. |
I think the concept here is that from the nodes perspective it simply receives messages from the app (e.g. via the API) and publishes as-is. I also don't think the "node" should therefore do the validation - just be configurable to accept validation vectors from the app of which it is agnostic, therefore allowing app-defined validation. |
a5d5c41
to
511c346
Compare
@jm-clius removed signing of messages and moved everything to the app. |
Thanks for addressing the app-node separation concerns. I think this will work and keeps the node clean of application-level knowledge. One thing to note is that this still require the inverse (node/protocol-level knowledge on the application, e.g. the app "knowing" about If we need a more general approach I'd suggest something like defining the concept of an app-level validation function, which the node gets constructed with. When relay then gets constructed and mounted, it "translates" these app-defined validations to relay validators and adds them to its set. This would allow the app to remain ignorant of protocol/relay concepts and the protocol/relay to remain ignorant of app concepts (as it is in your implementation). This idea would require a bit more structure so is perhaps overkill for now, but perhaps useful if we need general app-level validation in future. The most important concern left then, I think, is to address the naming of the field we add to the |
Please, @alrevuelta, could you answer my questions in the associated issue? |
Very open for namings. Have the feeling that
Since the future of this feature is not very clear and I'm also figuring things out along the way, I would prefer to prioritize validating it + moving forward with scoring + trimming connections. Actually I wouldn't mind having a dedicated branch for this complete feature, where functionality >> convenctions, processes, patterns, etc. This would allow to iterate faster and first validate the idea before spending time in things that may be discarded. Once the idea is validated with a bunch of learnings along the way, it can be materialized in production ready code. wdyt? |
As agreed in a meeting, this PR will use the new meta field to store the signuture instead of creating a new field. Once the new meta is in place, this PR will use it. |
2e0f211
to
660ae2a
Compare
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.
Approving to not block and require re-review, but comment below should be addressed first - think it's just something that went wrong when merging
apps/wakunode2/wakunode2.nim
Outdated
except CatchableError: | ||
|
||
# Get this from cli | ||
var topicsPublicKeys = initTable[string, SkPublicKey]() | ||
|
||
# Add validation keys to protected topics | ||
for topic, publicKey in topicsPublicKeys.pairs: | ||
info "routing only signed traffic", topic=topic, publicKey=publicKey | ||
node.wakuRelay.addSignedTopicValidator(Pubsubtopic(topic), publicKey) | ||
except: |
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.
I'm pretty sure this is a faulty merge conflict resolution. This should not be part of the except CatchableError
block and the error-less except
in L396 should be except CatchableError
.
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.
indeed, very good catch thanks.
660ae2a
to
6d6aa7c
Compare
@jm-clius addressed your last comment thanks! can see other 5 commnets made at the same time but in old code, weird. i assume you resolved them and there is noting to address there, since it was already addressed before. |
Partially addresses #1612
Summary:
meta
field for validation. This field can include an optional signature of the message injected from the application, making the relayer only propagate/accept messages with a valid signature included. Note that this is not part of the protocol and only configured from the application.