[Feature] Trusted PnP microkernel execution
Nobody has claimed this yet.
- 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:
- Cryptographic hash value - for backward security reasons.
- 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:
- Check if
.pnp.jshas 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. - Check if
.pnp.jsmicrokernel 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:
- 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 - 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:
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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