yarnpkg / yarnpkg/berry

[Feature] Trusted PnP microkernel execution

Open
#467 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
8.1k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

  • I'd be willing to implement this feature
  • This feature can already be implemented through a plugin

Describe the user story

I am an IDE developer and I want to be sure that .pnp.js has the code developed by Yarn v2 authors, and not by some adversary.

Describe the solution you'd like

The @yarnpkg/pnp-loader package is introduced which will verify that microkernel code inside .pnp.js is developed by Yarn v2 authors, prior to requiring and executing it.

In order for the microkernel code to be verifiable, two values are attached to each microkernel code being released:

  1. Cryptographic hash value - for backward security reasons.
  2. Cryptographic digital signature - for forward security reasons.

@yarnpkg/pnp-loader will have in its source code ALL the previous hash values for all the previous microkernel code releases. It will also has the LAST non-compromised digital signature public key.

The verification algorithm is the following:

  1. Check if .pnp.js has microkernel hash value known to @yarnpkg/pnp-loader, if yes - the microkernel was produced by Yarn v2 authors in the past and the microkernel can be executed, if no - proceed to step 2.
  2. Check if .pnp.js microkernel has digital signature that can be verified with public key stored inside @yarnpkg/pnp-loader, if yes - the code was signed by Yarn v2 authors and can be trusted until the key pair is compromised.

The algorithm to change compromised digital signature key pair:

  1. In case digital signature key pair will be compromised, the new key pair should be generated and public key MUST be updated in new version of @yarnpkg/pnp-loader
  2. All the previous microkernel hash values should still be trusted.

The algorithm to revoke past microkernel version due to known security vulnerability in the code:

  1. The microkernel hash codes for the previous microkernel releases that has security vulnerability should be removed from @yarnpkg/pnp-loader

Describe the drawbacks of your solution

Not sure, but the discussion is needed.

Describe alternatives you've considered

The alternative is to not execute microkernel code from .pnp.js, but rather have a library with the code, that reads PnP map and answers to resolve queries itself. With such a library it is far too difficult to support all microkernel behaviour for past releases.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the proposed @yarnpkg/pnp-loader package and how it would verify and execute microkernel code in .pnp.js. Resolve the open security and key-revocation design questions first; done requires an agreed verification design and defined behavior for trusted, newly signed, compromised, and revoked microkernels.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js, typescript
Domain
devtools, security, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.