3.5.2 • Published 1 year ago

pkg-fetch v3.5.2

Weekly downloads
74,179
License
MIT
Repository
github
Last release
1 year ago

A utility to fetch or build patched Node binaries used by pkg to generate executables. This repo hosts prebuilt binaries in Releases.

Binary Compatibility

NodePlatformArchitecturesMinimum OS version
81, 101, 121, 14, 16, 18alpinex64, arm643.7.3, other distros with musl libc >= 1.1.18
81, 101, 121, 14, 16, 18linuxx64Enterprise Linux 7, Ubuntu 14.04, Debian jessie, other distros with glibc >= 2.17
81, 101, 121, 14, 16, 18linuxarm64Enterprise Linux 8, Ubuntu 18.04, Debian buster, other distros with glibc >= 2.27
81, 101, 121, 14, 16, 18linuxstaticx64, arm64Any distro with Linux Kernel >= 2.6.32 (>= 3.10 strongly recommended)
16, 18linuxstaticarmv72Any distro with Linux Kernel >= 2.6.32 (>= 3.10 strongly recommended)
81, 101, 121, 14, 16, 18macosx6410.13
14, 16, 18macosarm64311.0
81, 101, 121, 14, 16, 18winx648.1
14, 16, 18winarm6410

1: end-of-life, may be removed in the next major release.

2: best-effort basis, not semver-protected.

3: mandatory code signing is enforced by Apple.

Security

We do not expect this project to have vulnerabilities of its own. Nonetheless, as this project distributes prebuilt Node.js binaries,

Node.js security vulnerabilities affect binaries distributed by this project, as well.

Like most of you, this project does not have access to advance/private disclosures of Node.js security vulnerabilities. We can only closely monitor the public security advisories from the Node.js team. It takes time to build and release a new set of binaries, once a new Node.js version has been released.

It is possible for this project to fall victim to a supply chain attack.

This project deploys multiple defense measures to ensure that the safe binaries are delivered to users:

  • Binaries are compiled by Github Actions
    • Workflows and build logs are transparent and auditable.
    • Artifacts are the source of truth. Even repository/organization administrators can't tamper them.
  • Hashes of binaries are hardcoded in source
    • Origins of the binaries are documented.
    • Changes to the binaries are logged by VCS (Git) and are publicly visible.
    • pkg-fetch rejects the binary if it does not match the hardcoded hash.
  • GPG-signed hashes are available in Releases
    • Easy to spot a compromise.
  • pkg-fetch package on npm is strictly permission-controlled
    • Only authorized Vercel employees can push new revisions to npm.

Contributing Updates to Patches

Example workflow for applying patches to a new version of Node.js (18.13.0)

  1. Clone Node.js as a sibling to your current pkg-fetch clone
  • git clone https://github.com/nodejs/node.git
  • cd node
  1. Checkout the tag you wish to generate a patch for
  • git checkout v18.13.0
  1. Attempt to apply the closest patch (e.g. applying the existing patch for 18.12.1 when trying to generate a new patch for 18.13.0)
  • git apply ..\pkg-fetch\patches\node.v18.12.1.cpp.patch --reject
  1. If no rejects, great! you are ready to make your new patch file.
  • git add -A
  • git diff --staged --src-prefix=node/ --dst-prefix=node/ > ..\pkg-fetch\patches\node.v18.13.0.cpp.patch
  1. If rejects exist, resolve them yourself, and ensure all changes are saved, and repeat step 4 to export the patch file

Resolving Rejects

Usually when a patch is rejected, it's because the context around the changes was refactored slightly since the last patched version. This is not usually complicated to resolve, but requires a human to interpret the changes since the last version pkg was patched against, compared with the version you wish to create a patch for.

One method is to pull up the diff for the file where the rejects apply for the changes between the last tag (e.g. v18.12.1 to use the previous example) and the tag you want a patch for (e.g. v18.13.0 to use the previous example). Alongside this, have the .rej file and go through each rejected hunk by hunk and use your best judgement to determine how it should apply against the new tag.

Save you results, and export the overall git diff with the commands from the example above.

Checking that patches apply cleanly

The expectation is that a patch applies cleanly, with no delta or offsets from the source repo.

When making a change to a patch file, it is possible to apply that patch without building by running

yarn applyPatches --node-range node18

where the --node-range can be specified to apply patches for the version of node for which you are updating patches. If unspecified, the latest node version in patches.json will be used.

Ultimately, the patch should result in fully functional node binary, but the applyPatches script can be used to quickly iterate just the application of the patches you are updating without needing to wait for the full build to complete.

Building a Binary Locally

You can use the yarn start script to build the binary locally, which is helpful when updating patches to ensure functionality before pushing patch updates for review.

For example:

yarn start --node-range node18 --arch x64 --output dist

3.5.2

1 year ago

3.4.2

2 years ago

3.4.1

2 years ago

3.3.0

2 years ago

3.2.6

2 years ago

3.2.5

2 years ago

3.2.4

3 years ago

3.2.3

3 years ago

3.2.2

3 years ago

3.2.1

3 years ago

3.2.0

3 years ago

3.0.4

3 years ago

3.0.3

3 years ago

3.1.1

3 years ago

3.1.0

3 years ago

3.0.2

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

2.6.10

3 years ago

2.7.0

3 years ago

2.6.9

4 years ago

2.6.8

4 years ago

2.6.7

4 years ago

2.6.6

4 years ago

2.6.5

4 years ago

2.6.3

4 years ago

2.6.4

4 years ago

2.6.2

5 years ago

2.6.1

5 years ago

2.6.0

5 years ago

2.5.8

5 years ago

2.5.7

5 years ago

2.5.6

6 years ago

2.5.5

6 years ago

2.5.4

6 years ago

2.5.3

6 years ago

2.5.2

6 years ago

2.5.1

6 years ago

2.5.0

6 years ago

2.4.1

6 years ago

2.4.0

6 years ago

2.3.11

7 years ago

2.3.10

7 years ago

2.3.9

7 years ago

2.3.8

7 years ago

2.3.7

7 years ago

2.3.6

7 years ago

2.3.5

7 years ago

2.3.4

7 years ago

2.3.3

7 years ago

2.3.2

7 years ago

2.3.1

7 years ago

2.3.0

7 years ago

2.2.3

7 years ago

2.2.2

7 years ago

2.2.1

7 years ago

2.2.0

7 years ago

2.1.3

7 years ago

2.1.2

7 years ago

2.1.1

7 years ago

2.1.0

7 years ago

2.0.2

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.9.3

7 years ago

1.9.2

7 years ago

1.9.1

7 years ago

1.9.0

7 years ago

1.8.5

7 years ago

1.8.4

7 years ago

1.8.3

7 years ago

1.8.2

7 years ago

1.8.1

7 years ago

1.8.0

7 years ago

1.7.4

8 years ago

1.7.3

8 years ago

1.7.2

8 years ago

1.7.1

8 years ago

1.7.0

8 years ago

1.6.1

8 years ago

1.5.1

8 years ago

1.5.0

8 years ago

1.4.0

8 years ago

1.2.1

8 years ago

1.2.0

8 years ago

1.1.0

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

1.0.0-beta.0

8 years ago

0.1.6

8 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago

0.0.3

8 years ago