GithubHelp home page GithubHelp logo

Comments (2)

AgeManning avatar AgeManning commented on August 31, 2024

This repository contains our implementation of an Ethereum Node Record (https://eips.ethereum.org/EIPS/eip-778).

Might be worth reading the specification to understand what is happening.

There are a few keys (in the spec) that are required. Like seq signature id etc.

Our library as it stands, makes it possible for users to accidentally (or intentially) overwrite these fields with incorrect values making the ENR object invalid.

The library would be better if the mutating functions prevented users from erroneously modifying an ENR that could make it valid. This issue is to check all our mutating functions in the ENRBuilder and the ENR struct to make sure the spec-reserved keys cannot be mutated by the user to make the ENR invalid.

One example is:
The insert() function: https://github.com/sigp/enr/blob/master/src/lib.rs#L457 which calls insert_raw_rlp():https://github.com/sigp/enr/blob/master/src/lib.rs#L470

I think a user is capable of setting invalid types for tcp udp ip etc. It might error if we try to set the seq or signature here, but its worth checking.

It might be useful to write some tests to ensure changes prevent invalid ENRs.

We should also check other mutable functions to make sure users cannot create invalid enrs (according to the spec).

from enr.

AgeManning avatar AgeManning commented on August 31, 2024

One solution could be to create a const list of spec-reserved keys and prevent their mutation through generic functions like insert(). This way if new spec keys are added its easy to maintain, as we simply add to this list.

from enr.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.