Skip to content

vote: future of primordials #1104

Closed
Closed

Description

@gireeshpunathil

prior art for getting upto speed:

nodejs/node#30697
https://youtu.be/CYv575Bps9M
https://www.youtube.com/watch?v=XPRWSXKLdrY

  • Possible goals
    • tamper-free the entire process
    • tamper-free just module loading
    • selectively, based on performance
    • something else, other than tamper-free
  • Possible approaches
    • migrate to primordials
    • migrate to C++
    • something else

to reduce complexity, I have taken the liberty to remove some of the unpopular options, based on my understanding after listening to various discussions; but if you think an important option is missing, pls let me know!

don't start voting upfront, we need to better qualify the option 1 - with the relevant subset of modules . please suggest what you think those are. (pining @ljharb and @bmeck too for their input here)

voting starts in 2 weeks from now.

Activity

  1. targos commented on Oct 18, 2021

    @targos
    Member

    What does "implement" mean?

  2. gireeshpunathil commented on Oct 18, 2021

    @gireeshpunathil
    MemberAuthor

    What does "implement" mean?

    migrate, may be a better word?

  3. ljharb commented on Oct 18, 2021

    @ljharb
    SponsorMember

    Option 1 is more like “migrate for a subset only, other core modules X this pattern” where X is “may” or “may not” or “must” or “must not”.

    Option 2 is maybe “migrate for all, evaluate performance cliffs as one-offs”?

    Option 3’s status quo is a bit tricky to define; it’s kind of already option 2 but there’s no consensus on it, it seems?

  4. gireeshpunathil commented on Oct 18, 2021

    @gireeshpunathil
    MemberAuthor

    thanks @ljharb and @targos . reworded to reflect the meaning. option 3 is different from 2 in that:

    • in 2, we continue migrating, but with evaluating tradeoffs
    • in 3, we just freeze everything, until a new approach arrives (such as a language semantics?)
  5. ljharb commented on Oct 18, 2021

    @ljharb
    SponsorMember

    Is "freeze everything" the status quo? I thought that was "use primordials whenever possible, be careful of hot paths, and avoid primordials in hot paths".

  6. gireeshpunathil commented on Oct 18, 2021

    @gireeshpunathil
    MemberAuthor

    AFAIK, we stopped migration work for a while, since we started to see the performance ditch. To avoid confusion, let me reword the option to leave the migration where it is right now.

  7. mcollina commented on Oct 18, 2021

    @mcollina
    SponsorMember

    would recommend using a vote similar to what we used for Promises where there were multiple choices.

  8. gireeshpunathil commented on Oct 18, 2021

    @gireeshpunathil
    MemberAuthor

    would recommend using a vote similar to what we used for Promises where there were multiple choices.

    @mcollina - agreed in theory; just wondering how do we do it on a github issue (IIRC, promise voting was done through a google survey form or something?)

  9. aduh95 commented on Oct 18, 2021

    @aduh95
    Contributor

    For the Corepack vote (and the Promise one apparently, but I wasn't around), we used San Francisco RCV via OpaVote: #1012 (comment). Maybe we could use it again?

  10. gireeshpunathil commented on Oct 28, 2021

    @gireeshpunathil
    MemberAuthor

    @ljharb and @bmeck - regarding #1104 (comment) , do you have proposals for specific modules, under option 1 ? that is, the modules that you recommend as

    • should be migrated
    • should not be migrated
    • may be / may not be migrated
      ?
  11. ljharb commented on Oct 28, 2021

    @ljharb
    SponsorMember

    @gireeshpunathil personally, i want them all migrated. the subset that was referred to there afaik was "things in the loader subsystem" i believe? @bmeck can speak to this.

  12. BridgeAR commented on Nov 4, 2021

    @BridgeAR
    Member

    I believe the TSC has to decide upon what modules should be migrated and we should have different voting options for those.

    The current mentioned voting options are open for further discussions and that's something I would rather prevent.
    I would like to also list pros and cons next to entries, if possible. I imply that Evaluate when a better alternative emerges is applicable to all of these options.

    As such, I suggest to be very specific with our voting options. Here are a couple of suggestions:

    1. Fully migrate module loaders and policy code to primordials and undo everything else (code used from other modules would not be tamper proof)
    2. Fully migrate module loaders and policy code to the C++ layer and undo all primordials
      3. Migrate all modules to primordials
      4. Migrate all Node.js code to C++
    3. Undo all primordials
      6. Ask the community in a similar fashion as we did with unhandled rejections
      7. Move the REPL code execution into a child process to keep the REPL from working even if the runtime itself would crash due to manipulation from the executed REPL code
      8. 1. or 2. and move the REPL code execution into a child process to keep the REPL from working even if the runtime itself would crash due to manipulation from the executed REPL code
      9. Do not port any further code to primordials but do not explicitly remove existing primordials either
    4. Make sure the module loaders and policy code is tamper proof and undo all primordials in other code parts
    5. Ask the community about tamper proofness, performance and Node.js contributor experience (maintainability of Node.js core).

    Benefits may be one of:

    a) Tamper free code loading and or execution (tampering with JS code is not going to influence the runtime itself, just the application code)
    b) Performant code (primordials potentially slow down runtime code)
    c) Regular JavaScript code that may be understood by most JS developers (have a lower entry barrier for new contributions)
    d) TBD ...

  13. gireeshpunathil commented on Nov 10, 2021

    @gireeshpunathil
    MemberAuthor

    @BridgeAR - I believe these many options will confuse voters and make it harder for the TSC to converge on a stable opinion. Presence of these many (and technically may be more permutations of these?) options made us to sit and brainstorm in the first place, so as to:

    • weed out some of the obviously poor choices (such as migrate all, migrate none etc.)
    • identify the most prominent ones and their rationales

    so as to help TSC take the most reasonable action on this.

    (I won't make it to tomorrow's TSC due to its timing, but appreciate if this comment is reviewed)

  14. gireeshpunathil commented on Nov 21, 2021

    @gireeshpunathil
    MemberAuthor

    modified the options based on the discussion in the last TSC meeting - by separating the goal, and the approaches; thereby reducing the complexity of options.

    @BridgeAR - does it look good to you? if not, pls bring your views in the upcoming sitting, then we can refine it as applicable, and then go for voting.

  15. BridgeAR commented on Dec 2, 2021

    @BridgeAR
    Member

    @gireeshpunathil thanks for updating this. I think it's good to check for the goals. If we do that, would require a multi step voting process though, as we would have to define if a approach would in fact be able to address the goal (not each approach might in fact reach the goal).

    This is in fact my main issue with primordials in the general: AFAIC they are rarely helping with the actual intend to provide a robust environment. Most applications run lots of code that is far from tamper proof and they would immediately crash as soon as built-in functions are tampered with. As such, they do not address actual user need.

    Therefore I don't think the entries above are yet sufficient.

    I believe these many options will confuse voters and make it harder for the TSC to converge on a stable opinion.

    I personally would hope we manage with and would expect finding a limited set is in fact more difficult than having two or three voting rounds where we remove remove the least voted for options.

  16. 37 remaining items

  17. aduh95 commented on Jan 11, 2022

    @aduh95
    Contributor

    Should we define what code in the error path means before the vote?

    Yes it's important to clarify that. To me, that means any code that runs before (or inside) an inevitable `throw` statement. This leaves as grey area functions that are shared between non-error paths and error path, e.g.:

        throw new ERR_MODULE_NOT_FOUND(
          path || resolved.pathname, base && fileURLToPath(base), 'module');

    In this case, fileURLToPath is on the error path, but it's also a public API, and I don't think it should be covered by this first vote.
    Do not hesitate to ask for clarifications, or suggest a better framing, the last thing we need would be to have the vote results inapplicable because they leave too much to interpretation.

  18. Trott commented on Jan 13, 2022

    @Trott
    Member

    Now that we have enough people seconding the call for a vote, who will set up the voting mechanism? Gireesh? Antoine? Someone else?

  19. gireeshpunathil commented on Jan 13, 2022

    @gireeshpunathil
    MemberAuthor

    Now that we have enough people seconding the call for a vote, who will set up the voting mechanism? Gireesh? Antoine? Someone else?

    I little held up on personal front right now. I am happy and thankful if @aduh95 drive this voting.

  20. mcollina commented on Jan 13, 2022

    @mcollina
    SponsorMember

    Can you please clarify what the "error path" mean in the following sentence:

    Do we want to make code in the error path tamper proof (and how tamper proof do we want it to be)?

  21. aduh95 commented on Jan 13, 2022

    @aduh95
    Contributor

    Can you please clarify what the "error path" mean in the following sentence:

    Do we want to make code in the error path tamper proof (and how tamper proof do we want it to be)?

    #1104 (comment)

    Now that we have enough people seconding the call for a vote, who will set up the voting mechanism? Gireesh? Antoine? Someone else?

    I'm happy to do it as long as everyone is confortable having their vote public – if the voting is private like it was for the Corepack vote, it wouldn't be fair to trust me with it given my involvement in the matter.

  22. mcollina commented on Jan 13, 2022

    @mcollina
    SponsorMember

    What would it take to make the error path fully tamper proof? What changes would be needed by streams?
    Why only the error path?

  23. targos commented on Jan 13, 2022

    @targos
    Member

    Rethinking about it now... I suppose that @aduh95 suggests to do it in the error path because there are less performance concerns in that case? But aren't the upsides of tamperproofing the error path much lower than the normal path? There's not much anyone can control about the behavior of Node in there.

  24. aduh95 commented on Jan 13, 2022

    @aduh95
    Contributor

    Why only the error path?

    1. We have to start somewhere, other areas of the code base can be decided in later votes.
    2. To me, code on the error path is a typical example where most users would prefer reliability over performance.

    What would it take to make the error path fully tamper proof?

    If the vote result is that error path should be tamper proof, the difference it really makes is that PR increasing tamper proofness on the error path can be landed, PR decreasing tamper proofness on the error path can be blocked – and similarly, if the result of the vote is the error path doesn't have to be tamper proof, a PR removing primordials couldn't be blocked unless there are other concerns, and a PR using primordials to the error path would be blocked.

    To be clear, whatever the result of this vote is, a PR could still be blocked if you have concerns over it (e.g. if it introduces perf issues on other areas), no matter if it increases or decreases the tamper proofness.

    What changes would be needed by streams?

    None I'm hoping, or we using streams extensively on the error path? (even if it is, stream being a public API, even if it's on the error path it would be out of scope for this vote, this vote result would apply for error-path-only code; a future vote can be made later for tamper proofing streams or not)

  25. ljharb commented on Jan 13, 2022

    @ljharb
    SponsorMember

    fwiw, I primarily care about reliability on the non-error path; on the error path, my process is generally terminating, so I don't care as much about either reliability or performance.

  26. mhdawson commented on Jan 14, 2022

    @mhdawson
    Member

    +1 for vote but would be good to clarify what Make it applies to. All of Node.js, the loading path, or something else. Or possibly there will be a few votes where it will be something different each time?

  27. Trott commented on Jan 15, 2022

    @Trott
    Member

    +1 for vote

    That makes 11 of us which is > 50% of the TSC. Let's do this thing!

  28. ronag commented on Feb 3, 2022

    @ronag
    Member

    Sorry... but how do I vote?

  29. aduh95 commented on Feb 3, 2022

    @aduh95
    Contributor

    Sorry... but how do I vote?

    Vote is happening in #1158. Check the OP there for instructions, don't hesitate to ask questions if you have any.

  30. mhdawson commented on Feb 23, 2022

    @mhdawson
    Member

    Discussed in the TSC meeting this week. We agreed this issue should be closed and new issues opened for any follow on votes. Suggested candidates for opening the new issue were @aduh95. @gireeshpunathil. @BridgeAR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions