Skip to content

Update to rid ourselves of all security and quality alerts - #1301

Merged
philiptaron merged 7 commits into
NixOS:masterfrom
nixos-test-org:site-security-updates
Oct 23, 2026
Merged

philiptaron merged 7 commits into
NixOS:masterfrom
nixos-test-org:site-security-updates

Conversation

@philiptaron

Copy link
Copy Markdown
Collaborator

Read commit-by-commit.

Neither is imported anywhere.

hast on npm is not the HTML syntax tree types (that's @types/hast), but
the 2016 name of what became rehype. It was the only thing pulling in
trim 0.0.1, which has an open high-severity ReDoS alert.

sharp 0.34.5 is not what Astro uses for images: Astro depends on
sharp ^0.35.4 and gets its own copy. The top-level one only added
three open high-severity alerts.
src/lib/nixpkgs-doc.ts imports node:fs/promises and node:path and reads
process.env, so astro check needs Node's type definitions. They only
arrived by accident, through @types/yauzl, which extract-zip pulls in
via the Netlify adapter's tooling. Updating that tooling drops
extract-zip, and astro check then fails with "Cannot find module
'node:path'".

The 26.x types match site/.node-version. The locked version is
unchanged.
npm update, which picks up the fixed releases of nearly every package
with an open Dependabot alert. Among others: @astrojs/netlify 8.2.10,
vite 8.3.5, devalue 5.9.4, svgo 4.1.0, sharp 0.35.5 (Astro's copy),
http-cache-semantics 4.3.0 and fast-uri 3.1.9. The updated Netlify
tooling no longer pulls in extract-zip or node-forge at all.

Astro is held at 7.3.x: 7.4.2, the newest 7.4 release, fails to build the site with
CannotFetchFontFile, because the npm font provider with remote: false
now fetch()es a file:// URL (node_modules/inter-ui/variable/
InterVariable.woff2), which Node's fetch doesn't support. 7.3.8 builds.

prettier, astro check, astro build and astro dev all work, including
the server-rendered Nixpkgs manual pages.
The site served the full Inter variable fonts, 344 KiB upright and
379 KiB italic, and preloaded both on every page.

inter-ui also ships a Latin subset (variable-latin/), 97 KiB upright and
107 KiB italic. Unlike the Fontsource and Google Fonts subsets, it keeps
Inter's OpenType features (37 of 39, including the dlig the site turns
on) and both variation axes, so text looks the same. Of the roughly
790,000 prose characters in the site and the Nixpkgs manual sources,
the subset lacks only 14 that the full font has: → (12 times, in two
files), ⁵ and ⁷. Those fall back to the system font.

The local provider takes the files as package imports, so they still
come from the inter-ui package and Dependabot keeps them updated. It
also avoids the npm provider's remote: false path, which breaks in
Astro 7.4.

Only the upright face is preloaded now; the italic one loads on pages
that use it. Preloaded fonts per page go from 770 KiB to 145 KiB.
Fontsource's API serves the same files as @fontsource-variable/fira-code
(the Latin file is byte-identical), and the fontsource provider fills
in each subset's unicode-range itself, so the npm package can go. The
provider fetches the files at build time; that takes a few seconds.

Only the latin, latin-ext and symbols2 subsets are requested. Together
they cover every character in the code on the site and in the Nixpkgs
manual sources, including the box-drawing characters in directory
trees. The Cyrillic and Greek subsets weren't used.

Also correct the family's settings. It asked for weights 100-900 and an
italic style, but the font has 300-700 and no italic (Astro 7.4 warns
about both). Its featureSettings 'dlig' did nothing, since Fira Code's
files have no dlig feature; its coding ligatures come from calt, which
stays on.

The size-matched fallback is now based on monospace (Courier New, at
about 100% size) instead of the default sans-serif (Arial, at 135%), so
code no longer reflows when the font arrives.
Both Route159 faces are preloaded on every page. Re-encoding them from
WOFF to WOFF2 makes them 22-23% smaller (47 KiB to 37 KiB), with the
same glyphs, outlines, metrics and names; Astro's size-matched
fallbacks come out identical. WOFF2 drops the DSIG table (a signature
that wouldn't match the re-encoded file anyway) and sets the head flag
that marks the lossless transform. The SIL Open Font License, under
which Route159 is published, allows this.

Converted with fontTools: TTFont(path, recalcTimestamp=False) with
flavor = "woff2".
The site was held at Astro 7.3.x because 7.4 broke its fonts: with
unifont 1.x, the npm font provider (remote: false) returns file:// URLs,
and Astro's font fetcher only reads plain absolute paths from disk and
passes everything else to fetch(), which can't read file:// URLs.
Neither font uses the npm provider any more, so 7.4.2 builds.

prettier, astro check, astro build and astro dev all work, the font
output is unchanged, and the Dependabot alert check is the same as on
7.3.8 (48 of the 52 open alerts fixed).
@philiptaron
philiptaron requested a review from a team as a code owner October 23, 2026 01:26
@philiptaron philiptaron changed the title Update to rid ourselves of all security and quality alerts. Update to rid ourselves of all security and quality alerts Oct 23, 2026
@philiptaron
philiptaron merged commit 2e48a30 into NixOS:master Oct 23, 2026
6 checks passed
@trespaul

Copy link
Copy Markdown
Contributor

Hey thanks! Just about fontProvider: if the fontsource provider fetches at build time, does that not break in the nix build env? I ran into this a while ago on a different site (so it may have changed), which is why I did the local package trick.

@philiptaron

Copy link
Copy Markdown
Collaborator Author

Thanks for the note -- what do you think of this?

@philiptaron
philiptaron deleted the site-security-updates branch October 23, 2026 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants