Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/repository-integrity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,32 @@ permissions:
jobs:
integrity:
uses: PastureStack/.github/.github/workflows/repository-integrity.yml@0830b344f020bcb7792a112c376bbfac48e63fa5 # pinned main

build-test-audit:
name: Build, test, and dependency audit
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- name: Check out candidate
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Install Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: '24.20.0'
package-manager-cache: false

- name: Use the locked npm release
shell: bash
run: npm install --global npm@12.0.2 --ignore-scripts --no-audit --no-fund

- name: Build, audit, and verify reproducibility
shell: bash
run: |
set -euo pipefail
test "$(node --version)" = 'v24.20.0'
test "$(npm --version)" = '12.0.2'
npm ci --no-audit --no-fund
npm test
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions scripts/audit.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@ const personalDenylist = [
Buffer.from("6368656e3231303139", "hex").toString("utf8"),
Buffer.from("6368656e323130313940676d61696c2e636f6d", "hex").toString("utf8")
];
const expectedRootLicenseHash = "1d5afc26765f4da03ed7605f2944198b985dac1ddac0ec0b5ace57fe06b94330";
const expectedRootLicenseHash = "809fa1ed21450f59827d1e9aec720bbc4b687434fa22283c6cb5dd82a47ab9c0";
const expectedLucideLicenseHash = "b495047bd93a9b06913511076f504daba17d5bbeb3e0650f3bb53a4220329c57";
const expectedLucideTtfHash = "2ff7709e2f12f6ce07b2df9d3bad4120b622bfdb12c5c8eeaf5a713cf5bba233";

function sha256(value) {
return createHash("sha256").update(value).digest("hex");
}

function normalizeTextLineEndings(value) {
return Buffer.from(value.toString("utf8").replaceAll("\r\n", "\n"), "utf8");
}

async function filesUnder(directory, relative = "") {
const files = [];
for (const entry of await readdir(directory, { withFileTypes: true })) {
Expand Down Expand Up @@ -69,7 +73,7 @@ for (const disallowed of ["selection.json", "compatibility-baseline.json"]) {
}
}

if (sha256(await readFile(path.join(root, "LICENSE"))) !== expectedRootLicenseHash) {
if (sha256(normalizeTextLineEndings(await readFile(path.join(root, "LICENSE")))) !== expectedRootLicenseHash) {
throw new Error("Root LICENSE changed unexpectedly");
}
const lucideLicense = await readFile(path.join(root, "node_modules", "lucide-static", "LICENSE"));
Expand Down