Merge branch 'master' into 646-fix-populateoptions-overriding

This commit is contained in:
GCHQDeveloper581 2026-06-02 20:03:52 +01:00 committed by GitHub
commit 60fa0d5e27
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
57 changed files with 3845 additions and 3396 deletions

View File

@ -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:24-trixie",
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {

View File

@ -15,6 +15,8 @@ updates:
day: 'friday'
time: '03:00'
timezone: Europe/London
cooldown:
default-days: 2
commit-message:
prefix: 'chore (deps): '
ignore:
@ -25,16 +27,10 @@ updates:
# see issue #2214 for rationale for each of these
- dependency-name: '@xmldom/xmldom'
versions: [ '>=0.9.0' ]
- dependency-name: 'bcryptjs'
versions: [ '>=3.0.0' ]
- dependency-name: 'bootstrap'
versions: [ '>=5.0.0' ]
- dependency-name: 'bson'
versions: [ '>=5.0.0' ]
- dependency-name: 'cbor'
versions: [ '>=10.0.0' ]
- dependency-name: 'cspell'
versions: [ '>=9.0.0' ]
- dependency-name: 'eslint'
versions: [ '>=10.0.0' ]
- dependency-name: 'eslint-plugin-jsdoc'
@ -45,13 +41,10 @@ updates:
versions: [ '>=2.0.0' ]
- dependency-name: 'jimp'
versions: [ '1.6.1' ]
- dependency-name: 'otpauth'
versions: [ '>=9.4.0' ]
- dependency-name: 'webpack-dev-server'
versions: [ '>=5.1.0' ]
groups:
#
# Grouping so we don't get a seperate PR for every patch version.
# Grouping so patch version updates are batched together in a single PR
# and similarly with minor version updates
#
patch-updates:
applies-to: version-updates
@ -59,16 +52,44 @@ updates:
- '*'
update-types:
- 'patch'
minor-updates:
applies-to: version-updates
patterns:
- '*'
update-types:
- 'minor'
# Can't enable this until we are using Node 24 as the latest actions all require this version
# - package-ecosystem: "github-actions"
# # Workflow files stored in the default location of `.github/workflows`; no need to
# # specify `/.github/workflows` for `directory`
# directory: '/'
# schedule:
# interval: 'weekly'
# day: 'friday'
# time: '03:00'
# timezone: Europe/London
# commit-message:
# prefix: 'chore (deps): '
# Versioning on Github Actions
- package-ecosystem: "github-actions"
# Workflow files stored in the default location of `.github/workflows`; no need to
# specify `/.github/workflows` for `directory`
directory: '/'
schedule:
interval: 'weekly'
day: 'friday'
time: '03:00'
timezone: Europe/London
cooldown:
default-days: 4
commit-message:
prefix: 'chore (deps): '
groups:
actions-dependencies:
patterns:
- "*"
- package-ecosystem: docker
directory: /
schedule:
interval: 'weekly'
day: 'friday'
time: '03:00'
timezone: Europe/London
cooldown:
default-days: 4
commit-message:
prefix: 'chore (deps): '
groups:
docker-dependencies:
patterns:
- "*"

View File

@ -16,12 +16,12 @@ jobs:
pages: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set node version
uses: actions/setup-node@v6
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 18
node-version: 24
registry-url: "https://registry.npmjs.org"
- name: Install
@ -44,9 +44,17 @@ jobs:
- name: Generate sitemap
run: npx grunt exec:sitemap
- name: Setup Chrome
id: setup-chrome
if: success()
run: |
npx @puppeteer/browsers install chrome@148
echo chromedir=$(dirname $(find `pwd`/chrome/* -name chrome -print -quit)) >> $GITHUB_OUTPUT
- name: UI Tests
if: success()
run: |
export PATH=${{ steps.setup-chrome.outputs.chromedir }}:$PATH
sudo apt-get install xvfb
xvfb-run --server-args="-screen 0 1200x800x24" npx grunt testui
@ -56,7 +64,7 @@ jobs:
- name: Deploy to GitHub Pages
if: success() && github.ref == 'refs/heads/master'
uses: crazy-max/ghaction-github-pages@v3
uses: crazy-max/ghaction-github-pages@1d6ee9b181a81033a16bd707a1401afa978daab4 # v5.0.0
with:
target_branch: gh-pages
build_dir: ./build/prod

View File

@ -12,12 +12,12 @@ jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set node version
uses: actions/setup-node@v6
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 18
node-version: 24
registry-url: "https://registry.npmjs.org"
- name: Install
@ -39,28 +39,36 @@ jobs:
- name: Upload Build Artefact
if: success()
uses: actions/upload-artifact@v7
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: zipped-build
path: build/prod/*.zip
retention-days: 5
- name: Setup Chrome
id: setup-chrome
if: success()
run: |
npx @puppeteer/browsers install chrome@148
echo chromedir=$(dirname $(find `pwd`/chrome/* -name chrome -print -quit)) >> $GITHUB_OUTPUT
- name: UI Tests
if: success()
run: |
export PATH=${{ steps.setup-chrome.outputs.chromedir }}:$PATH
sudo apt-get install xvfb
xvfb-run --server-args="-screen 0 1200x800x24" npx grunt testui
- name: Set up Docker Buildx
if: success()
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0
- name: Production Image Build
if: success()
id: build-image
uses: docker/build-push-action@v6
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0
with:
platforms: linux/amd64,linux/arm64
platforms: linux/amd64,linux/arm64,linux/arm/v7

View File

@ -22,12 +22,12 @@ jobs:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set node version
uses: actions/setup-node@v6
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 18
node-version: 24
registry-url: "https://registry.npmjs.org"
- name: Install
@ -46,20 +46,29 @@ jobs:
- name: Production Build
run: npx grunt prod
- name: UI Tests
- name: Setup Chrome
id: setup-chrome
if: success()
run: |
npx @puppeteer/browsers install chrome@148
echo chromedir=$(dirname $(find `pwd`/chrome/* -name chrome -print -quit)) >> $GITHUB_OUTPUT
- name: UI Tests
if: success()
run: |
export PATH=${{ steps.setup-chrome.outputs.chromedir }}:$PATH
sudo apt-get install xvfb
xvfb-run --server-args="-screen 0 1200x800x24" npx grunt testui
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0
- name: Image Metadata
id: image-metadata
uses: docker/metadata-action@v4
uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # v6.1.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
@ -68,24 +77,24 @@ jobs:
type=semver,pattern={{version}}
- name: Log in to GHCR
uses: docker/login-action@v3
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASSWORD }}
- name: Publish to GHCR
uses: docker/build-push-action@v6
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0
with:
context: .
push: true
tags: ${{ steps.image-metadata.outputs.tags }}
labels: ${{ steps.image-metadata.outputs.labels }}
platforms: linux/amd64,linux/arm64
platforms: linux/amd64,linux/arm64,linux/arm/v7
- name: Upload Release Assets
id: upload-release-assets
uses: svenstaro/upload-release-action@v2
uses: svenstaro/upload-release-action@29e53e917877a24fad85510ded594ab3c9ca12de # v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/prod/*.zip
@ -101,12 +110,12 @@ jobs:
needs: main
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set node version
uses: actions/setup-node@v6
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 18
node-version: 24
registry-url: "https://registry.npmjs.org"
- name: Install
@ -115,11 +124,5 @@ jobs:
- name: Create machine generated files
run: npm run node
- name: Reset node version ready for publish
uses: actions/setup-node@v6
with:
node-version: ^24.5
registry-url: "https://registry.npmjs.org"
- name: Publish to NPM
run: npm publish

1
.gitignore vendored
View File

@ -13,3 +13,4 @@ src/node/index.mjs
**/*.DS_Store
tests/browser/output/*
.node-version
chrome

2
.nvmrc
View File

@ -1 +1 @@
18
24

View File

@ -13,6 +13,22 @@ All major and minor version changes will be documented in this file. Details of
## Details
## [11.0.0] - 2026-04-28
- Revert sitemap to v8.0.X to fix build/deploy on master [@GCHQDeveloper581] | [#2348]
- Node version update from 22 to 24 [@lzandman] [@GCHQDeveloper581] | [#2347]
- Fix XSS in Show Base64 offsets [@C85297] | [#2346]
- Make compatible with node >=22 [@GCHQDeveloper581] | [#2273]
- Fix(node): enable asynchronous operation support in Node.js API [@engin0223] [@GCHQDeveloper581] | [#2342]
- Feature: Change to nginx-unprivileged image for better kubernetes support [@hsolberg] | [#1922]
Breaking changes:
- Minimum supported node version - now v24 (was v16)
- Change of exported port on Docker Container - now 8080 (was 80)
- Node API now exports "bake" and "execute" functions as async.
<details>
<summary>Click to expand v10 minor versions</summary>
### [10.24.0] - 2026-04-27
- Update CONTRIBUTING.md [@GCHQDeveloper581] | [#2333]
- Fix, and link, Fernet tests [@GCHQDeveloper581] | [#2335]
@ -277,6 +293,8 @@ All major and minor version changes will be documented in this file. Details of
- Added 'Levenshtein Distance' operation [@mikecat] | [#1498]
- Added 'Swap case' operation [@mikecat] | [#1499]
</details>
## [10.0.0] - 2023-03-22
- [Full details explained here](https://github.com/gchq/CyberChef/wiki/Character-encoding,-EOL-separators,-and-editor-features)
- Status bars added to the Input and Output [@n1474335] | [#1405]
@ -620,6 +638,7 @@ All major and minor version changes will be documented in this file. Details of
## [4.0.0] - 2016-11-28
- Initial open source commit [@n1474335] | [b1d73a72](https://github.com/gchq/CyberChef/commit/b1d73a725dc7ab9fb7eb789296efd2b7e4b08306)
[11.0.0]: https://github.com/gchq/CyberChef/releases/tag/v11.0.0
[10.24.0]: https://github.com/gchq/CyberChef/releases/tag/v10.24.0
[10.23.0]: https://github.com/gchq/CyberChef/releases/tag/v10.23.0
[10.22.0]: https://github.com/gchq/CyberChef/releases/tag/v10.22.0
@ -901,6 +920,9 @@ All major and minor version changes will be documented in this file. Details of
[@BjoernAkAManf]: https://github.com/BjoernAkAManf
[@ko80240]: https://github.com/ko80240
[@BigYellowHammer]: https://github.com/BigYellowHammer
[@hsolberg]: https://github.com/hsolberg
[@lzandman]: https://github.com/lzandman
[@engin0223]: https://github.com/engin0223
[8ad18b]: https://github.com/gchq/CyberChef/commit/8ad18bc7db6d9ff184ba3518686293a7685bf7b7
@ -1192,4 +1214,10 @@ All major and minor version changes will be documented in this file. Details of
[#2315]: https://github.com/gchq/CyberChef/pull/2315
[#2313]: https://github.com/gchq/CyberChef/pull/2313
[#2311]: https://github.com/gchq/CyberChef/pull/2311
[#2348]: https://github.com/gchq/CyberChef/pull/2348
[#2347]: https://github.com/gchq/CyberChef/pull/2347
[#2346]: https://github.com/gchq/CyberChef/pull/2346
[#2273]: https://github.com/gchq/CyberChef/pull/2273
[#2342]: https://github.com/gchq/CyberChef/pull/2342
[#1922]: https://github.com/gchq/CyberChef/pull/1922

View File

@ -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:24-alpine@sha256:2bdb65ed1dab192432bc31c95f94155ca5ad7fc1392fb7eb7526ab682fa5bf14 AS builder
WORKDIR /app
@ -27,7 +27,7 @@ RUN npm run build
#########################################
# Package static build files into nginx #
#########################################
FROM nginx:stable-alpine AS cyberchef
FROM nginxinc/nginx-unprivileged:stable-alpine@sha256:df0e9edf92b8436ff797fe5a2cbfc66be1df775c113d322ccadf5c7f3100eda8 AS cyberchef
LABEL maintainer="GCHQ <oss@gchq.gov.uk>"

View File

@ -6,7 +6,7 @@ const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPl
const glob = require("glob");
const path = require("path");
const nodeFlags = "--experimental-modules --experimental-json-modules --experimental-specifier-resolution=node --no-warnings --no-deprecation";
const nodeFlags = "--no-warnings --no-deprecation";
/**
* Grunt configuration for building the app in various formats.
@ -89,6 +89,8 @@ module.exports = function (grunt) {
const compileYear = grunt.template.today("UTC:yyyy"),
compileTime = grunt.template.today("UTC:dd/mm/yyyy HH:MM:ss") + " UTC",
pkg = grunt.file.readJSON("package.json"),
version = process.env.GITHUB_SHA || `v${pkg.version}`,
downloadZipFilename = `CyberChef_${version}.zip`,
webpackConfig = require("./webpack.config.js"),
BUILD_CONSTANTS = {
COMPILE_YEAR: JSON.stringify(compileYear),
@ -129,7 +131,9 @@ module.exports = function (grunt) {
chunks: ["main"],
compileYear: compileYear,
compileTime: compileTime,
version: pkg.version,
version: version,
latestReleaseVersion: pkg.version,
downloadZipFilename: downloadZipFilename,
minify: {
removeComments: true,
collapseWhitespace: true,
@ -245,7 +249,7 @@ module.exports = function (grunt) {
"!build/prod/index.html",
"!build/prod/BundleAnalyzerReport.html",
],
dest: `build/prod/CyberChef_v${pkg.version}.zip`
dest: `build/prod/${downloadZipFilename}`
}
},
connect: {
@ -333,12 +337,12 @@ module.exports = function (grunt) {
switch (process.platform) {
case "darwin":
return chainCommands([
`shasum -a 256 build/prod/CyberChef_v${pkg.version}.zip | awk '{print $1;}' > build/prod/sha256digest.txt`,
`shasum -a 256 build/prod/${downloadZipFilename} | awk '{print $1;}' > build/prod/sha256digest.txt`,
`sed -i '' -e "s/DOWNLOAD_HASH_PLACEHOLDER/$(cat build/prod/sha256digest.txt)/" build/prod/index.html`
]);
default:
return chainCommands([
`sha256sum build/prod/CyberChef_v${pkg.version}.zip | awk '{print $1;}' > build/prod/sha256digest.txt`,
`sha256sum build/prod/${downloadZipFilename} | awk '{print $1;}' > build/prod/sha256digest.txt`,
`sed -i -e "s/DOWNLOAD_HASH_PLACEHOLDER/$(cat build/prod/sha256digest.txt)/" build/prod/index.html`
]);
}

View File

@ -36,7 +36,7 @@ docker build --tag cyberchef --ulimit nofile=10000 .
```
2. Run the docker container
```bash
docker run -it -p 8080:80 cyberchef
docker run -it -p 8080:8080 cyberchef
```
3. Navigate to `http://localhost:8080` in your browser
@ -45,7 +45,7 @@ docker run -it -p 8080:80 cyberchef
If you prefer to skip the build process, you can use the pre-built image
```bash
docker run -it -p 8080:80 ghcr.io/gchq/cyberchef:latest
docker run -it -p 8080:8080 ghcr.io/gchq/cyberchef:latest
```
Just like before, navigate to `http://localhost:8080` in your browser.
@ -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 `v24`. For more information, see the ["Node API" wiki page](https://github.com/gchq/CyberChef/wiki/Node-API)
## Contributing

View File

@ -16,6 +16,9 @@ module.exports = function(api) {
"regenerator": true
}
]
]
],
"generatorOpts": {
"importAttributesKeyword": "with"
}
};
};

5937
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "cyberchef",
"version": "10.24.0",
"version": "11.0.0",
"description": "The Cyber Swiss Army Knife for encryption, encoding, compression and data analysis.",
"author": "n1474335 <n1474335@gmail.com>",
"homepage": "https://gchq.github.io/CyberChef",
@ -36,33 +36,34 @@
"browserslist": [
"Chrome >= 50",
"Firefox >= 38",
"node >= 16"
"node >= 24"
],
"devDependencies": {
"@babel/eslint-parser": "^7.28.6",
"@babel/plugin-syntax-import-assertions": "^7.28.6",
"@babel/plugin-transform-runtime": "^7.29.0",
"@babel/preset-env": "^7.29.2",
"@babel/runtime": "^7.29.2",
"@babel/plugin-transform-runtime": "^7.29.7",
"@babel/preset-env": "^7.29.7",
"@babel/runtime": "^7.29.7",
"@codemirror/commands": "^6.10.3",
"@codemirror/language": "^6.12.3",
"@codemirror/search": "^6.7.0",
"@codemirror/state": "^6.5.4",
"@codemirror/view": "^6.41.1",
"@codemirror/view": "^6.43.0",
"@puppeteer/browsers": "3.0.4",
"autoprefixer": "^10.5.0",
"babel-loader": "^10.1.1",
"base64-loader": "^1.0.0",
"chromedriver": "^146.0.6",
"chromedriver": "^148.0.4",
"cli-progress": "^3.12.0",
"colors": "^1.4.0",
"compression-webpack-plugin": "^11.1.0",
"copy-webpack-plugin": "^13.0.1",
"compression-webpack-plugin": "^12.0.0",
"copy-webpack-plugin": "^14.0.0",
"core-js": "^3.49.0",
"cspell": "^8.19.4",
"css-loader": "7.1.4",
"cspell": "^9.7.0",
"css-loader": "^7.1.4",
"eslint": "^9.39.4",
"eslint-plugin-jsdoc": "^50.8.0",
"globals": "^15.15.0",
"globals": "^17.6.0",
"grunt": "^1.6.2",
"grunt-chmod": "~1.1.1",
"grunt-concurrent": "^3.0.0",
@ -79,16 +80,16 @@
"mini-css-extract-plugin": "2.10.2",
"modify-source-webpack-plugin": "^4.1.0",
"nightwatch": "^3.15.0",
"postcss": "^8.5.10",
"postcss": "^8.5.15",
"postcss-css-variables": "^0.19.0",
"postcss-import": "^16.1.1",
"postcss-loader": "^8.2.1",
"prompt": "^1.3.0",
"sitemap": "^8.0.3",
"terser": "^5.46.2",
"webpack": "^5.106.2",
"webpack-bundle-analyzer": "^4.10.2",
"webpack-dev-server": "5.0.4",
"sitemap": "^9.0.1",
"terser": "^5.48.0",
"webpack": "^5.107.2",
"webpack-bundle-analyzer": "^5.3.0",
"webpack-dev-server": "^5.2.4",
"webpack-node-externals": "^3.0.0",
"worker-loader": "^3.0.8"
},
@ -96,20 +97,21 @@
"@alexaltea/capstone-js": "^3.0.5",
"@astronautlabs/amf": "^0.0.6",
"@blu3r4y/lzma": "^2.3.3",
"@noble/hashes": "2.2.0",
"@wavesenterprise/crypto-gost-js": "^2.1.0-RC1",
"@xmldom/xmldom": "^0.8.13",
"argon2-browser": "^1.18.0",
"arrive": "^2.5.3",
"assert": "^2.1.0",
"avsc": "^5.7.9",
"bcryptjs": "^2.4.3",
"bcryptjs": "^3.0.3",
"bignumber.js": "^9.3.1",
"blakejs": "^1.2.1",
"bootstrap": "4.6.2",
"bootstrap-colorpicker": "^3.4.0",
"bootstrap-material-design": "^4.1.3",
"browserify-zlib": "^0.2.0",
"bson": "^4.7.2",
"bson": "^7.2.0",
"buffer": "^6.0.3",
"cbor": "9.0.2",
"chi-squared": "^1.1.0",
@ -121,7 +123,7 @@
"d3": "7.9.0",
"d3-hexbin": "^0.2.2",
"diff": "^5.2.2",
"dompurify": "^3.4.1",
"dompurify": "^3.4.6",
"es6-promisify": "^7.0.0",
"escodegen": "^2.1.0",
"esprima": "^4.0.1",
@ -132,7 +134,6 @@
"flat": "^6.0.1",
"geodesy": "1.1.3",
"handlebars": "^4.7.9",
"hash-wasm": "^4.12.0",
"highlight.js": "^11.11.1",
"ieee754": "^1.2.1",
"jimp": "1.6.0",
@ -156,7 +157,7 @@
"lz4js": "^0.2.0",
"markdown-it": "^14.1.1",
"moment": "^2.30.1",
"moment-timezone": "^0.6.1",
"moment-timezone": "^0.6.2",
"ngeohash": "^0.6.3",
"node-forge": "^1.4.0",
"node-md6": "^0.1.0",
@ -164,11 +165,12 @@
"notepack.io": "^3.0.1",
"ntlm": "^0.1.3",
"nwmatcher": "^1.4.4",
"otpauth": "9.3.6",
"otpauth": "^9.5.0",
"path": "^0.12.7",
"popper.js": "^1.16.1",
"process": "^0.11.10",
"protobufjs": "^7.5.5",
"protobufjs": "^7.6.1",
"punycode.js": "^2.3.1",
"qr-image": "^3.2.0",
"reflect-metadata": "^0.2.2",
"rison": "^0.1.1",
@ -176,7 +178,7 @@
"snackbarjs": "^1.1.0",
"sortablejs": "^1.15.7",
"split.js": "^1.6.5",
"sql-formatter": "^15.7.3",
"sql-formatter": "^15.8.0",
"ssdeep.js": "0.0.3",
"stream-browserify": "^3.0.0",
"tesseract.js": "^6.0.1",
@ -184,7 +186,7 @@
"unorm": "^1.6.0",
"url": "^0.11.4",
"utf8": "^3.0.0",
"uuid": "^13.0.0",
"uuid": "^14.0.0",
"vkbeautify": "^0.99.3",
"xpath": "0.0.34",
"xregexp": "^5.1.2",
@ -194,18 +196,21 @@
"start": "npx grunt dev",
"build": "npx grunt prod",
"node": "npx grunt node",
"repl": "node --experimental-modules --experimental-json-modules --experimental-specifier-resolution=node --no-experimental-fetch --no-warnings src/node/repl.mjs",
"test": "npx grunt configTests && node --experimental-modules --experimental-json-modules --no-warnings --no-deprecation --openssl-legacy-provider --no-experimental-fetch tests/node/index.mjs && node --experimental-modules --experimental-json-modules --no-warnings --no-deprecation --openssl-legacy-provider --no-experimental-fetch --trace-uncaught tests/operations/index.mjs",
"repl": "node --no-warnings src/node/repl.mjs",
"test": "npx grunt configTests && node --no-warnings --no-deprecation --openssl-legacy-provider tests/node/index.mjs && node --no-warnings --no-deprecation --openssl-legacy-provider --trace-uncaught tests/operations/index.mjs",
"testnodeconsumer": "npx grunt testnodeconsumer",
"testui": "npx grunt testui",
"testuidev": "npx nightwatch --env=dev",
"lint": "npx grunt lint",
"lint:grammar": "cspell ./src",
"postinstall": "npx grunt exec:fixCryptoApiImports && npx grunt exec:fixSnackbarMarkup",
"newop": "node --experimental-modules --experimental-json-modules src/core/config/scripts/newOperation.mjs",
"minor": "node --experimental-modules --experimental-json-modules src/core/config/scripts/newMinorVersion.mjs && npm version minor --git-tag-version=false && echo \"Updated to version v$(npm pkg get version | xargs), please create a pull request and once merged use 'npm run tag'\"",
"newop": "node src/core/config/scripts/newOperation.mjs",
"minor": "node src/core/config/scripts/newMinorVersion.mjs && npm version minor --git-tag-version=false && echo \"Updated to version v$(npm pkg get version | xargs), please create a pull request and once merged use 'npm run tag'\"",
"tag": "git tag -s \"v$(npm pkg get version | xargs)\" -m \"$(npm pkg get version | xargs)\" && echo \"Created v$(npm pkg get version | xargs), now check and push the tag\"",
"getheapsize": "node -e 'console.log(`node heap limit = ${require(\"v8\").getHeapStatistics().heap_size_limit / (1024 * 1024)} Mb`)'",
"setheapsize": "export NODE_OPTIONS=--max_old_space_size=2048"
},
"engines": {
"node": ">=24 <25"
}
}

View File

@ -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";

View File

@ -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";

View File

@ -188,6 +188,7 @@
"Generate PGP Key Pair",
"PGP Encrypt",
"PGP Decrypt",
"PGP Sign",
"PGP Verify",
"PGP Encrypt and Sign",
"PGP Decrypt and Verify",
@ -348,6 +349,7 @@
"Pseudo-Random Number Generator",
"Sleep",
"File Tree",
"Wrap",
"Take nth bytes",
"Drop nth bytes"
]

View File

@ -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";

View File

@ -6,7 +6,10 @@
import Operation from "../Operation.mjs";
import OperationError from "../errors/OperationError.mjs";
import { blake3 } from "hash-wasm";
import Utils from "../Utils.mjs";
import { blake3 } from "@noble/hashes/blake3.js";
import { bytesToHex } from "@noble/hashes/utils.js";
/**
* BLAKE3 operation
*/
@ -44,13 +47,16 @@ class BLAKE3 extends Operation {
run(input, args) {
const key = args[1];
const size = args[0];
// Check if the user want a key hash or not
if (key === "") {
return blake3(input, size*8);
} if (key.length !== 32) {
const opts = { dkLen: size };
const inputBytes = new Uint8Array(Utils.strToArrayBuffer(input));
if (key !== "") {
const keyBytes = new Uint8Array(Utils.strToArrayBuffer(key));
if (keyBytes.length !== 32) {
throw new OperationError("The key must be exactly 32 bytes long");
}
return blake3(input, size*8, key);
opts.key = keyBytes;
}
return bytesToHex(blake3(inputBytes, opts));
}
}

View File

@ -5,7 +5,7 @@
*/
import Operation from "../Operation.mjs";
import bson from "bson";
import { deserialize } from "bson";
import OperationError from "../errors/OperationError.mjs";
/**
@ -37,7 +37,7 @@ class BSONDeserialise extends Operation {
if (!input.byteLength) return "";
try {
const data = bson.deserialize(new Buffer(input));
const data = deserialize(new Uint8Array(input));
return JSON.stringify(data, null, 2);
} catch (err) {
throw new OperationError(err.toString());

View File

@ -5,7 +5,7 @@
*/
import Operation from "../Operation.mjs";
import bson from "bson";
import { serialize } from "bson";
import OperationError from "../errors/OperationError.mjs";
/**
@ -38,7 +38,8 @@ class BSONSerialise extends Operation {
try {
const data = JSON.parse(input);
return bson.serialize(data).buffer;
const result = serialize(data);
return result.buffer.slice(result.byteOffset, result.byteOffset + result.byteLength);
} catch (err) {
throw new OperationError(err.toString());
}

View File

@ -43,7 +43,7 @@ class Bcrypt extends Operation {
const rounds = args[0];
const salt = await bcrypt.genSalt(rounds);
return await bcrypt.hash(input, salt, null, p => {
return await bcrypt.hash(input, salt, undefined, p => {
// Progress callback
if (isWorkerEnvironment())
self.sendStatusMessage(`Progress: ${(p * 100).toFixed(0)}%`);

View File

@ -43,7 +43,7 @@ class BcryptCompare extends Operation {
async run(input, args) {
const hash = args[0];
const match = await bcrypt.compare(input, hash, null, p => {
const match = await bcrypt.compare(input, hash, undefined, p => {
// Progress callback
if (isWorkerEnvironment())
self.sendStatusMessage(`Progress: ${(p * 100).toFixed(0)}%`);

View File

@ -5,7 +5,7 @@
*/
import Operation from "../Operation.mjs";
import punycode from "punycode";
import punycode from "punycode.js";
/**
* From Punycode operation

View File

@ -12,6 +12,7 @@ import { getSubkeySize, ASP } from "../lib/PGP.mjs";
import { cryptNotice } from "../lib/Crypt.mjs";
import * as es6promisify from "es6-promisify";
const promisify = es6promisify.default ? es6promisify.default.promisify : es6promisify.promisify;
const KEY_FLAGS = kbpgp.const.openpgp.key_flags;
/**
@ -73,11 +74,11 @@ class GeneratePGPKeyPair extends Operation {
if (name) userIdentifier += name;
if (email) userIdentifier += ` <${email}>`;
let flags = kbpgp.const.openpgp.certify_keys;
flags |= kbpgp.const.openpgp.sign_data;
flags |= kbpgp.const.openpgp.auth;
flags |= kbpgp.const.openpgp.encrypt_comm;
flags |= kbpgp.const.openpgp.encrypt_storage;
let flags = KEY_FLAGS.certify_keys;
flags |= KEY_FLAGS.sign_data;
flags |= KEY_FLAGS.auth;
flags |= KEY_FLAGS.encrypt_comm;
flags |= KEY_FLAGS.encrypt_storage;
const keyGenerationOptions = {
userid: userIdentifier,
@ -89,11 +90,11 @@ class GeneratePGPKeyPair extends Operation {
},
subkeys: [{
"nbits": getSubkeySize(keySize),
"flags": kbpgp.const.openpgp.sign_data,
"flags": KEY_FLAGS.sign_data,
"expire_in": 86400 * 365 * 8
}, {
"nbits": getSubkeySize(keySize),
"flags": kbpgp.const.openpgp.encrypt_comm | kbpgp.const.openpgp.encrypt_storage,
"flags": KEY_FLAGS.encrypt_comm | KEY_FLAGS.encrypt_storage,
"expire_in": 86400 * 365 * 2
}],
asp: ASP

View File

@ -0,0 +1,83 @@
/**
* @author GCHQDeveloper581
* @copyright Crown Copyright 2026
* @license Apache-2.0
*/
import Operation from "../Operation.mjs";
import kbpgp from "kbpgp";
import { ASP, importPrivateKey } from "../lib/PGP.mjs";
import OperationError from "../errors/OperationError.mjs";
import * as es6promisify from "es6-promisify";
const promisify = es6promisify.default ? es6promisify.default.promisify : es6promisify.promisify;
/**
* PGP Sign operation
*/
class PGPSign extends Operation {
/**
* PGPSign constructor
*/
constructor() {
super();
this.name = "PGP Sign";
this.module = "PGP";
this.description = [
"Input: the message you want to sign",
"<br><br>",
"Arguments: the ASCII-armoured PGP private key of the sender.",
"<br><br>",
"Pretty Good Privacy is an encryption standard (OpenPGP) used for encrypting, decrypting, and signing messages.",
"<br><br>",
"This function uses the Keybase implementation of PGP.",
].join("\n");
this.infoURL = "https://wikipedia.org/wiki/Pretty_Good_Privacy"; // Usually a Wikipedia link. Remember to remove localisation (i.e. https://wikipedia.org/etc rather than https://en.wikipedia.org/etc)
this.inputType = "string";
this.outputType = "string";
this.args = [
{
"name": "Private key of signer",
"type": "text",
"value": ""
},
{
"name": "Private key passphrase (optional)",
"type": "string",
"value": ""
}
];
}
/**
* @param {string} input
* @param {Object[]} args
* @returns {string}
*
* @throws {OperationError} if failed private key import or failed encryption
*/
async run(input, args) {
const message = input,
[privateKey, passphrase] = args;
let signedMessage;
if (!privateKey) throw new OperationError("Enter the private key of the signer.");
const privKey = await importPrivateKey(privateKey, passphrase);
try {
signedMessage = await promisify(kbpgp.box)({
"msg": message,
"sign_with": privKey,
"asp": ASP
});
} catch (err) {
throw new OperationError(`Couldn't sign message: ${err}`);
}
return signedMessage;
}
}
export default PGPSign;

View File

@ -92,7 +92,7 @@ class ParseEthernetFrame extends Operation {
const packetData = input.slice(offset);
if (outputFormat === "Packet data") {
return Utils.byteArrayToChars(packetData);
return Utils.escapeHtml(Utils.byteArrayToChars(packetData));
} else if (outputFormat === "Packet data (hex)") {
return toHex(packetData);
} else if (outputFormat === "Text output") {

View File

@ -138,7 +138,7 @@ class ParseIPv4Header extends Operation {
} else if (outputFormat === "Data (hex)") {
return toHex(data);
} else if (outputFormat === "Data (raw)") {
return Utils.byteArrayToChars(data);
return Utils.escapeHtml(Utils.byteArrayToChars(data));
}
}

View File

@ -6,7 +6,7 @@
import Operation from "../Operation.mjs";
import OperationError from "../errors/OperationError.mjs";
import BSON from "bson";
import { ObjectId } from "bson";
/**
* Parse ObjectID timestamp operation
@ -35,7 +35,7 @@ class ParseObjectIDTimestamp extends Operation {
*/
run(input, args) {
try {
const objectId = new BSON.ObjectID(input);
const objectId = new ObjectId(input);
return objectId.getTimestamp().toISOString();
} catch (err) {
throw new OperationError(err);

View File

@ -15,6 +15,20 @@ import Utils from "../Utils.mjs";
const d3 = d3temp.default ? d3temp.default : d3temp;
const nodom = nodomtemp.default ? nodomtemp.default: nodomtemp;
/**
* Removes D3's internal bound data from a nodom tree before serialization.
* nodom serializes enumerable expando properties such as __data__ as attributes,
* so leaving them on attacker-controlled values can create executable markup.
*
* @param {Object} node
*/
function clearD3BoundData(node) {
delete node.__data__;
if (!node.childNodes) return;
node.childNodes.forEach(clearD3BoundData);
}
/**
* Series chart operation
*/
@ -222,6 +236,8 @@ class SeriesChart extends Operation {
.text(serie.name);
});
clearD3BoundData(svg.node());
return svg._groups[0][0].outerHTML;
}

View File

@ -77,84 +77,84 @@ class ShowBase64Offsets extends Operation {
staticSection = offset0.slice(0, -3);
offset0 = "<span data-toggle='tooltip' data-placement='top' title='" +
Utils.escapeHtml(fromBase64(staticSection, alphabet).slice(0, -2)) + "'>" +
staticSection + "</span>" +
"<span class='hl5'>" + offset0.substr(offset0.length - 3, 1) + "</span>" +
"<span class='hl3'>" + offset0.substr(offset0.length - 2) + "</span>";
Utils.escapeHtml(staticSection) + "</span>" +
"<span class='hl5'>" + Utils.escapeHtml(offset0.substr(offset0.length - 3, 1)) + "</span>" +
"<span class='hl3'>" + Utils.escapeHtml(offset0.substr(offset0.length - 2)) + "</span>";
} else if (len0 % 4 === 3) {
staticSection = offset0.slice(0, -2);
offset0 = "<span data-toggle='tooltip' data-placement='top' title='" +
Utils.escapeHtml(fromBase64(staticSection, alphabet).slice(0, -1)) + "'>" +
staticSection + "</span>" +
"<span class='hl5'>" + offset0.substr(offset0.length - 2, 1) + "</span>" +
"<span class='hl3'>" + offset0.substr(offset0.length - 1) + "</span>";
Utils.escapeHtml(staticSection) + "</span>" +
"<span class='hl5'>" + Utils.escapeHtml(offset0.substr(offset0.length - 2, 1)) + "</span>" +
"<span class='hl3'>" + Utils.escapeHtml(offset0.substr(offset0.length - 1)) + "</span>";
} else {
staticSection = offset0;
offset0 = "<span data-toggle='tooltip' data-placement='top' title='" +
Utils.escapeHtml(fromBase64(staticSection, alphabet)) + "'>" +
staticSection + "</span>";
Utils.escapeHtml(staticSection) + "</span>";
}
if (!showVariable) {
offset0 = staticSection;
offset0 = Utils.escapeHtml(staticSection);
}
// Highlight offset 1
padding = "<span class='hl3'>" + offset1.substr(0, 1) + "</span>" +
"<span class='hl5'>" + offset1.substr(1, 1) + "</span>";
padding = "<span class='hl3'>" + Utils.escapeHtml(offset1.substr(0, 1)) + "</span>" +
"<span class='hl5'>" + Utils.escapeHtml(offset1.substr(1, 1)) + "</span>";
offset1 = offset1.substr(2);
if (len1 % 4 === 2) {
staticSection = offset1.slice(0, -3);
offset1 = padding + "<span data-toggle='tooltip' data-placement='top' title='" +
Utils.escapeHtml(fromBase64("AA" + staticSection, alphabet).slice(1, -2)) + "'>" +
staticSection + "</span>" +
"<span class='hl5'>" + offset1.substr(offset1.length - 3, 1) + "</span>" +
"<span class='hl3'>" + offset1.substr(offset1.length - 2) + "</span>";
Utils.escapeHtml(staticSection) + "</span>" +
"<span class='hl5'>" + Utils.escapeHtml(offset1.substr(offset1.length - 3, 1)) + "</span>" +
"<span class='hl3'>" + Utils.escapeHtml(offset1.substr(offset1.length - 2)) + "</span>";
} else if (len1 % 4 === 3) {
staticSection = offset1.slice(0, -2);
offset1 = padding + "<span data-toggle='tooltip' data-placement='top' title='" +
Utils.escapeHtml(fromBase64("AA" + staticSection, alphabet).slice(1, -1)) + "'>" +
staticSection + "</span>" +
"<span class='hl5'>" + offset1.substr(offset1.length - 2, 1) + "</span>" +
"<span class='hl3'>" + offset1.substr(offset1.length - 1) + "</span>";
Utils.escapeHtml(staticSection) + "</span>" +
"<span class='hl5'>" + Utils.escapeHtml(offset1.substr(offset1.length - 2, 1)) + "</span>" +
"<span class='hl3'>" + Utils.escapeHtml(offset1.substr(offset1.length - 1)) + "</span>";
} else {
staticSection = offset1;
offset1 = padding + "<span data-toggle='tooltip' data-placement='top' title='" +
Utils.escapeHtml(fromBase64("AA" + staticSection, alphabet).slice(1)) + "'>" +
staticSection + "</span>";
Utils.escapeHtml(staticSection) + "</span>";
}
if (!showVariable) {
offset1 = staticSection;
offset1 = Utils.escapeHtml(staticSection);
}
// Highlight offset 2
padding = "<span class='hl3'>" + offset2.substr(0, 2) + "</span>" +
"<span class='hl5'>" + offset2.substr(2, 1) + "</span>";
padding = "<span class='hl3'>" + Utils.escapeHtml(offset2.substr(0, 2)) + "</span>" +
"<span class='hl5'>" + Utils.escapeHtml(offset2.substr(2, 1)) + "</span>";
offset2 = offset2.substr(3);
if (len2 % 4 === 2) {
staticSection = offset2.slice(0, -3);
offset2 = padding + "<span data-toggle='tooltip' data-placement='top' title='" +
Utils.escapeHtml(fromBase64("AAA" + staticSection, alphabet).slice(2, -2)) + "'>" +
staticSection + "</span>" +
"<span class='hl5'>" + offset2.substr(offset2.length - 3, 1) + "</span>" +
"<span class='hl3'>" + offset2.substr(offset2.length - 2) + "</span>";
Utils.escapeHtml(staticSection) + "</span>" +
"<span class='hl5'>" + Utils.escapeHtml(offset2.substr(offset2.length - 3, 1)) + "</span>" +
"<span class='hl3'>" + Utils.escapeHtml(offset2.substr(offset2.length - 2)) + "</span>";
} else if (len2 % 4 === 3) {
staticSection = offset2.slice(0, -2);
offset2 = padding + "<span data-toggle='tooltip' data-placement='top' title='" +
Utils.escapeHtml(fromBase64("AAA" + staticSection, alphabet).slice(2, -2)) + "'>" +
staticSection + "</span>" +
"<span class='hl5'>" + offset2.substr(offset2.length - 2, 1) + "</span>" +
"<span class='hl3'>" + offset2.substr(offset2.length - 1) + "</span>";
Utils.escapeHtml(staticSection) + "</span>" +
"<span class='hl5'>" + Utils.escapeHtml(offset2.substr(offset2.length - 2, 1)) + "</span>" +
"<span class='hl3'>" + Utils.escapeHtml(offset2.substr(offset2.length - 1)) + "</span>";
} else {
staticSection = offset2;
offset2 = padding + "<span data-toggle='tooltip' data-placement='top' title='" +
Utils.escapeHtml(fromBase64("AAA" + staticSection, alphabet).slice(2)) + "'>" +
staticSection + "</span>";
Utils.escapeHtml(staticSection) + "</span>";
}
if (!showVariable) {
offset2 = staticSection;
offset2 = Utils.escapeHtml(staticSection);
}
return (showVariable ? "Characters highlighted in <span class='hl5'>green</span> could change if the input is surrounded by more data." +

View File

@ -5,7 +5,7 @@
*/
import Operation from "../Operation.mjs";
import punycode from "punycode";
import punycode from "punycode.js";
/**
* To Punycode operation

View File

@ -0,0 +1,47 @@
/**
* @author 0xff1ce [github.com/0xff1ce]
* @copyright Crown Copyright 2024
* @license Apache-2.0
*/
import Operation from "../Operation.mjs";
/**
* Wrap operation
*/
class Wrap extends Operation {
/**
* Wrap constructor
*/
constructor() {
super();
this.name = "Wrap";
this.module = "Default";
this.description = "Wraps the input text at a specified number of characters per line.";
this.inputType = "string";
this.outputType = "string";
this.args = [
{
"name": "Line Width",
"type": "number",
"value": 64,
},
];
}
/**
* @param {string} input
* @param {Object[]} args
* @returns {string}
*/
run(input, args) {
if (!input) return ""; // Handle empty input
const lineWidth = args[0];
const regex = new RegExp(`.{1,${lineWidth}}`, "g");
return input.match(regex).join("\n");
}
}
export default Wrap;

View File

@ -88,16 +88,17 @@ class NodeRecipe {
* @param {NodeDish} dish
* @returns {NodeDish}
*/
execute(dish) {
return this.opList.reduce((prev, curr) => {
// CASE where opList item is op and args
async execute(dish) {
let prev = dish;
for (const curr of this.opList) {
if (Object.prototype.hasOwnProperty.call(curr, "op") &&
Object.prototype.hasOwnProperty.call(curr, "args")) {
return curr.op(prev, curr.args);
prev = await curr.op(prev, curr.args);
} else {
prev = await curr(prev);
}
// CASE opList item is just op.
return curr(prev);
}, dish);
}
return prev;
}
}

View File

@ -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";
@ -324,10 +324,10 @@ export function help(input) {
* @returns {NodeDish} of the result
* @throws {TypeError} if invalid recipe given.
*/
export function bake(input, recipeConfig) {
export async function bake(input, recipeConfig) {
const recipe = new NodeRecipe(recipeConfig);
const dish = ensureIsDish(input);
return recipe.execute(dish);
return await recipe.execute(dish);
}

View File

@ -42,6 +42,14 @@ class App {
this.progress = 0;
this.ingId = 0;
// stateChangeId increments on every statechange dispatch; bakeStateId records
// the stateChangeId captured when the most recent bake started. autoBake uses
// these to decide whether the output is genuinely stale, so a debounced
// autoBake firing shortly after a manual bake doesn't clobber the bake's
// hideStaleIndicator with a redundant showStaleIndicator.
this.stateChangeId = 0;
this.bakeStateId = -1;
this.appLoaded = false;
this.workerLoaded = false;
this.waitersLoaded = false;
@ -136,6 +144,9 @@ class App {
bake(step=false) {
if (this.baking) return;
// Record which state version this bake is covering.
this.bakeStateId = this.stateChangeId;
// Reset attemptHighlight flag
this.options.attemptHighlight = true;
@ -166,7 +177,10 @@ class App {
nums: [this.manager.tabs.getActiveTab("input")],
step: false
});
} else {
} else if (this.bakeStateId < this.stateChangeId) {
// Only show stale-indicator if the most recent bake didn't cover the
// current state. Without this guard, a debounced autoBake firing after
// a manual bake completed would re-show the indicator on fresh output.
this.manager.controls.showStaleIndicator();
}
}
@ -768,6 +782,10 @@ class App {
* @param {event} e
*/
stateChange(e) {
// Bump the state-change counter synchronously so a manual bake invoked between
// here and the debounced autoBake firing can record it via bakeStateId.
this.stateChangeId++;
debounce(function() {
this.progress = 0;
this.autoBake();

View File

@ -868,15 +868,15 @@
Be aware that the standalone version will never update itself, meaning it will not receive bug fixes or new features until you re-download newer versions manually.
</p>
<h6>CyberChef v<%= htmlWebpackPlugin.options.version %></h6>
<h6>CyberChef <%= htmlWebpackPlugin.options.version %></h6>
<ul>
<li>Build time: <%= htmlWebpackPlugin.options.compileTime %></li>
<li>The changelog for this version can be viewed <a href="https://github.com/gchq/CyberChef/blob/v<%= htmlWebpackPlugin.options.version %>/CHANGELOG.md">here</a></li>
<li>The changelog for this version can be viewed <a href="https://github.com/gchq/CyberChef/blob/v<%= htmlWebpackPlugin.options.latestReleaseVersion %>/CHANGELOG.md">here</a></li>
<li>&copy; Crown Copyright 2016-<%= htmlWebpackPlugin.options.compileYear %></li>
<li>Released under the Apache Licence, Version 2.0</li>
<li>SHA256 hash: DOWNLOAD_HASH_PLACEHOLDER</li>
</ul>
<a href="CyberChef_v<%= htmlWebpackPlugin.options.version %>.zip" download class="btn btn-outline-primary">Download ZIP file</a>
<a href="<%= htmlWebpackPlugin.options.downloadZipFilename %>" download class="btn btn-outline-primary">Download ZIP file</a>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">Ok</button>

View File

@ -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" };
/**

View File

@ -1,5 +1,5 @@
import sm from "sitemap";
import OperationConfig from "../../core/config/OperationConfig.json" assert { type: "json" };
import { SitemapStream, streamToPromise } from "sitemap";
import OperationConfig from "../../core/config/OperationConfig.json" with { type: "json" };
/**
* Generates an XML sitemap for all CyberChef operations and a number of recipes.
@ -11,7 +11,7 @@ import OperationConfig from "../../core/config/OperationConfig.json" assert { ty
const baseUrl = "https://gchq.github.io/CyberChef/";
const smStream = new sm.SitemapStream({});
const smStream = new SitemapStream({});
smStream.write({
url: baseUrl,
@ -28,6 +28,6 @@ for (const op in OperationConfig) {
}
smStream.end();
sm.streamToPromise(smStream).then(
streamToPromise(smStream).then(
(buffer) => console.log(buffer.toString()), // eslint-disable-line no-console
);

View File

@ -64,7 +64,7 @@ module.exports = {
testOp(browser, "BSON serialise", '{"a":"test"}', "\u0011\u0000\u0000\u0000\u0002a\u0000\u0005\u0000\u0000\u0000test\u0000\u0000");
// testOp(browser, "Bacon Cipher Decode", "test input", "test_output");
// testOp(browser, "Bacon Cipher Encode", "test input", "test_output");
testOp(browser, "Bcrypt", "test input", /^\$2a\$06\$.{53}$/, [6]);
testOp(browser, "Bcrypt", "test input", /^\$2b\$06\$.{53}$/, [6]);
testOp(browser, "Bcrypt compare", "test input", "Match: test input", ["$2a$05$FCfBSVX7OeRkK.9kQVFCiOYu9XtwtIbePqUiroD1lkASW9q5QClzG"]);
testOp(browser, "Bcrypt parse", "$2a$05$kXWtAIGB/R8VEzInoM5ocOTBtyc0m2YTIwFiBU/0XoW032f9QrkWW", /Rounds: 5/);
testOp(browser, "Bifid Cipher Decode", "qblb tfovy", "test input", ["pass"]);

View File

@ -51,14 +51,17 @@ function setInput(browser, input, type=true) {
*/
function bake(browser) {
browser
// Let any pending debounced inputChange/stateChange (~20ms each) fire so the
// worker has the latest input buffer before we ask it to bake.
.pause(50)
// Ensure we're not currently busy
.waitForElementNotVisible("#output-loader", 5000)
.waitForElementNotVisible("#output-loader", 10000)
.expect.element("#bake span").text.to.equal("BAKE!");
browser
.click("#bake")
.waitForElementNotVisible("#stale-indicator", 5000)
.waitForElementNotVisible("#output-loader", 5000);
.waitForElementNotVisible("#stale-indicator", 10000)
.waitForElementNotVisible("#output-loader", 10000);
}
/** @function

View File

@ -0,0 +1,31 @@
/**
* Polyfill for Node.js 22+ where globalThis.fetch is built-in but rejects
* bare filesystem paths. WASM libraries like argon2-browser call fetch() with
* an absolute path (e.g. "/path/to/argon2.wasm") expecting a browser-style
* fallback, but Node.js 22's fetch throws synchronously for non-URL strings.
*
* This wrapper intercepts such calls and serves the file via Node's fs module,
* returning a synthetic Response so the WASM module loads correctly.
*/
import { readFile } from "fs/promises";
if (globalThis.fetch) {
const originalFetch = globalThis.fetch;
globalThis.fetch = async function patchedFetch(url, options) {
const urlStr = typeof url === "string" ?
url :
url instanceof URL ?
url.href :
String(url);
// Intercept bare filesystem paths (absolute POSIX or Windows)
if (urlStr.startsWith("/") || /^[A-Za-z]:[/\\]/.test(urlStr)) {
const buffer = await readFile(urlStr);
return new Response(buffer, {
status: 200,
headers: { "Content-Type": "application/wasm" },
});
}
return originalFetch(url, options);
};
}

View File

@ -8,9 +8,9 @@
const assert = require("assert");
require("cyberchef").then(chef => {
require("cyberchef").then(async chef => {
const d = chef.bake("Testing, 1 2 3", [
const d = await chef.bake("Testing, 1 2 3", [
chef.toHex,
chef.reverse,
{

View File

@ -9,7 +9,7 @@ import assert from "assert";
import chef from "cyberchef";
import { bake, toHex, reverse, unique, multiply } from "cyberchef";
const a = bake("Testing, 1 2 3", [
const a = await bake("Testing, 1 2 3", [
toHex,
reverse,
{
@ -28,7 +28,7 @@ const a = bake("Testing, 1 2 3", [
assert.equal(a.value, "630957449041920");
const b = chef.bake("Testing, 1 2 3", [
const b = await chef.bake("Testing, 1 2 3", [
chef.toHex,
chef.reverse,
{

View File

@ -18,6 +18,7 @@ import {
import TestRegister from "../lib/TestRegister.mjs";
import "./tests/nodeApi.mjs";
import "./tests/operations.mjs";
import "./tests/PGP.mjs";
import "./tests/File.mjs";
import "./tests/Dish.mjs";
import "./tests/NodeDish.mjs";

View File

@ -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";

69
tests/node/tests/PGP.mjs Normal file
View File

@ -0,0 +1,69 @@
/**
* PGP node tests.
*
* @author C85297 [95289555+C85297@users.noreply.github.com]
* @copyright Crown Copyright 2026
* @license Apache-2.0
*/
import assert from "assert";
import kbpgp from "kbpgp";
import * as es6promisify from "es6-promisify";
import TestRegister from "../../lib/TestRegister.mjs";
import it from "../assertionHandler.mjs";
import GeneratePGPKeyPair from "../../../src/core/operations/GeneratePGPKeyPair.mjs";
const promisify = es6promisify.default ? es6promisify.default.promisify : es6promisify.promisify;
const PUBLIC_KEY_BLOCK = /-----BEGIN PGP PUBLIC KEY BLOCK-----[\s\S]*-----END PGP PUBLIC KEY BLOCK-----/;
/**
* Generate a PGP key pair and import the generated public key.
*
* @param {string} keyType
* @returns {Promise<Object>}
*/
async function generateAndImportPublicKey(keyType) {
const operation = new GeneratePGPKeyPair();
const generatedKeyPair = await operation.run("", [
keyType,
"",
"User",
"akb@notreal.gchq.gov.uk"
]);
const publicKey = generatedKeyPair.match(PUBLIC_KEY_BLOCK);
assert(publicKey, "Generated key pair should contain an ASCII-armoured public key");
return promisify(kbpgp.KeyManager.import_from_armored_pgp)({
armored: publicKey[0],
opts: {
"no_check_keys": true
}
});
}
TestRegister.addApiTests([
it("Generate PGP Key Pair: ECC keys should include ECDSA signing and ECDH encryption subkeys", async () => {
const publicKey = await generateAndImportPublicKey("ECC-256");
const subkeyAlgorithms = publicKey.subkeys.map(subkey => subkey.key.type);
assert.strictEqual(
publicKey.primary.key.type,
kbpgp.const.openpgp.public_key_algorithms.ECDSA,
"Generated ECC PGP primary key should use ECDSA"
);
assert(
subkeyAlgorithms.includes(kbpgp.const.openpgp.public_key_algorithms.ECDSA),
"Generated ECC PGP key should include an ECDSA signing subkey"
);
assert(
subkeyAlgorithms.includes(kbpgp.const.openpgp.public_key_algorithms.ECDH),
"Generated ECC PGP key should include an ECDH encryption subkey"
);
})
]);

View File

@ -170,77 +170,77 @@ TestRegister.addApiTests([
assert(chef.bake);
}),
it("chef.bake: should return NodeDish", () => {
const result = chef.bake("input", "to base 64");
it("chef.bake: should return NodeDish", async () => {
const result = await chef.bake("input", "to base 64");
assert(result instanceof NodeDish);
}),
it("chef.bake: should take an input and an op name and perform it", () => {
const result = chef.bake("some input", "to base 32");
it("chef.bake: should take an input and an op name and perform it", async () => {
const result = await chef.bake("some input", "to base 32");
assert.strictEqual(result.toString(), "ONXW2ZJANFXHA5LU");
}),
it("chef.bake: should complain if recipe isnt a valid object", () => {
assert.throws(() => chef.bake("some input", 3264), {
it("chef.bake: should complain if recipe isnt a valid object", async () => {
await assert.rejects(() => chef.bake("some input", 3264), {
name: "TypeError",
message: "Recipe can only contain function names or functions"
});
}),
it("chef.bake: Should complain if string op is invalid", () => {
assert.throws(() => chef.bake("some input", "not a valid operation"), {
it("chef.bake: Should complain if string op is invalid", async () => {
await assert.rejects(() => chef.bake("some input", "not a valid operation"), {
name: "TypeError",
message: "Couldn't find an operation with name 'not a valid operation'."
});
}),
it("chef.bake: Should take an input and an operation and perform it", () => {
const result = chef.bake("https://google.com/search?q=help", chef.parseURI);
it("chef.bake: Should take an input and an operation and perform it", async () => {
const result = await chef.bake("https://google.com/search?q=help", chef.parseURI);
assert.strictEqual(result.toString(), "Protocol:\thttps:\nHostname:\tgoogle.com\nPath name:\t/search\nArguments:\n\tq = help\n");
}),
it("chef.bake: Should complain if an invalid operation is inputted", () => {
assert.throws(() => chef.bake("https://google.com/search?q=help", () => {}), {
it("chef.bake: Should complain if an invalid operation is inputted", async () => {
await assert.rejects(() => chef.bake("https://google.com/search?q=help", () => {}), {
name: "TypeError",
message: "Inputted function not a Chef operation."
});
}),
it("chef.bake: accepts an array of operation names and performs them all in order", () => {
const result = chef.bake("https://google.com/search?q=that's a complicated question", ["URL encode", "URL decode", "Parse URI"]);
it("chef.bake: accepts an array of operation names and performs them all in order", async () => {
const result = await chef.bake("https://google.com/search?q=that's a complicated question", ["URL encode", "URL decode", "Parse URI"]);
assert.strictEqual(result.toString(), "Protocol:\thttps:\nHostname:\tgoogle.com\nPath name:\t/search\nArguments:\n\tq = that's a complicated question\n");
}),
it("chef.bake: forgiving with operation names", () =>{
const result = chef.bake("https://google.com/search?q=that's a complicated question", ["urlencode", "url decode", "parseURI"]);
it("chef.bake: forgiving with operation names", async () =>{
const result = await chef.bake("https://google.com/search?q=that's a complicated question", ["urlencode", "url decode", "parseURI"]);
assert.strictEqual(result.toString(), "Protocol:\thttps:\nHostname:\tgoogle.com\nPath name:\t/search\nArguments:\n\tq = that's a complicated question\n");
}),
it("chef.bake: forgiving with operation names", () =>{
const result = chef.bake("hello", ["to base 64"]);
it("chef.bake: forgiving with operation names", async () =>{
const result = await chef.bake("hello", ["to base 64"]);
assert.strictEqual(result.toString(), "aGVsbG8=");
}),
it("chef.bake: if recipe is empty array, return input as dish", () => {
const result = chef.bake("some input", []);
it("chef.bake: if recipe is empty array, return input as dish", async () => {
const result = await chef.bake("some input", []);
assert.strictEqual(result.toString(), "some input");
assert(result instanceof NodeDish, "Result is not instance of NodeDish");
}),
it("chef.bake: accepts an array of operations as recipe", () => {
const result = chef.bake("https://google.com/search?q=that's a complicated question", [chef.URLEncode, chef.URLDecode, chef.parseURI]);
it("chef.bake: accepts an array of operations as recipe", async () => {
const result = await chef.bake("https://google.com/search?q=that's a complicated question", [chef.URLEncode, chef.URLDecode, chef.parseURI]);
assert.strictEqual(result.toString(), "Protocol:\thttps:\nHostname:\tgoogle.com\nPath name:\t/search\nArguments:\n\tq = that's a complicated question\n");
}),
it("should complain if an invalid operation is inputted as part of array", () => {
assert.throws(() => chef.bake("something", [() => {}]), {
it("should complain if an invalid operation is inputted as part of array", async () => {
await assert.rejects(() => chef.bake("something", [() => {}]), {
name: "TypeError",
message: "Inputted function not a Chef operation."
});
}),
it("chef.bake: should take single JSON object describing op and args OBJ", () => {
const result = chef.bake("some input", {
it("chef.bake: should take single JSON object describing op and args OBJ", async () => {
const result = await chef.bake("some input", {
op: chef.toHex,
args: {
Delimiter: "Colon"
@ -249,23 +249,23 @@ TestRegister.addApiTests([
assert.strictEqual(result.toString(), "73:6f:6d:65:20:69:6e:70:75:74");
}),
it("chef.bake: should take single JSON object desribing op with optional args", () => {
const result = chef.bake("some input", {
it("chef.bake: should take single JSON object desribing op with optional args", async () => {
const result = await chef.bake("some input", {
op: chef.toHex,
});
assert.strictEqual(result.toString(), "73 6f 6d 65 20 69 6e 70 75 74");
}),
it("chef.bake: should take single JSON object describing op and args ARRAY", () => {
const result = chef.bake("some input", {
it("chef.bake: should take single JSON object describing op and args ARRAY", async () => {
const result = await chef.bake("some input", {
op: chef.toHex,
args: ["Colon"]
});
assert.strictEqual(result.toString(), "73:6f:6d:65:20:69:6e:70:75:74");
}),
it("chef.bake: should error if op in JSON is not chef op", () => {
assert.throws(() => chef.bake("some input", {
it("chef.bake: should error if op in JSON is not chef op", async () => {
await assert.rejects(() => chef.bake("some input", {
op: () => {},
args: ["Colon"],
}), {
@ -274,8 +274,8 @@ TestRegister.addApiTests([
});
}),
it("chef.bake: should take multiple ops in JSON object form, some ops by string", () => {
const result = chef.bake("some input", [
it("chef.bake: should take multiple ops in JSON object form, some ops by string", async () => {
const result = await chef.bake("some input", [
{
op: chef.toHex,
args: ["Colon"]
@ -290,8 +290,8 @@ TestRegister.addApiTests([
assert.strictEqual(result.toString(), "67;63;72;66;146;72;66;144;72;66;65;72;62;60;72;66;71;72;66;145;72;67;60;72;67;65;72;67;64");
}),
it("chef.bake: should take multiple ops in JSON object form, some without args", () => {
const result = chef.bake("some input", [
it("chef.bake: should take multiple ops in JSON object form, some without args", async () => {
const result = await chef.bake("some input", [
{
op: chef.toHex,
},
@ -305,8 +305,8 @@ TestRegister.addApiTests([
assert.strictEqual(result.toString(), "67;63;40;66;146;40;66;144;40;66;65;40;62;60;40;66;71;40;66;145;40;67;60;40;67;65;40;67;64");
}),
it("chef.bake: should handle op with multiple args", () => {
const result = chef.bake("some input", {
it("chef.bake: should handle op with multiple args", async () => {
const result = await chef.bake("some input", {
op: "to morse code",
args: {
formatOptions: "Dash/Dot",
@ -317,13 +317,13 @@ TestRegister.addApiTests([
assert.strictEqual(result.toString(), "DotDotDot\\DashDashDash\\DashDash\\Dot,DotDot\\DashDot\\DotDashDashDot\\DotDotDash\\Dash");
}),
it("chef.bake: should take compact JSON format from Chef Website as recipe", () => {
const result = chef.bake("some input", [{"op": "To Morse Code", "args": ["Dash/Dot", "Backslash", "Comma"]}, {"op": "Hex to PEM", "args": ["SOMETHING"]}, {"op": "To Snake case", "args": [false]}]);
it("chef.bake: should take compact JSON format from Chef Website as recipe", async () => {
const result = await chef.bake("some input", [{"op": "To Morse Code", "args": ["Dash/Dot", "Backslash", "Comma"]}, {"op": "Hex to PEM", "args": ["SOMETHING"]}, {"op": "To Snake case", "args": [false]}]);
assert.strictEqual(result.toString(), "begin_something_anananaaaaak_da_aaak_da_aaaaananaaaaaaan_da_aaaaaaanan_da_aaak_end_something");
}),
it("chef.bake: should accept Clean JSON format from Chef website as recipe", () => {
const result = chef.bake("some input", [
it("chef.bake: should accept Clean JSON format from Chef website as recipe", async () => {
const result = await chef.bake("some input", [
{ "op": "To Morse Code",
"args": ["Dash/Dot", "Backslash", "Comma"] },
{ "op": "Hex to PEM",
@ -334,8 +334,8 @@ TestRegister.addApiTests([
assert.strictEqual(result.toString(), "begin_something_anananaaaaak_da_aaak_da_aaaaananaaaaaaan_da_aaaaaaanan_da_aaak_end_something");
}),
it("chef.bake: should accept Clean JSON format from Chef website - args optional", () => {
const result = chef.bake("some input", [
it("chef.bake: should accept Clean JSON format from Chef website - args optional", async () => {
const result = await chef.bake("some input", [
{ "op": "To Morse Code" },
{ "op": "Hex to PEM",
"args": ["SOMETHING"] },
@ -345,31 +345,28 @@ TestRegister.addApiTests([
assert.strictEqual(result.toString(), "begin_something_aaaaaaaaaaaaaa_end_something");
}),
it("chef.bake: should accept operation names from Chef Website which contain forward slash", () => {
const result = chef.bake("I'll have the test salmon", [
it("chef.bake: should accept operation names from Chef Website which contain forward slash", async () => {
const result = await chef.bake("I'll have the test salmon", [
{ "op": "Find / Replace",
"args": [{ "option": "Regex", "string": "test" }, "good", true, false, true, false]}
]);
assert.strictEqual(result.toString(), "I'll have the good salmon");
}),
it("chef.bake: should accept operation names from Chef Website which contain a hyphen", () => {
const result = chef.bake("I'll have the test salmon", [
it("chef.bake: should accept operation names from Chef Website which contain a hyphen", async () => {
const result = await chef.bake("I'll have the test salmon", [
{ "op": "Adler-32 Checksum",
"args": [] }
]);
assert.strictEqual(result.toString(), "6e4208f8");
}),
it("chef.bake: should accept operation names from Chef Website which contain a period", () => {
const result = chef.bake("30 13 02 01 05 16 0e 41 6e 79 62 6f 64 79 20 74 68 65 72 65 3f", [
it("chef.bake: should accept operation names from Chef Website which contain a period", async () => {
const result = await chef.bake("30 13 02 01 05 16 0e 41 6e 79 62 6f 64 79 20 74 68 65 72 65 3f", [
{ "op": "Parse ASN.1 hex string",
"args": [0, 32] }
]);
assert.strictEqual(result.toString(), `SEQUENCE
INTEGER 05
IA5String 'Anybody there?'
`);
assert.strictEqual(result.toString(), `SEQUENCE\n INTEGER 05\n IA5String 'Anybody there?'\n`);
}),
it("Excluded operations: throw a sensible error when you try and call one", () => {
@ -381,16 +378,16 @@ TestRegister.addApiTests([
}
}),
it("chef.bake: cannot accept flowControl operations in recipe", () => {
assert.throws(() => chef.bake("some input", "magic"), {
it("chef.bake: cannot accept flowControl operations in recipe", async () => {
await assert.rejects(() => chef.bake("some input", "magic"), {
name: "TypeError",
message: "flowControl operations like Magic are not currently allowed in recipes for chef.bake in the Node API"
});
assert.throws(() => chef.bake("some input", magic), {
await assert.rejects(() => chef.bake("some input", magic), {
name: "TypeError",
message: "flowControl operations like Magic are not currently allowed in recipes for chef.bake in the Node API"
});
assert.throws(() => chef.bake("some input", ["to base 64", "magic"]), {
await assert.rejects(() => chef.bake("some input", ["to base 64", "magic"]), {
name: "TypeError",
message: "flowControl operations like Magic are not currently allowed in recipes for chef.bake in the Node API"
});

View File

@ -136,8 +136,8 @@ Tiger-128`;
it("Bcrypt", async () => {
const result = await chef.bcrypt("Put a Sock In It");
const strResult = result.toString();
assert.equal(strResult.length, 60);
assert.equal(strResult.slice(0, 7), "$2a$10$");
assert.match(strResult, /^\$2b\$10\$[./A-Za-z0-9]{53}$/);
assert.equal(strResult.split("$").length, 4);
}),
it("bcryptCompare", async() => {

View File

@ -11,6 +11,7 @@
* @license Apache-2.0
*/
import "../lib/wasmFetchPolyfill.mjs";
import { setLongTestFailure, logTestReport } from "../lib/utils.mjs";
import TestRegister from "../lib/TestRegister.mjs";
@ -125,6 +126,7 @@ import "./tests/NormaliseUnicode.mjs";
import "./tests/NTLM.mjs";
import "./tests/OTP.mjs";
import "./tests/ParseEthernetFrame.mjs";
import "./tests/ParseIPv4Header.mjs";
import "./tests/ParseIPRange.mjs";
import "./tests/ParseObjectIDTimestamp.mjs";
import "./tests/ParseQRCode.mjs";
@ -180,6 +182,7 @@ import "./tests/TranslateDateTimeFormat.mjs";
import "./tests/Typex.mjs";
import "./tests/UnescapeString.mjs";
import "./tests/Unicode.mjs";
import "./tests/Wrap.mjs";
import "./tests/URLEncodeDecode.mjs";
import "./tests/RSA.mjs";
import "./tests/CBOREncode.mjs";

View File

@ -51,5 +51,23 @@ TestRegister.addTests([
{ "op": "BLAKE3",
"args": [8, "ThiskeyisexactlythirtytwoByteslo"] }
]
},
{
name: "BLAKE3: 16390 - test",
input: "test",
expectedMatch: /4878.{32760}555fe06b242738d5/,
recipeConfig: [
{ "op": "BLAKE3",
"args": [16390, ""] }
]
},
{
name: "BLAKE3: 16390 - key test",
input: "test",
expectedMatch: /a8d0.{32760}19ccd9b9726b46ae/,
recipeConfig: [
{ "op": "BLAKE3",
"args": [16390, "ThiskeyisexactlythirtytwoBytesLo"] }
]
}
]);

View File

@ -116,4 +116,15 @@ TestRegister.addTests([
},
],
},
{
name: "Show Base64 offsets: escapes static output",
input: "\x00\x10\x83\x10\x51\x87",
expectedOutput: "&lt;script&gt;\n&lt;AQmsBRk66\n&lt;ia1AEIM6",
recipeConfig: [
{
op: "Show Base64 offsets",
args: ["<script>ale(1)/.ABCDEFGHIJKLMNOPQRSTUVWXYZbdfghjkmnoquvwxyz023456", false, "Raw"],
},
],
},
]);

View File

@ -41,6 +41,17 @@ TestRegister.addTests([
}
],
},
{
name: "Series chart escapes x-axis values in serialized SVG",
input: `s,x"><script>globalThis.seriesChartInjected=1</script><g a=",1`,
unexpectedMatch: /<script>|__data__=/,
recipeConfig: [
{
"op": "Series chart",
"args": ["Line feed", "Comma", "", 1, "red"]
}
],
},
{
name: "Heatmap chart",
input: "100 100\n200 200\n300 300\n400 400\n500 500",

View File

@ -10,138 +10,144 @@ import {ASCII_TEXT, UTF8_TEXT, ALL_BYTES} from "../../samples/Ciphers.mjs";
// RSA-1024
const ALICE_PRIVATE = `-----BEGIN PGP PRIVATE KEY BLOCK-----
Version: Keybase OpenPGP v2.0.77
Version: Keybase OpenPGP v2.1.17
Comment: https://keybase.io/crypto
xcEYBFsNaYsBBAC9rnmjTzLLBCey2gq9un+XXP089sP3AONhSivdJlJEEWjt999o
g8vM18TcEk1sxyItp/GLlE/T70NPFAvdVXKI0KDQZ9fm77JDKitl587npRaspOOX
L1yUVFGVr4YEPDLoAT4PJgwI3TsEBfLGeOZqBqd/stw/FKjrNZJLRYfjnQARAQAB
AAP9G3EGgAM74fXJQy1wUwqMMvsXrUjgs6IZQ0Cryo7PZVxExfNlCtsmZ42VGWbn
H071OY22eu8LWCn2nut+MUM6EnjDZ7e/u85eHd0r5fY/3Vl0lQCy53RDdEQ3w8vA
XcUSabxwqpubmtyC3jxIXmVH6rLLmSpGGX8IqHRTfNDwHTECAPsgeVy0qkT0kJq1
Aw8gthHO6c3m1NOcAPyTqSRLVspxRDB0LuYHnVxAN+dUHFYAfwPj+h+E6ROolqe4
IKtrls8CAMFcwisDUQXFQFmO2pkpgaQTkN9XjGqBhjY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yi9kseqVz+/wIJcseiI3e/o9XCRgbXtTJmgNsJW3fRIJnmMnuAJ/4ykL1G
x4i15bky1sW0pvoXAaCL0Y1BBACvg8WLxpdnvWWYHv9z/x9cDOxZG2j2/rjG2VnC
lDkZI4+/DM2NB9l/dDiUqiuaSipPHELW2zFHG9uvnVnB8lTwsJ8pnP2n4zWdxfqf
IkEm6mZ6yp+uNaLPO4RiqjwPirSNqharqUSxRYtIFwlcpoCQcW00B55vMiawZX2G
Eq/5/Q==
=HBWf
-----END PGP PRIVATE KEY BLOCK-----`;
const ALICE_PUBLIC = `-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: Keybase OpenPGP v2.0.77
Version: Keybase OpenPGP v2.1.17
Comment: https://keybase.io/crypto
xo0EWw1piwEEAL2ueaNPMssEJ7LaCr26f5dc/Tz2w/cA42FKK90mUkQRaO3332iD
y8zXxNwSTWzHIi2n8YuUT9PvQ08UC91VcojQoNBn1+bvskMqK2XnzuelFqyk45cv
XJRUUZWvhgQ8MugBPg8mDAjdOwQF8sZ45moGp3+y3D8UqOs1kktFh+OdABEBAAHN
AMK0BBMBCgAeBQJbDWmLAhsvAwsJBwMVCggCHgECF4ADFgIBAhkBAAoJEIQkZUjf
mOSF4+UD/AmZ7Nc5VpO0t+w4b8XtytxGFYHn3PhA1rI98b5aPkFCkDAJgDRTZ6mM
7fvpr3FYbxs8p/sGtuOHyW98RmAIvhuGGuaVkG10swFYY7Xh8i3I0ulWf8ncQxgm
St+xnDGLP/MeJMHVPgPP20ISfp0VRCY5INDnKB/ayb9JAfopXAuyzo0EWw1piwEE
AOXOJib0QIvuqKAZiN3Yol3xC9Wz5aXQyg7qCnnYHHrPIMgYvGrTjjvDFCwM5uxC
v38Qd6rJnzrRXTC1EiAia/b7f76Z0r4W+j6KdVCGpQnVQE6b//WdY5ys1xLAkNr4
xwNj42nrOIMGB1qV0XezJ4VBOMpMHlwE2WR27HOQakXDABEBAAHCwIMEGAEKAA8F
AlsNaYsFCQ8JnAACGy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Hs0BBADEJr0pscgaUine
6UW2M0zQ57UybQphUYv4xYeZwOG1NvNLK6jcxQ9NGIlhUhJ/hV4piYy4A4bt7/Vy
O+CgSDWXf7kc8YL1tve9k9KIMceAT60Wt7QnHSSooysH5zRtE/Zqzc9luD9iWNGU
dKSAveJ5tJoPBJBB8cAsqWr8ZqP5qQARAQABwsCDBBgBCgAPBQJqFx7NBQkDwmcA
AhsuAKgJEBt1IEsq342MnSAEGQEKAAYFAmoXHs0ACgkQjWbXIJgXR6SYaQP+PjA9
SI4z/bbROkoNv73VCWM4o9r0DMASHK2Dyd71vOoOFjM/GtpGgQvjAKB82Db7+wsG
T6V6bxpvY1sMOxCjphsLs2u2IvZLHqlc/v8CCXLHoiN3v6PVwkYG17UyZoDbCVt3
0SCZ5jJ7gCf+MpC9RseIteW5MtbFtKb6FwGgi9GNQQQAr4PFi8aXZ71lmB7/c/8f
XAzsWRto9v64xtlZwpQ5GSOPvwzNjQfZf3Q4lKormkoqTxxC1tsxRxvbr51ZwfJU
8LCfKZz9p+M1ncX6nyJBJupmesqfrjWizzuEYqo8D4q0jaoWq6lEsUWLSBcJXKaA
kHFtNAeebzImsGV9hhKv+f0=
=IODM
-----END PGP PUBLIC KEY BLOCK-----`;
// ECC-384
const BOB_PRIVATE = `-----BEGIN PGP PRIVATE KEY BLOCK-----
Version: Keybase OpenPGP v2.0.77
Version: Keybase OpenPGP v2.1.17
Comment: https://keybase.io/crypto
xcAABFsNafYBAYDHiv+tCi4267xI6iTmBrhOKdNbKLWIYMG1OoE1f9qpT+nAVKFR
zUAFXKqQjqMDESkAEQEAAQABewd7cLkIQHGKly8PE+P0h7fV7X5bJqwZiqDwC8DU
38vCUO/KtkZO3jEQYA1U9DsNDQDA73KCr3K1tSX1afeWzb8vVBY4ZzXocKb9AMDV
Vk17t1N4nClMfqpGIDELtYBMiiCDyJ0AwLsnQb9cE+g1MZETtNDYXXxilkO/4CP9
8j4HzQDCZAQTAQoAHgUCWw1p9gIbLwMLCQcDFQ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==
=XC/n
-----END PGP PRIVATE KEY BLOCK-----`;
const BOB_PUBLIC = `-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: Keybase OpenPGP v2.0.77
Version: Keybase OpenPGP v2.1.17
Comment: https://keybase.io/crypto
xj0EWw1p9gEBgMeK/60KLjbrvEjqJOYGuE4p01sotYhgwbU6gTV/2qlP6cBUoVHN
QAVcqpCOowMRKQARAQABzQDCZAQTAQoAHgUCWw1p9gIbLwMLCQcDFQoIAh4BAheA
AxYCAQIZAQAKCRCEcIHWt/IPg+sqAYC6goCyOCYD/DytOW3I2cb12iDyFOSDsOx6
lrmIgLyP0dDnbJHbS9ar68yuHeDqP7jOLQRbDWn2AQEAwSE4qpbLQzSIUfwmfWXm
HneAuQIkEYawRxK/H1JkGxcAEQEAAcKTBBgBCgAPBQJbDWn2BQkPCZwAAhsuAEgJ
EIRwgda38g+DPSAEGQEKAAYFAlsNafYACgkQtTxxgeFhyu7aXAEAvg5QrZ+SHOHZ
VTeZ5eAAxaOg/qvJFQJOZJDG5Qu+8LJ9kwF+IfNXlAuBdJRVQDs6DqaUfmnDaC2C
xmGKPDDLCTMXe1D6z76E5lHXrXAfFAqDAchTzi0EWw1p9gEBAKM5X8jdrQeRdW0u
d0KtYVyOYvOKb09fwSlhRXfIbb8BABEBAAHCkwQYAQoADwUCWw1p9gUJA8JnAAIb
LgBICRCEcIHWt/IPgz0gBBkBCgAGBQJbDWn2AAoJEDQbWqFc+la701QA/iw9Ot1a
1O75Se8UMLTLp+BtxVvkSoG+0bMMPAdZrevBeXUBgJvHLcRAsxDJsjvI0pIzi5Bu
rvMy0FhZvTAWanHZrehFA39XQP98bv8ufahBm9I+MA==
=K9ht
xm8EahclbRMFK4EEACIDAwSvC1SlbUU7/QJFldLQGfAeyhu0mRvTIcxzANM9SdkI
dS2ArnVOZCB7cnfj5AF1nAjphKCv+01LAkGpCF6dUrvDwDeicMaq+E1OPVc+G0bH
O4qQwJgyRLV/GNUZ0ASSmNbNAMKWBBMTCgAeBQJqFyVtAhsvAwsJBwMVCggCHgEC
F4ADFgIBAhkBAAoJEF3faKPz6pIn7LQBfijD9cQAg8gKrKGY85jnQ9N/q6mh5NxA
zuyffKgPoN5WlI/28dtSDPBSTRCRyrPU6QGA/C6RwBh5g7gSmQwmSmmyEmr8QDrq
BBzjrvRpRpPvC4H7Ty1txGFH/0e5uJhiKtVMzlIEahclbRMIKoZIzj0DAQcCAwRn
9Bq5GWBB/klNeZZDI2HB53WqsGGxfiT4FFXOmYkGA5GmNrqHavp/Nh6Da87Aryic
cwvbqZvKszsBRy/gu1L6wsAnBBgTCgAPBQJqFyVtBQkPCZwAAhsCAGoJEF3faKPz
6pInXyAEGRMKAAYFAmoXJW0ACgkQVQZtQ9p5kJtfDQD+Ns1eh7rEAXveFSOLhx7V
w/5kUWm8wVWbqWDK5tJTF5EA/2+3jIQfg+/pE+VkO/NuIGQ9bUqGmGuX0s14Tcjq
Dm9LNugBf27462A7iEkTab0nOQXtd6+L3PeHRUPUT1CFq+74M5GABr0wobJ5CCaQ
NxQH++IKvwF+MSD0JajEVgi99qzSQOTZe8UGArddSCIJuUxNwEzaxvT6DombpLJ2
O4yYklR/xwoJzlYEahclbRIIKoZIzj0DAQcCAwRjn9T4UunA8a8ZuWP31AJheebC
AcPFWBGxdkxFeX65heVpMipOZ97EczRkitfAmiwt7cREq6yhvZ42KMOcZHPIAwEK
CcKHBBgTCgAPBQJqFyVtBQkDwmcAAhsMAAoJEF3faKPz6pInX6wBfjCSncZmJEC1
Rm6MLdsnS6RgmOJ40cVqkDqv7SS7eZH/04UNtVpM8RwvueGAZj3irwF9G9zN0KUg
rSt1j9uilAOri4RGiIH9uwfVUVp0gS8xl4imlYZvx33cilkSsZP3FAjw
=BHOx
-----END PGP PUBLIC KEY BLOCK-----`;
TestRegister.addTests([
@ -205,29 +211,46 @@ TestRegister.addTests([
}
]
},
{
name: "PGP Sign/Verify: RSA, All bytes",
input: ALL_BYTES,
expectedMatch: /Signed by PGP key ID: 2ADF8D8C\nPGP fingerprint: 7afe93ff7614167c3fe831fe1b75204b2adf8d8c\nSigned on .*\n----------------------------------\n/,
recipeConfig: [
{
"op": "PGP Sign",
"args": [ALICE_PRIVATE, ""]
},
{
"op": "PGP Verify",
"args": [ALICE_PUBLIC]
}
]
},
{
name: "PGP Decrypt and Verify: UTF8, Alice -> Bob",
input: `-----BEGIN PGP MESSAGE-----
Version: Keybase OpenPGP v2.0.77
Version: Keybase OpenPGP v2.1.17
Comment: https://keybase.io/crypto
wTwDhHCB1rfyD4MBAX9ld8xGcf2v+X+pwINN0R0TvkWxNesKOQIKPV01AH8JG0J+
+yFqLXqDHgYSLANNamfSwQoBOTWuh/5V6gpiXVm2oLHPv997AtoD/kVQrqylF5Xo
HUsqPGtSgBA5WPX8tMoHKuqWxEy9FviLnIv73OZN0Ph70uo2E+QIv0Qx27znK0Jy
KDSERvcldgShmVbDP3Pxtxkfr9xa2gar5f0OPovOmKGsTGciQJqPkclRwzIXg12L
hyd2ElYOMf6vg/yOc06sX4Ih1Tn6JkYqMVJydykMv3g4Z8OXTfwrMLxwO1n3ZB/T
OLdhBdsnREnyCqntBVjMKoRTQhfwq48n7b6caZ+aCPISdDIyDKBpxEzXaNBeEY2V
GCqORM9WhsQ4A6pAx2SP694qH5vgOwrYrgeOU17oK++mzd1GyU2CXoFi73/PANJD
TdC3hGr+S4XeuqZ368QG1cBWhNybsOu5sM2YbArb71ZMYuLDp+VolJbEkVf4c/dD
pVEOaX39NVKe6HcpOiw+CFO6GEkQqCXNprWK6ivBHzkAlF2pjjqlS6qhWxFPicSD
+1ZKM1fmZu99bhTmdqE3MJx//QMu7mvlHaM85OQkWhWPBxGw/60GVBX9YtvUtfMS
IOE1W/Zqmqzq+4frwnzWwYv9/U1RwIs/qlFVnzliREOzW+om8EncSSd7fQ==
=fEAT
wX4DEY2FMRPYAl0SAgMEKY2yuB8s16oRWWhJ1RsxNhR8byKFUyFZvi0ETIORMYu+
kkLWgFlVjqPV9q2eVtuVK9f+S/OIm0pztImhq5ZNMDB8r7s0wX4YskSrWRpMKwRr
CtoNlPS3//fT3Ll4a2tn8guxyC7lAtmJ6nxZj+qpSZLSwQwBhFlgARdqlp4eTAhF
PRcqHVCqZYSTdjAyerLtfZDaswEwLgGxsshRSJ7BDHxg7NqRcdFkChrWT0s4JpnV
/Woq0xcApim1bpyHXG/tT4oM3hbjfpulb92gq2TUNdzb9lJGaKbLHl/0zkoBvHDE
pxtr021JXERB8MNDIIpDESpjCrZ20YCHNr/sBqVm0yM7YGrDLlV+n7oUgL4HK2FU
tehxUEt4rca81UesYu/Wul6mHh/7Ft4jJuZuf/w9fCWQ6z+9MAEOBXdzWUp5BCyF
ce1STpICAdtRHInJ9zR08qn0ahrwHsvHPFPVIQJDargD5MSqav/3LS2TYqKYYKHy
TUCxIWqA77Qk3rEaFX+eHxTW4BTlMPArA7ffywkgJAPzrLL+gEgtOLCv2RhNZevR
weglQRtcuh5N/F9fsmPfsi80R0//LpEeyFX6GueXDw81+AKG9pOTI71Ny8H4W0eA
B5dCiOFNHZKCZUlA6GFa04X/XgmfPzTPMtgizbT72/2kfwxJGZY4ngdMVLqfhnVA
nfyQLFrOF9giJqDEsjtPXJ0h20stMLMykPUIK0UUf9vPthE86ugCY1XcGQWsuB4U
jmdH1dqEUk29TaUz/97s
=Ah/0
-----END PGP MESSAGE-----
`,
expectedOutput: `Signed by PGP key ID: DF98E485
PGP fingerprint: e94e06dd0b3744a0e970de9d84246548df98e485
Signed on Tue, 29 May 2018 15:44:52 GMT
expectedOutput: `Signed by PGP key ID: 2ADF8D8C
PGP fingerprint: 7afe93ff7614167c3fe831fe1b75204b2adf8d8c
Signed on Wed, 27 May 2026 17:18:20 GMT
----------------------------------
${UTF8_TEXT}`,
recipeConfig: [
@ -238,19 +261,19 @@ ${UTF8_TEXT}`,
]
},
{
name: "PGP Decrypt: ASCII, Alice -> Bob",
name: "PGP Decrypt: ASCII, Alice",
input: `-----BEGIN PGP MESSAGE-----
Version: Keybase OpenPGP v2.0.77
Version: Keybase OpenPGP v2.1.17
Comment: https://keybase.io/crypto
wYwDPtlTQFIjCzoBBACSlbN7tmQVxR5ZD0rvCwXUkxO3RU8WgBkkmrTCUs9a+xrS
F9HuKcpX/N6XrwTXyuX3BN2tGys4zd6nHV8jYqBoIyWJsWe3viTa1dh/x4183+GP
fP61gizi3pj0gi2vfGnMhnThbdiO32PVKAeHLHBK+r3XlXZ0kzZCQKRgd55yr9Kk
Aa4SR+qpvtdobkDzbnbhcPLR6CQ8TMjTiNXEpgTc1i0JcP8jaMVFzBt8qgmDMdqU
H2qMY1O7hezH3fp+EZzCAccJMtK7VPk13WAgMRH22HirG4aK1i75IVOtjBgObzDh
8zKua7QLi6wJD/AtQ+D3/NgVpzoXwdoLvTjEcAyy+YWNWkJF/jvx3XV1Q/Fz7sHJ
/bspORYvbi591S4U0m4pikwiOZk=
=AVb/
wYwDOfwkCKoimvoBA/98ONH8b+HoaDOVLhtF+9Pz5Sk/NZ43htOpm/3+b2B81GKZ
fcUfJYzItyt4X5Ps1ksfrArokG6blkIHPwZdcF7TJ9rWy/cC9S3zP/LF893xT9Z7
buWj1BjqfNy15WtGJnnQeCJVI4ya0cb3G/I/zAF/mT6R/JcldbJ1OTz9Zy5pZtKi
AQL7B8IscCxsx9jxc1ZR3swn+fr603BVP6/mXRRtKIa5DXZR5uMU9ChZ5AYQeHXe
ZzstlcSJWJvuF+uJy3Yc07ttzqQtOQGLh0iBeALK7BWqLsUBqKabZSHTZ4uFdkv9
86ZebPsfjVlhz4oFYenBUq1C15Zpvut28pHpgh2TLuXPHKkmTwI2Zz9LvVRjBW7A
rmDPrpTfy9MOrkjkY7zQSevi
=/Zwh
-----END PGP MESSAGE-----`,
expectedOutput: ASCII_TEXT,
recipeConfig: [
@ -262,21 +285,22 @@ H2qMY1O7hezH3fp+EZzCAccJMtK7VPk13WAgMRH22HirG4aK1i75IVOtjBgObzDh
},
{
name: "PGP Verify: ASCII, Alice",
input: `-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
input: `-----BEGIN PGP MESSAGE-----
Version: Keybase OpenPGP v2.1.17
Comment: https://keybase.io/crypto
A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.
-----BEGIN PGP SIGNATURE-----
iLMEAQEIAB0WIQRLbJy6MLpYOr9qojE+2VNAUiMLOgUCXRTsvwAKCRA+2VNAUiML
OuaHBADMMNtsuN92Fb+UrDimsv6TDQpbJhDkwp9kZdKYP5HAmSYAhXBG7N+YCMw+
v2FSpUu9jJiPBm1K1SEwLufQVexoRv6RsBNolRFB07sArau0s0DnIXUchCZWvyTP
1KsjBnDr84U2b11H58g4DlTT4gQrz30rFuHz9AGmPAtDHbSXIA==
=vnk/
-----END PGP SIGNATURE-----`,
expectedOutput: `Signed by PGP key ID: DF98E485
PGP fingerprint: e94e06dd0b3744a0e970de9d84246548df98e485
Signed on Thu, 27 Jun 2019 16:20:15 GMT
yMB1AnicO8LLzMDFaPlHhWOV0qxfjKcnljJkiTsIOiok5+fm5ucp5GYWlyRmpyqU
ZCSWKBSk5hfkpCrkggTKM1LzFEqKKjPz0hVK8hVSUosz0/MUivNzU0syQGJA/UC1
Jak5lQpp+fk5BUX5+WkKmcUgtaV5KalFqcUlmbmJJSCTUxWAGlLzSjNLKhWAimA6
wfqK9Q7NYWFg5GJgY2UCOYyBi1MA5tqzj1kYZqaFSuxmUvBnvvAzZOOuyT9vnT75
5GVzY2WfOB8H08l5vCZNbBUegsqPPh2aXPQgo8GglTPO2e7qY75g49mzDm+8POfH
nstrb2/93JHrXD5fbcbuVrsFJ01XWE2Xy7HtTgrasGG7ySLZqLStBj2r0n4dTX7g
MV1ETCdx6nqHA+4as4Oy9040BACRHYIP
=rkte
-----END PGP MESSAGE-----`,
expectedOutput: `Signed by PGP key ID: 2ADF8D8C
PGP fingerprint: 7afe93ff7614167c3fe831fe1b75204b2adf8d8c
Signed on Wed, 27 May 2026 19:03:45 GMT
----------------------------------
A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.`,
recipeConfig: [

View File

@ -41,5 +41,16 @@ TestRegister.addTests([
"args": ["Hex", "Text output"]
}
]
},
{
name: "Parse Ethernet frame escapes packet data HTML",
input: "000000000000ffffffffffff08003c696d67207372633d78206f6e6572726f723d616c6572742831293e3c7363726970743e616c6572742832293c2f7363726970743e",
expectedOutput: "&lt;img src=x onerror=alert(1)&gt;&lt;script&gt;alert(2)&lt;/script&gt;",
recipeConfig: [
{
"op": "Parse Ethernet frame",
"args": ["Hex", "Packet data"]
}
]
}
]);

View File

@ -0,0 +1,23 @@
/**
* Parse IPv4 header tests.
*
* @author C85297 [95289555+C85297@users.noreply.github.com]
* @copyright Crown Copyright 2026
* @license Apache-2.0
*/
import TestRegister from "../../lib/TestRegister.mjs";
TestRegister.addTests([
{
name: "Parse IPv4 header: Correctly formatted HTML output",
input: "45 00 00 3c 1c 46 40 00 40 06 b1 e6 c0 a8 00 01 c0 a8 00 02 3c 73 63 72 69 70 74 3e 61 6c 65 72 74 28 31 33 33 37 29 3c 2f 73 63 72 69 70 74 3e",
expectedOutput: "&lt;script&gt;alert(1337)&lt;/script&gt;",
recipeConfig: [
{
op: "Parse IPv4 header",
args: ["Hex", "Data (raw)"]
}
]
}
]);

View File

@ -0,0 +1,44 @@
/**
* @author 0xff1ce [github.com/0xff1ce]
* @copyright Crown Copyright 2024
* @license Apache-2.0
*/
import TestRegister from "../../lib/TestRegister.mjs";
TestRegister.addTests([
// Add tests specific to the Wrap operation
{
name: "Wrap text at 64 characters",
input: "A".repeat(128), // Generate an input string of 128 'A' characters
expectedOutput: "A".repeat(64) + "\n" + "A".repeat(64), // Expected output with a line break after 64 characters
recipeConfig: [
{
"op": "Wrap",
"args": [64]
},
],
},
{
name: "Wrap text at 32 characters",
input: "B".repeat(96), // Generate an input string of 96 'B' characters
expectedOutput: "B".repeat(32) + "\n" + "B".repeat(32) + "\n" + "B".repeat(32), // Expected output with line breaks after every 32 characters
recipeConfig: [
{
"op": "Wrap",
"args": [32]
},
],
},
{
name: "Wrap text at 10 characters",
input: "1234567890".repeat(10), // Generate an input string by repeating '1234567890'
expectedOutput: Array(10).fill("1234567890").join("\n"), // Expected output with line breaks every 10 characters
recipeConfig: [
{
"op": "Wrap",
"args": [10]
},
],
}
]);