From d8809b5c95502ac991aaf5e145487cb29c9d29ac Mon Sep 17 00:00:00 2001 From: GCHQDeveloper581 <63102987+GCHQDeveloper581@users.noreply.github.com> Date: Tue, 28 Oct 2025 16:21:32 +0000 Subject: [PATCH 1/6] Make compatible with node >=22 This is a breaking change for Node <=16 Therefore minimum requirement and build/edit environment updated to the current Node LTS, v20 --- .devcontainer/devcontainer.json | 2 +- Dockerfile | 2 +- README.md | 2 +- babel.config.js | 5 ++++- package.json | 2 +- src/core/Recipe.mjs | 2 +- src/core/lib/Magic.mjs | 2 +- src/node/api.mjs | 2 +- 8 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 92ebd43cc..9b9920514 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -3,7 +3,7 @@ { "name": "CyberChef", // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile - "image": "mcr.microsoft.com/devcontainers/javascript-node:1-18-bookworm", + "image": "mcr.microsoft.com/devcontainers/javascript-node:1-20-bookworm", // Features to add to the dev container. More info: https://containers.dev/features. "features": { diff --git a/Dockerfile b/Dockerfile index ba605fd71..c37826f46 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ # Modifier --platform=$BUILDPLATFORM limits the platform to "BUILDPLATFORM" during buildx multi-platform builds # This is because npm "chromedriver" package is not compatiable with all platforms # For more info see: https://docs.docker.com/build/building/multi-platform/#cross-compilation -FROM --platform=$BUILDPLATFORM node:18-alpine AS builder +FROM --platform=$BUILDPLATFORM node:20-alpine AS builder WORKDIR /app diff --git a/README.md b/README.md index 89f0371d5..a8d8cb03f 100755 --- a/README.md +++ b/README.md @@ -120,7 +120,7 @@ CyberChef is built to support ## Node.js support -CyberChef is built to fully support Node.js `v16`. For more information, see the ["Node API" wiki page](https://github.com/gchq/CyberChef/wiki/Node-API) +CyberChef is built to fully support Node.js `v20`. For more information, see the ["Node API" wiki page](https://github.com/gchq/CyberChef/wiki/Node-API) ## Contributing diff --git a/babel.config.js b/babel.config.js index deab91084..30ad89e1a 100644 --- a/babel.config.js +++ b/babel.config.js @@ -22,6 +22,9 @@ module.exports = function(api) { "regenerator": true } ] - ] + ], + "generatorOpts": { + "importAttributesKeyword": "with" + } }; }; diff --git a/package.json b/package.json index 9191ab6f0..c09c3ebdd 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "browserslist": [ "Chrome >= 50", "Firefox >= 38", - "node >= 16" + "node >= 20" ], "devDependencies": { "@babel/core": "^7.24.7", diff --git a/src/core/Recipe.mjs b/src/core/Recipe.mjs index 3ce40aa4d..ba7c35e8f 100755 --- a/src/core/Recipe.mjs +++ b/src/core/Recipe.mjs @@ -4,7 +4,7 @@ * @license Apache-2.0 */ -import OperationConfig from "./config/OperationConfig.json" assert {type: "json"}; +import OperationConfig from "./config/OperationConfig.json" with { type: "json" }; import OperationError from "./errors/OperationError.mjs"; import Operation from "./Operation.mjs"; import DishError from "./errors/DishError.mjs"; diff --git a/src/core/lib/Magic.mjs b/src/core/lib/Magic.mjs index 14111ec73..ad407de69 100644 --- a/src/core/lib/Magic.mjs +++ b/src/core/lib/Magic.mjs @@ -1,4 +1,4 @@ -import OperationConfig from "../config/OperationConfig.json" assert {type: "json"}; +import OperationConfig from "../config/OperationConfig.json" with { type: "json" }; import Utils, { isWorkerEnvironment } from "../Utils.mjs"; import Recipe from "../Recipe.mjs"; import Dish from "../Dish.mjs"; diff --git a/src/node/api.mjs b/src/node/api.mjs index 88b3f834a..82b5f61e1 100644 --- a/src/node/api.mjs +++ b/src/node/api.mjs @@ -10,7 +10,7 @@ import NodeDish from "./NodeDish.mjs"; import NodeRecipe from "./NodeRecipe.mjs"; -import OperationConfig from "../core/config/OperationConfig.json" assert {type: "json"}; +import OperationConfig from "../core/config/OperationConfig.json" with { type: "json" }; import { sanitise, removeSubheadingsFromArray, sentenceToCamelCase } from "./apiUtils.mjs"; import ExcludedOperationError from "../core/errors/ExcludedOperationError.mjs"; From 018f9ab3efff714b407750cd5bd2f763d7972f2f Mon Sep 17 00:00:00 2001 From: GCHQDeveloper581 <63102987+GCHQDeveloper581@users.noreply.github.com> Date: Mon, 3 Nov 2025 13:26:45 +0000 Subject: [PATCH 2/6] Fix some "assert{type:" occurences missed in the previous pass --- src/core/ChefWorker.js | 2 +- src/web/index.js | 4 ++-- src/web/static/sitemap.mjs | 2 +- tests/node/tests/Categories.mjs | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/ChefWorker.js b/src/core/ChefWorker.js index a43993f92..43f595f39 100644 --- a/src/core/ChefWorker.js +++ b/src/core/ChefWorker.js @@ -7,7 +7,7 @@ */ import Chef from "./Chef.mjs"; -import OperationConfig from "./config/OperationConfig.json" assert {type: "json"}; +import OperationConfig from "./config/OperationConfig.json" with { type: "json" }; import OpModules from "./config/modules/OpModules.mjs"; import loglevelMessagePrefix from "loglevel-message-prefix"; diff --git a/src/web/index.js b/src/web/index.js index 90142b342..110f0d2bf 100755 --- a/src/web/index.js +++ b/src/web/index.js @@ -17,8 +17,8 @@ import * as CanvasComponents from "../core/lib/CanvasComponents.mjs"; // CyberChef import App from "./App.mjs"; -import Categories from "../core/config/Categories.json" assert {type: "json"}; -import OperationConfig from "../core/config/OperationConfig.json" assert {type: "json"}; +import Categories from "../core/config/Categories.json" with { type: "json" }; +import OperationConfig from "../core/config/OperationConfig.json" with { type: "json" }; /** diff --git a/src/web/static/sitemap.mjs b/src/web/static/sitemap.mjs index b96047fc8..03313ac7e 100644 --- a/src/web/static/sitemap.mjs +++ b/src/web/static/sitemap.mjs @@ -1,5 +1,5 @@ import sm from "sitemap"; -import OperationConfig from "../../core/config/OperationConfig.json" assert {type: "json"}; +import OperationConfig from "../../core/config/OperationConfig.json" with { type: "json" }; /** diff --git a/tests/node/tests/Categories.mjs b/tests/node/tests/Categories.mjs index e6f8bd72d..070d78d71 100644 --- a/tests/node/tests/Categories.mjs +++ b/tests/node/tests/Categories.mjs @@ -1,6 +1,6 @@ import TestRegister from "../../lib/TestRegister.mjs"; -import Categories from "../../../src/core/config/Categories.json" assert {type: "json"}; -import OperationConfig from "../../../src/core/config/OperationConfig.json" assert {type: "json"}; +import Categories from "../../../src/core/config/Categories.json" with { type: "json" }; +import OperationConfig from "../../../src/core/config/OperationConfig.json" with { type: "json" }; import it from "../assertionHandler.mjs"; import assert from "assert"; From c6cd17e1be199b276277503c219183dbf56b1a36 Mon Sep 17 00:00:00 2001 From: GCHQDeveloper581 <63102987+GCHQDeveloper581@users.noreply.github.com> Date: Mon, 3 Nov 2025 15:29:42 +0000 Subject: [PATCH 3/6] Update node version used in GitHub actions --- .github/workflows/master.yml | 2 +- .github/workflows/pull_requests.yml | 2 +- .github/workflows/releases.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 8a3aff54b..a45c6a9cb 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -15,7 +15,7 @@ jobs: - name: Set node version uses: actions/setup-node@v3 with: - node-version: '18.x' + node-version: '20.x' - name: Install run: | diff --git a/.github/workflows/pull_requests.yml b/.github/workflows/pull_requests.yml index 296e60b99..fdadab345 100644 --- a/.github/workflows/pull_requests.yml +++ b/.github/workflows/pull_requests.yml @@ -14,7 +14,7 @@ jobs: - name: Set node version uses: actions/setup-node@v3 with: - node-version: '18.x' + node-version: '20.x' - name: Install run: | diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index a77f4984b..1f945bed2 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -21,7 +21,7 @@ jobs: - name: Set node version uses: actions/setup-node@v3 with: - node-version: '18.x' + node-version: '20.x' - name: Install run: | From 6a969d64622da095c1c0e68977e6b39331dfae1f Mon Sep 17 00:00:00 2001 From: GCHQDeveloper581 <63102987+GCHQDeveloper581@users.noreply.github.com> Date: Fri, 6 Feb 2026 09:50:49 +0000 Subject: [PATCH 4/6] Further bump minimum/default node to 22 --- .devcontainer/devcontainer.json | 2 +- Dockerfile | 2 +- README.md | 2 +- package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 9b9920514..ab3061417 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -3,7 +3,7 @@ { "name": "CyberChef", // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile - "image": "mcr.microsoft.com/devcontainers/javascript-node:1-20-bookworm", + "image": "mcr.microsoft.com/devcontainers/javascript-node:1-22-trixie", // Features to add to the dev container. More info: https://containers.dev/features. "features": { diff --git a/Dockerfile b/Dockerfile index 1ad605a12..7ed0f1c11 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ # Modifier --platform=$BUILDPLATFORM limits the platform to "BUILDPLATFORM" during buildx multi-platform builds # This is because npm "chromedriver" package is not compatiable with all platforms # For more info see: https://docs.docker.com/build/building/multi-platform/#cross-compilation -FROM --platform=$BUILDPLATFORM node:20-alpine AS builder +FROM --platform=$BUILDPLATFORM node:22-alpine AS builder WORKDIR /app diff --git a/README.md b/README.md index a8d8cb03f..a1ea3a5a2 100755 --- a/README.md +++ b/README.md @@ -120,7 +120,7 @@ CyberChef is built to support ## Node.js support -CyberChef is built to fully support Node.js `v20`. For more information, see the ["Node API" wiki page](https://github.com/gchq/CyberChef/wiki/Node-API) +CyberChef is built to fully support Node.js `v22`. For more information, see the ["Node API" wiki page](https://github.com/gchq/CyberChef/wiki/Node-API) ## Contributing diff --git a/package.json b/package.json index b8cdf1465..babc5808b 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "browserslist": [ "Chrome >= 50", "Firefox >= 38", - "node >= 20" + "node >= 22" ], "devDependencies": { "@babel/core": "^7.24.7", From 9b5e359dc7d46838c3e6234fa6037e766a66a671 Mon Sep 17 00:00:00 2001 From: GCHQDeveloper581 <63102987+GCHQDeveloper581@users.noreply.github.com> Date: Fri, 6 Feb 2026 10:05:16 +0000 Subject: [PATCH 5/6] Use a base image that actually exists --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index ab3061417..9b493bb63 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -3,7 +3,7 @@ { "name": "CyberChef", // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile - "image": "mcr.microsoft.com/devcontainers/javascript-node:1-22-trixie", + "image": "mcr.microsoft.com/devcontainers/javascript-node:22-trixie", // Features to add to the dev container. More info: https://containers.dev/features. "features": { From 44d793677b1e64b45b869fc48e9273b4e3da5071 Mon Sep 17 00:00:00 2001 From: GCHQDeveloper581 <63102987+GCHQDeveloper581@users.noreply.github.com> Date: Fri, 6 Feb 2026 11:24:09 +0000 Subject: [PATCH 6/6] Update .nvmrc to reflect new default Node version --- .nvmrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.nvmrc b/.nvmrc index 3c032078a..2bd5a0a98 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -18 +22