Merge branch 'master' into master
This commit is contained in:
commit
023d11c371
@ -3,7 +3,7 @@
|
|||||||
{
|
{
|
||||||
"name": "CyberChef",
|
"name": "CyberChef",
|
||||||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
|
// 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 to add to the dev container. More info: https://containers.dev/features.
|
||||||
"features": {
|
"features": {
|
||||||
|
|||||||
2
.github/workflows/master.yml
vendored
2
.github/workflows/master.yml
vendored
@ -21,7 +21,7 @@ jobs:
|
|||||||
- name: Set node version
|
- name: Set node version
|
||||||
uses: actions/setup-node@v6
|
uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version: 24
|
||||||
registry-url: "https://registry.npmjs.org"
|
registry-url: "https://registry.npmjs.org"
|
||||||
|
|
||||||
- name: Install
|
- name: Install
|
||||||
|
|||||||
2
.github/workflows/pull_requests.yml
vendored
2
.github/workflows/pull_requests.yml
vendored
@ -17,7 +17,7 @@ jobs:
|
|||||||
- name: Set node version
|
- name: Set node version
|
||||||
uses: actions/setup-node@v6
|
uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version: 24
|
||||||
registry-url: "https://registry.npmjs.org"
|
registry-url: "https://registry.npmjs.org"
|
||||||
|
|
||||||
- name: Install
|
- name: Install
|
||||||
|
|||||||
10
.github/workflows/releases.yml
vendored
10
.github/workflows/releases.yml
vendored
@ -27,7 +27,7 @@ jobs:
|
|||||||
- name: Set node version
|
- name: Set node version
|
||||||
uses: actions/setup-node@v6
|
uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version: 24
|
||||||
registry-url: "https://registry.npmjs.org"
|
registry-url: "https://registry.npmjs.org"
|
||||||
|
|
||||||
- name: Install
|
- name: Install
|
||||||
@ -106,7 +106,7 @@ jobs:
|
|||||||
- name: Set node version
|
- name: Set node version
|
||||||
uses: actions/setup-node@v6
|
uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version: 24
|
||||||
registry-url: "https://registry.npmjs.org"
|
registry-url: "https://registry.npmjs.org"
|
||||||
|
|
||||||
- name: Install
|
- name: Install
|
||||||
@ -115,11 +115,5 @@ jobs:
|
|||||||
- name: Create machine generated files
|
- name: Create machine generated files
|
||||||
run: npm run node
|
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
|
- name: Publish to NPM
|
||||||
run: npm publish
|
run: npm publish
|
||||||
|
|||||||
79
CHANGELOG.md
79
CHANGELOG.md
@ -13,6 +13,46 @@ All major and minor version changes will be documented in this file. Details of
|
|||||||
|
|
||||||
## Details
|
## 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]
|
||||||
|
- [#927] added parity bit operation [@j83305] | [#1036]
|
||||||
|
- Feature md link blanks [@BjoernAkAManf] [@GCHQDeveloper581] | [#660]
|
||||||
|
- Accessibility - Add support for screenreaders in operations search [@mattnotmitt] | [#1862]
|
||||||
|
- Added metadata extraction for UUID strings. [@ko80240] | [#2322]
|
||||||
|
- chore (deps): bump the patch-updates group with 6 updates | [#2330]
|
||||||
|
- chore (deps): bump @codemirror/search from 6.6.0 to 6.7.0 | [#2331]
|
||||||
|
- (Feature) Improve CI [@GCHQDeveloper581] | [#2328]
|
||||||
|
- Update dependabot.yml [@GCHQDeveloper581] | [#2326]
|
||||||
|
- chore (deps): bump lodash, grunt-legacy-log and grunt-legacy-util | [#2327]
|
||||||
|
- chore (deps): bump the patch-updates group with 6 updates [@GCHQDeveloper581] | [#2323]
|
||||||
|
- chore (deps): bump autoprefixer from 10.4.27 to 10.5.0 | [#2324]
|
||||||
|
- chore (deps): bump dompurify from 3.3.3 to 3.4.0 | [#2321]
|
||||||
|
- chore (deps): bump follow-redirects from 1.15.11 to 1.16.0 | [#2320]
|
||||||
|
- Regular Expression operation email address regex: Support IPv4 domains [@C85297] [@GCHQDeveloper581] | [#2167]
|
||||||
|
- Rewriting fixCryptoApiImports and fixSnackbarMarkup to js to make it OS agnostic [@BigYellowHammer] | [#2298]
|
||||||
|
- chore (deps): bump basic-ftp from 5.2.1 to 5.2.2 | [#2317]
|
||||||
|
- chore (deps): bump axios from 1.13.6 to 1.15.0 | [#2316]
|
||||||
|
- chore (deps): bump webpack from 5.105.4 to 5.106.0 | [#2315]
|
||||||
|
- chore (deps): bump basic-ftp from 5.2.0 to 5.2.1 | [#2313]
|
||||||
|
- Update vulnerable dependencies [@GCHQDeveloper581] | [#2311]
|
||||||
|
|
||||||
### [10.23.0] - 2026-04-06
|
### [10.23.0] - 2026-04-06
|
||||||
- Properly escape HTML entities in sampleDelim to avoid XSS issue [@GCHQDeveloper581] | [#2307]
|
- Properly escape HTML entities in sampleDelim to avoid XSS issue [@GCHQDeveloper581] | [#2307]
|
||||||
- chore (deps): bump lodash from 4.17.23 to 4.18.1 | [#2304]
|
- chore (deps): bump lodash from 4.17.23 to 4.18.1 | [#2304]
|
||||||
@ -253,6 +293,8 @@ All major and minor version changes will be documented in this file. Details of
|
|||||||
- Added 'Levenshtein Distance' operation [@mikecat] | [#1498]
|
- Added 'Levenshtein Distance' operation [@mikecat] | [#1498]
|
||||||
- Added 'Swap case' operation [@mikecat] | [#1499]
|
- Added 'Swap case' operation [@mikecat] | [#1499]
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
## [10.0.0] - 2023-03-22
|
## [10.0.0] - 2023-03-22
|
||||||
- [Full details explained here](https://github.com/gchq/CyberChef/wiki/Character-encoding,-EOL-separators,-and-editor-features)
|
- [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]
|
- Status bars added to the Input and Output [@n1474335] | [#1405]
|
||||||
@ -596,6 +638,8 @@ All major and minor version changes will be documented in this file. Details of
|
|||||||
## [4.0.0] - 2016-11-28
|
## [4.0.0] - 2016-11-28
|
||||||
- Initial open source commit [@n1474335] | [b1d73a72](https://github.com/gchq/CyberChef/commit/b1d73a725dc7ab9fb7eb789296efd2b7e4b08306)
|
- 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.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
|
[10.22.0]: https://github.com/gchq/CyberChef/releases/tag/v10.22.0
|
||||||
[10.21.0]: https://github.com/gchq/CyberChef/releases/tag/v10.21.0
|
[10.21.0]: https://github.com/gchq/CyberChef/releases/tag/v10.21.0
|
||||||
@ -872,6 +916,13 @@ All major and minor version changes will be documented in this file. Details of
|
|||||||
[@aby-jo]: https://github.com/aby-jo
|
[@aby-jo]: https://github.com/aby-jo
|
||||||
[@atsiv1]: https://github.com/atsiv1
|
[@atsiv1]: https://github.com/atsiv1
|
||||||
[@fjh1997]: https://github.com/fjh1997
|
[@fjh1997]: https://github.com/fjh1997
|
||||||
|
[@j83305]: https://github.com/j83305
|
||||||
|
[@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
|
[8ad18b]: https://github.com/gchq/CyberChef/commit/8ad18bc7db6d9ff184ba3518686293a7685bf7b7
|
||||||
@ -1141,4 +1192,32 @@ All major and minor version changes will be documented in this file. Details of
|
|||||||
[#2194]: https://github.com/gchq/CyberChef/pull/2194
|
[#2194]: https://github.com/gchq/CyberChef/pull/2194
|
||||||
[#2193]: https://github.com/gchq/CyberChef/pull/2193
|
[#2193]: https://github.com/gchq/CyberChef/pull/2193
|
||||||
[#2192]: https://github.com/gchq/CyberChef/pull/2192
|
[#2192]: https://github.com/gchq/CyberChef/pull/2192
|
||||||
|
[#2333]: https://github.com/gchq/CyberChef/pull/2333
|
||||||
|
[#2335]: https://github.com/gchq/CyberChef/pull/2335
|
||||||
|
[#1036]: https://github.com/gchq/CyberChef/pull/1036
|
||||||
|
[#660]: https://github.com/gchq/CyberChef/pull/660
|
||||||
|
[#1862]: https://github.com/gchq/CyberChef/pull/1862
|
||||||
|
[#2322]: https://github.com/gchq/CyberChef/pull/2322
|
||||||
|
[#2330]: https://github.com/gchq/CyberChef/pull/2330
|
||||||
|
[#2331]: https://github.com/gchq/CyberChef/pull/2331
|
||||||
|
[#2328]: https://github.com/gchq/CyberChef/pull/2328
|
||||||
|
[#2326]: https://github.com/gchq/CyberChef/pull/2326
|
||||||
|
[#2327]: https://github.com/gchq/CyberChef/pull/2327
|
||||||
|
[#2323]: https://github.com/gchq/CyberChef/pull/2323
|
||||||
|
[#2324]: https://github.com/gchq/CyberChef/pull/2324
|
||||||
|
[#2321]: https://github.com/gchq/CyberChef/pull/2321
|
||||||
|
[#2320]: https://github.com/gchq/CyberChef/pull/2320
|
||||||
|
[#2167]: https://github.com/gchq/CyberChef/pull/2167
|
||||||
|
[#2298]: https://github.com/gchq/CyberChef/pull/2298
|
||||||
|
[#2317]: https://github.com/gchq/CyberChef/pull/2317
|
||||||
|
[#2316]: https://github.com/gchq/CyberChef/pull/2316
|
||||||
|
[#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
|
||||||
|
|
||||||
|
|||||||
@ -6,10 +6,13 @@ There are lots of opportunities to contribute to CyberChef. If you want ideas, t
|
|||||||
|
|
||||||
Before your contributions can be accepted, you must:
|
Before your contributions can be accepted, you must:
|
||||||
|
|
||||||
- Sign the [GCHQ Contributor Licence Agreement](https://cla-assistant.io/gchq/CyberChef)
|
- Fork the CyberChef repo
|
||||||
|
- Create a new branch within your fork for the changes
|
||||||
- Push your changes to your fork.
|
- Push your changes to your fork.
|
||||||
|
- Sign the [GCHQ Contributor Licence Agreement](https://cla-assistant.io/gchq/CyberChef)
|
||||||
- Submit a pull request.
|
- Submit a pull request.
|
||||||
|
|
||||||
|
Please note that we will ***reject*** pull requests from the master branch of your fork owing to the mess it makes of our own working repositories and the extra work entailed.
|
||||||
|
|
||||||
## Coding conventions
|
## Coding conventions
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
# Modifier --platform=$BUILDPLATFORM limits the platform to "BUILDPLATFORM" during buildx multi-platform builds
|
# 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
|
# 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
|
# 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 AS builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ RUN npm run build
|
|||||||
#########################################
|
#########################################
|
||||||
# Package static build files into nginx #
|
# Package static build files into nginx #
|
||||||
#########################################
|
#########################################
|
||||||
FROM nginx:stable-alpine AS cyberchef
|
FROM nginxinc/nginx-unprivileged:stable-alpine AS cyberchef
|
||||||
|
|
||||||
LABEL maintainer="GCHQ <oss@gchq.gov.uk>"
|
LABEL maintainer="GCHQ <oss@gchq.gov.uk>"
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPl
|
|||||||
const glob = require("glob");
|
const glob = require("glob");
|
||||||
const path = require("path");
|
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.
|
* Grunt configuration for building the app in various formats.
|
||||||
|
|||||||
@ -75,7 +75,7 @@ docker build --tag cyberchef --ulimit nofile=10000 .
|
|||||||
```
|
```
|
||||||
2. Run the docker container
|
2. Run the docker container
|
||||||
```bash
|
```bash
|
||||||
docker run -it -p 8080:80 cyberchef
|
docker run -it -p 8080:8080 cyberchef
|
||||||
```
|
```
|
||||||
3. Navigate to `http://localhost:8080` in your browser
|
3. Navigate to `http://localhost:8080` in your browser
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ docker run -it -p 8080:80 cyberchef
|
|||||||
If you prefer to skip the build process, you can use the pre-built image
|
If you prefer to skip the build process, you can use the pre-built image
|
||||||
|
|
||||||
```bash
|
```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.
|
Just like before, navigate to `http://localhost:8080` in your browser.
|
||||||
@ -159,7 +159,7 @@ CyberChef is built to support
|
|||||||
|
|
||||||
## Node.js 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
|
## Contributing
|
||||||
|
|||||||
@ -16,6 +16,9 @@ module.exports = function(api) {
|
|||||||
"regenerator": true
|
"regenerator": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
]
|
],
|
||||||
|
"generatorOpts": {
|
||||||
|
"importAttributesKeyword": "with"
|
||||||
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
4217
package-lock.json
generated
4217
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
36
package.json
36
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "cyberchef",
|
"name": "cyberchef",
|
||||||
"version": "10.23.0",
|
"version": "11.0.0",
|
||||||
"description": "The Cyber Swiss Army Knife for encryption, encoding, compression and data analysis.",
|
"description": "The Cyber Swiss Army Knife for encryption, encoding, compression and data analysis.",
|
||||||
"author": "n1474335 <n1474335@gmail.com>",
|
"author": "n1474335 <n1474335@gmail.com>",
|
||||||
"homepage": "https://gchq.github.io/CyberChef",
|
"homepage": "https://gchq.github.io/CyberChef",
|
||||||
@ -36,7 +36,7 @@
|
|||||||
"browserslist": [
|
"browserslist": [
|
||||||
"Chrome >= 50",
|
"Chrome >= 50",
|
||||||
"Firefox >= 38",
|
"Firefox >= 38",
|
||||||
"node >= 16"
|
"node >= 24"
|
||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/eslint-parser": "^7.28.6",
|
"@babel/eslint-parser": "^7.28.6",
|
||||||
@ -55,14 +55,14 @@
|
|||||||
"chromedriver": "^146.0.6",
|
"chromedriver": "^146.0.6",
|
||||||
"cli-progress": "^3.12.0",
|
"cli-progress": "^3.12.0",
|
||||||
"colors": "^1.4.0",
|
"colors": "^1.4.0",
|
||||||
"compression-webpack-plugin": "^11.1.0",
|
"compression-webpack-plugin": "^12.0.0",
|
||||||
"copy-webpack-plugin": "^13.0.1",
|
"copy-webpack-plugin": "^14.0.0",
|
||||||
"core-js": "^3.49.0",
|
"core-js": "^3.49.0",
|
||||||
"cspell": "^8.19.4",
|
"cspell": "^9.7.0",
|
||||||
"css-loader": "7.1.4",
|
"css-loader": "^7.1.4",
|
||||||
"eslint": "^9.39.4",
|
"eslint": "^9.39.4",
|
||||||
"eslint-plugin-jsdoc": "^50.8.0",
|
"eslint-plugin-jsdoc": "^50.8.0",
|
||||||
"globals": "^15.15.0",
|
"globals": "^17.4.0",
|
||||||
"grunt": "^1.6.2",
|
"grunt": "^1.6.2",
|
||||||
"grunt-chmod": "~1.1.1",
|
"grunt-chmod": "~1.1.1",
|
||||||
"grunt-concurrent": "^3.0.0",
|
"grunt-concurrent": "^3.0.0",
|
||||||
@ -87,8 +87,8 @@
|
|||||||
"sitemap": "^8.0.3",
|
"sitemap": "^8.0.3",
|
||||||
"terser": "^5.46.2",
|
"terser": "^5.46.2",
|
||||||
"webpack": "^5.106.2",
|
"webpack": "^5.106.2",
|
||||||
"webpack-bundle-analyzer": "^4.10.2",
|
"webpack-bundle-analyzer": "^5.3.0",
|
||||||
"webpack-dev-server": "5.0.4",
|
"webpack-dev-server": "^5.0.4",
|
||||||
"webpack-node-externals": "^3.0.0",
|
"webpack-node-externals": "^3.0.0",
|
||||||
"worker-loader": "^3.0.8"
|
"worker-loader": "^3.0.8"
|
||||||
},
|
},
|
||||||
@ -104,6 +104,7 @@
|
|||||||
"avsc": "^5.7.9",
|
"avsc": "^5.7.9",
|
||||||
"bcryptjs": "^2.4.3",
|
"bcryptjs": "^2.4.3",
|
||||||
"bignumber.js": "^9.3.1",
|
"bignumber.js": "^9.3.1",
|
||||||
|
"@noble/hashes": "2.2.0",
|
||||||
"blakejs": "^1.2.1",
|
"blakejs": "^1.2.1",
|
||||||
"bootstrap": "4.6.2",
|
"bootstrap": "4.6.2",
|
||||||
"bootstrap-colorpicker": "^3.4.0",
|
"bootstrap-colorpicker": "^3.4.0",
|
||||||
@ -132,7 +133,6 @@
|
|||||||
"flat": "^6.0.1",
|
"flat": "^6.0.1",
|
||||||
"geodesy": "1.1.3",
|
"geodesy": "1.1.3",
|
||||||
"handlebars": "^4.7.9",
|
"handlebars": "^4.7.9",
|
||||||
"hash-wasm": "^4.12.0",
|
|
||||||
"highlight.js": "^11.11.1",
|
"highlight.js": "^11.11.1",
|
||||||
"ieee754": "^1.2.1",
|
"ieee754": "^1.2.1",
|
||||||
"jimp": "1.6.0",
|
"jimp": "1.6.0",
|
||||||
@ -164,11 +164,12 @@
|
|||||||
"notepack.io": "^3.0.1",
|
"notepack.io": "^3.0.1",
|
||||||
"ntlm": "^0.1.3",
|
"ntlm": "^0.1.3",
|
||||||
"nwmatcher": "^1.4.4",
|
"nwmatcher": "^1.4.4",
|
||||||
"otpauth": "9.3.6",
|
"otpauth": "^9.5.0",
|
||||||
"path": "^0.12.7",
|
"path": "^0.12.7",
|
||||||
"popper.js": "^1.16.1",
|
"popper.js": "^1.16.1",
|
||||||
"process": "^0.11.10",
|
"process": "^0.11.10",
|
||||||
"protobufjs": "^7.5.5",
|
"protobufjs": "^7.5.5",
|
||||||
|
"punycode.js": "^2.3.1",
|
||||||
"qr-image": "^3.2.0",
|
"qr-image": "^3.2.0",
|
||||||
"reflect-metadata": "^0.2.2",
|
"reflect-metadata": "^0.2.2",
|
||||||
"rison": "^0.1.1",
|
"rison": "^0.1.1",
|
||||||
@ -184,7 +185,7 @@
|
|||||||
"unorm": "^1.6.0",
|
"unorm": "^1.6.0",
|
||||||
"url": "^0.11.4",
|
"url": "^0.11.4",
|
||||||
"utf8": "^3.0.0",
|
"utf8": "^3.0.0",
|
||||||
"uuid": "^13.0.0",
|
"uuid": "^14.0.0",
|
||||||
"vkbeautify": "^0.99.3",
|
"vkbeautify": "^0.99.3",
|
||||||
"xpath": "0.0.34",
|
"xpath": "0.0.34",
|
||||||
"xregexp": "^5.1.2",
|
"xregexp": "^5.1.2",
|
||||||
@ -194,18 +195,21 @@
|
|||||||
"start": "npx grunt dev",
|
"start": "npx grunt dev",
|
||||||
"build": "npx grunt prod",
|
"build": "npx grunt prod",
|
||||||
"node": "npx grunt node",
|
"node": "npx grunt node",
|
||||||
"repl": "node --experimental-modules --experimental-json-modules --experimental-specifier-resolution=node --no-experimental-fetch --no-warnings src/node/repl.mjs",
|
"repl": "node --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",
|
"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",
|
"testnodeconsumer": "npx grunt testnodeconsumer",
|
||||||
"testui": "npx grunt testui",
|
"testui": "npx grunt testui",
|
||||||
"testuidev": "npx nightwatch --env=dev",
|
"testuidev": "npx nightwatch --env=dev",
|
||||||
"lint": "npx grunt lint",
|
"lint": "npx grunt lint",
|
||||||
"lint:grammar": "cspell ./src",
|
"lint:grammar": "cspell ./src",
|
||||||
"postinstall": "npx grunt exec:fixCryptoApiImports && npx grunt exec:fixSnackbarMarkup",
|
"postinstall": "npx grunt exec:fixCryptoApiImports && npx grunt exec:fixSnackbarMarkup",
|
||||||
"newop": "node --experimental-modules --experimental-json-modules src/core/config/scripts/newOperation.mjs",
|
"newop": "node 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'\"",
|
"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\"",
|
"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`)'",
|
"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"
|
"setheapsize": "export NODE_OPTIONS=--max_old_space_size=2048"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=24 <25"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import Chef from "./Chef.mjs";
|
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 OpModules from "./config/modules/OpModules.mjs";
|
||||||
import loglevelMessagePrefix from "loglevel-message-prefix";
|
import loglevelMessagePrefix from "loglevel-message-prefix";
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
* @license Apache-2.0
|
* @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 OperationError from "./errors/OperationError.mjs";
|
||||||
import Operation from "./Operation.mjs";
|
import Operation from "./Operation.mjs";
|
||||||
import DishError from "./errors/DishError.mjs";
|
import DishError from "./errors/DishError.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 Utils, { isWorkerEnvironment } from "../Utils.mjs";
|
||||||
import Recipe from "../Recipe.mjs";
|
import Recipe from "../Recipe.mjs";
|
||||||
import Dish from "../Dish.mjs";
|
import Dish from "../Dish.mjs";
|
||||||
|
|||||||
@ -6,7 +6,10 @@
|
|||||||
|
|
||||||
import Operation from "../Operation.mjs";
|
import Operation from "../Operation.mjs";
|
||||||
import OperationError from "../errors/OperationError.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
|
* BLAKE3 operation
|
||||||
*/
|
*/
|
||||||
@ -44,13 +47,16 @@ class BLAKE3 extends Operation {
|
|||||||
run(input, args) {
|
run(input, args) {
|
||||||
const key = args[1];
|
const key = args[1];
|
||||||
const size = args[0];
|
const size = args[0];
|
||||||
// Check if the user want a key hash or not
|
const opts = { dkLen: size };
|
||||||
if (key === "") {
|
const inputBytes = new Uint8Array(Utils.strToArrayBuffer(input));
|
||||||
return blake3(input, size*8);
|
if (key !== "") {
|
||||||
} if (key.length !== 32) {
|
const keyBytes = new Uint8Array(Utils.strToArrayBuffer(key));
|
||||||
throw new OperationError("The key must be exactly 32 bytes long");
|
if (keyBytes.length !== 32) {
|
||||||
|
throw new OperationError("The key must be exactly 32 bytes long");
|
||||||
|
}
|
||||||
|
opts.key = keyBytes;
|
||||||
}
|
}
|
||||||
return blake3(input, size*8, key);
|
return bytesToHex(blake3(inputBytes, opts));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import Operation from "../Operation.mjs";
|
import Operation from "../Operation.mjs";
|
||||||
import punycode from "punycode";
|
import punycode from "punycode.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* From Punycode operation
|
* From Punycode operation
|
||||||
|
|||||||
@ -77,84 +77,84 @@ class ShowBase64Offsets extends Operation {
|
|||||||
staticSection = offset0.slice(0, -3);
|
staticSection = offset0.slice(0, -3);
|
||||||
offset0 = "<span data-toggle='tooltip' data-placement='top' title='" +
|
offset0 = "<span data-toggle='tooltip' data-placement='top' title='" +
|
||||||
Utils.escapeHtml(fromBase64(staticSection, alphabet).slice(0, -2)) + "'>" +
|
Utils.escapeHtml(fromBase64(staticSection, alphabet).slice(0, -2)) + "'>" +
|
||||||
staticSection + "</span>" +
|
Utils.escapeHtml(staticSection) + "</span>" +
|
||||||
"<span class='hl5'>" + offset0.substr(offset0.length - 3, 1) + "</span>" +
|
"<span class='hl5'>" + Utils.escapeHtml(offset0.substr(offset0.length - 3, 1)) + "</span>" +
|
||||||
"<span class='hl3'>" + offset0.substr(offset0.length - 2) + "</span>";
|
"<span class='hl3'>" + Utils.escapeHtml(offset0.substr(offset0.length - 2)) + "</span>";
|
||||||
} else if (len0 % 4 === 3) {
|
} else if (len0 % 4 === 3) {
|
||||||
staticSection = offset0.slice(0, -2);
|
staticSection = offset0.slice(0, -2);
|
||||||
offset0 = "<span data-toggle='tooltip' data-placement='top' title='" +
|
offset0 = "<span data-toggle='tooltip' data-placement='top' title='" +
|
||||||
Utils.escapeHtml(fromBase64(staticSection, alphabet).slice(0, -1)) + "'>" +
|
Utils.escapeHtml(fromBase64(staticSection, alphabet).slice(0, -1)) + "'>" +
|
||||||
staticSection + "</span>" +
|
Utils.escapeHtml(staticSection) + "</span>" +
|
||||||
"<span class='hl5'>" + offset0.substr(offset0.length - 2, 1) + "</span>" +
|
"<span class='hl5'>" + Utils.escapeHtml(offset0.substr(offset0.length - 2, 1)) + "</span>" +
|
||||||
"<span class='hl3'>" + offset0.substr(offset0.length - 1) + "</span>";
|
"<span class='hl3'>" + Utils.escapeHtml(offset0.substr(offset0.length - 1)) + "</span>";
|
||||||
} else {
|
} else {
|
||||||
staticSection = offset0;
|
staticSection = offset0;
|
||||||
offset0 = "<span data-toggle='tooltip' data-placement='top' title='" +
|
offset0 = "<span data-toggle='tooltip' data-placement='top' title='" +
|
||||||
Utils.escapeHtml(fromBase64(staticSection, alphabet)) + "'>" +
|
Utils.escapeHtml(fromBase64(staticSection, alphabet)) + "'>" +
|
||||||
staticSection + "</span>";
|
Utils.escapeHtml(staticSection) + "</span>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!showVariable) {
|
if (!showVariable) {
|
||||||
offset0 = staticSection;
|
offset0 = Utils.escapeHtml(staticSection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Highlight offset 1
|
// Highlight offset 1
|
||||||
padding = "<span class='hl3'>" + offset1.substr(0, 1) + "</span>" +
|
padding = "<span class='hl3'>" + Utils.escapeHtml(offset1.substr(0, 1)) + "</span>" +
|
||||||
"<span class='hl5'>" + offset1.substr(1, 1) + "</span>";
|
"<span class='hl5'>" + Utils.escapeHtml(offset1.substr(1, 1)) + "</span>";
|
||||||
offset1 = offset1.substr(2);
|
offset1 = offset1.substr(2);
|
||||||
if (len1 % 4 === 2) {
|
if (len1 % 4 === 2) {
|
||||||
staticSection = offset1.slice(0, -3);
|
staticSection = offset1.slice(0, -3);
|
||||||
offset1 = padding + "<span data-toggle='tooltip' data-placement='top' title='" +
|
offset1 = padding + "<span data-toggle='tooltip' data-placement='top' title='" +
|
||||||
Utils.escapeHtml(fromBase64("AA" + staticSection, alphabet).slice(1, -2)) + "'>" +
|
Utils.escapeHtml(fromBase64("AA" + staticSection, alphabet).slice(1, -2)) + "'>" +
|
||||||
staticSection + "</span>" +
|
Utils.escapeHtml(staticSection) + "</span>" +
|
||||||
"<span class='hl5'>" + offset1.substr(offset1.length - 3, 1) + "</span>" +
|
"<span class='hl5'>" + Utils.escapeHtml(offset1.substr(offset1.length - 3, 1)) + "</span>" +
|
||||||
"<span class='hl3'>" + offset1.substr(offset1.length - 2) + "</span>";
|
"<span class='hl3'>" + Utils.escapeHtml(offset1.substr(offset1.length - 2)) + "</span>";
|
||||||
} else if (len1 % 4 === 3) {
|
} else if (len1 % 4 === 3) {
|
||||||
staticSection = offset1.slice(0, -2);
|
staticSection = offset1.slice(0, -2);
|
||||||
offset1 = padding + "<span data-toggle='tooltip' data-placement='top' title='" +
|
offset1 = padding + "<span data-toggle='tooltip' data-placement='top' title='" +
|
||||||
Utils.escapeHtml(fromBase64("AA" + staticSection, alphabet).slice(1, -1)) + "'>" +
|
Utils.escapeHtml(fromBase64("AA" + staticSection, alphabet).slice(1, -1)) + "'>" +
|
||||||
staticSection + "</span>" +
|
Utils.escapeHtml(staticSection) + "</span>" +
|
||||||
"<span class='hl5'>" + offset1.substr(offset1.length - 2, 1) + "</span>" +
|
"<span class='hl5'>" + Utils.escapeHtml(offset1.substr(offset1.length - 2, 1)) + "</span>" +
|
||||||
"<span class='hl3'>" + offset1.substr(offset1.length - 1) + "</span>";
|
"<span class='hl3'>" + Utils.escapeHtml(offset1.substr(offset1.length - 1)) + "</span>";
|
||||||
} else {
|
} else {
|
||||||
staticSection = offset1;
|
staticSection = offset1;
|
||||||
offset1 = padding + "<span data-toggle='tooltip' data-placement='top' title='" +
|
offset1 = padding + "<span data-toggle='tooltip' data-placement='top' title='" +
|
||||||
Utils.escapeHtml(fromBase64("AA" + staticSection, alphabet).slice(1)) + "'>" +
|
Utils.escapeHtml(fromBase64("AA" + staticSection, alphabet).slice(1)) + "'>" +
|
||||||
staticSection + "</span>";
|
Utils.escapeHtml(staticSection) + "</span>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!showVariable) {
|
if (!showVariable) {
|
||||||
offset1 = staticSection;
|
offset1 = Utils.escapeHtml(staticSection);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Highlight offset 2
|
// Highlight offset 2
|
||||||
padding = "<span class='hl3'>" + offset2.substr(0, 2) + "</span>" +
|
padding = "<span class='hl3'>" + Utils.escapeHtml(offset2.substr(0, 2)) + "</span>" +
|
||||||
"<span class='hl5'>" + offset2.substr(2, 1) + "</span>";
|
"<span class='hl5'>" + Utils.escapeHtml(offset2.substr(2, 1)) + "</span>";
|
||||||
offset2 = offset2.substr(3);
|
offset2 = offset2.substr(3);
|
||||||
if (len2 % 4 === 2) {
|
if (len2 % 4 === 2) {
|
||||||
staticSection = offset2.slice(0, -3);
|
staticSection = offset2.slice(0, -3);
|
||||||
offset2 = padding + "<span data-toggle='tooltip' data-placement='top' title='" +
|
offset2 = padding + "<span data-toggle='tooltip' data-placement='top' title='" +
|
||||||
Utils.escapeHtml(fromBase64("AAA" + staticSection, alphabet).slice(2, -2)) + "'>" +
|
Utils.escapeHtml(fromBase64("AAA" + staticSection, alphabet).slice(2, -2)) + "'>" +
|
||||||
staticSection + "</span>" +
|
Utils.escapeHtml(staticSection) + "</span>" +
|
||||||
"<span class='hl5'>" + offset2.substr(offset2.length - 3, 1) + "</span>" +
|
"<span class='hl5'>" + Utils.escapeHtml(offset2.substr(offset2.length - 3, 1)) + "</span>" +
|
||||||
"<span class='hl3'>" + offset2.substr(offset2.length - 2) + "</span>";
|
"<span class='hl3'>" + Utils.escapeHtml(offset2.substr(offset2.length - 2)) + "</span>";
|
||||||
} else if (len2 % 4 === 3) {
|
} else if (len2 % 4 === 3) {
|
||||||
staticSection = offset2.slice(0, -2);
|
staticSection = offset2.slice(0, -2);
|
||||||
offset2 = padding + "<span data-toggle='tooltip' data-placement='top' title='" +
|
offset2 = padding + "<span data-toggle='tooltip' data-placement='top' title='" +
|
||||||
Utils.escapeHtml(fromBase64("AAA" + staticSection, alphabet).slice(2, -2)) + "'>" +
|
Utils.escapeHtml(fromBase64("AAA" + staticSection, alphabet).slice(2, -2)) + "'>" +
|
||||||
staticSection + "</span>" +
|
Utils.escapeHtml(staticSection) + "</span>" +
|
||||||
"<span class='hl5'>" + offset2.substr(offset2.length - 2, 1) + "</span>" +
|
"<span class='hl5'>" + Utils.escapeHtml(offset2.substr(offset2.length - 2, 1)) + "</span>" +
|
||||||
"<span class='hl3'>" + offset2.substr(offset2.length - 1) + "</span>";
|
"<span class='hl3'>" + Utils.escapeHtml(offset2.substr(offset2.length - 1)) + "</span>";
|
||||||
} else {
|
} else {
|
||||||
staticSection = offset2;
|
staticSection = offset2;
|
||||||
offset2 = padding + "<span data-toggle='tooltip' data-placement='top' title='" +
|
offset2 = padding + "<span data-toggle='tooltip' data-placement='top' title='" +
|
||||||
Utils.escapeHtml(fromBase64("AAA" + staticSection, alphabet).slice(2)) + "'>" +
|
Utils.escapeHtml(fromBase64("AAA" + staticSection, alphabet).slice(2)) + "'>" +
|
||||||
staticSection + "</span>";
|
Utils.escapeHtml(staticSection) + "</span>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!showVariable) {
|
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." +
|
return (showVariable ? "Characters highlighted in <span class='hl5'>green</span> could change if the input is surrounded by more data." +
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import Operation from "../Operation.mjs";
|
import Operation from "../Operation.mjs";
|
||||||
import punycode from "punycode";
|
import punycode from "punycode.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To Punycode operation
|
* To Punycode operation
|
||||||
|
|||||||
@ -88,16 +88,17 @@ class NodeRecipe {
|
|||||||
* @param {NodeDish} dish
|
* @param {NodeDish} dish
|
||||||
* @returns {NodeDish}
|
* @returns {NodeDish}
|
||||||
*/
|
*/
|
||||||
execute(dish) {
|
async execute(dish) {
|
||||||
return this.opList.reduce((prev, curr) => {
|
let prev = dish;
|
||||||
// CASE where opList item is op and args
|
for (const curr of this.opList) {
|
||||||
if (Object.prototype.hasOwnProperty.call(curr, "op") &&
|
if (Object.prototype.hasOwnProperty.call(curr, "op") &&
|
||||||
Object.prototype.hasOwnProperty.call(curr, "args")) {
|
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);
|
return prev;
|
||||||
}, dish);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
import NodeDish from "./NodeDish.mjs";
|
import NodeDish from "./NodeDish.mjs";
|
||||||
import NodeRecipe from "./NodeRecipe.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 { sanitise, removeSubheadingsFromArray, sentenceToCamelCase } from "./apiUtils.mjs";
|
||||||
import ExcludedOperationError from "../core/errors/ExcludedOperationError.mjs";
|
import ExcludedOperationError from "../core/errors/ExcludedOperationError.mjs";
|
||||||
|
|
||||||
@ -324,10 +324,10 @@ export function help(input) {
|
|||||||
* @returns {NodeDish} of the result
|
* @returns {NodeDish} of the result
|
||||||
* @throws {TypeError} if invalid recipe given.
|
* @throws {TypeError} if invalid recipe given.
|
||||||
*/
|
*/
|
||||||
export function bake(input, recipeConfig) {
|
export async function bake(input, recipeConfig) {
|
||||||
const recipe = new NodeRecipe(recipeConfig);
|
const recipe = new NodeRecipe(recipeConfig);
|
||||||
const dish = ensureIsDish(input);
|
const dish = ensureIsDish(input);
|
||||||
return recipe.execute(dish);
|
return await recipe.execute(dish);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -17,8 +17,8 @@ import * as CanvasComponents from "../core/lib/CanvasComponents.mjs";
|
|||||||
|
|
||||||
// CyberChef
|
// CyberChef
|
||||||
import App from "./App.mjs";
|
import App from "./App.mjs";
|
||||||
import Categories from "../core/config/Categories.json" assert {type: "json"};
|
import Categories from "../core/config/Categories.json" with { type: "json" };
|
||||||
import OperationConfig from "../core/config/OperationConfig.json" assert {type: "json"};
|
import OperationConfig from "../core/config/OperationConfig.json" with { type: "json" };
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import sm from "sitemap";
|
import sm from "sitemap";
|
||||||
import OperationConfig from "../../core/config/OperationConfig.json" assert { type: "json" };
|
import OperationConfig from "../../core/config/OperationConfig.json" with { type: "json" };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates an XML sitemap for all CyberChef operations and a number of recipes.
|
* Generates an XML sitemap for all CyberChef operations and a number of recipes.
|
||||||
|
|||||||
31
tests/lib/wasmFetchPolyfill.mjs
Normal file
31
tests/lib/wasmFetchPolyfill.mjs
Normal 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);
|
||||||
|
};
|
||||||
|
}
|
||||||
@ -8,9 +8,9 @@
|
|||||||
|
|
||||||
const assert = require("assert");
|
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.toHex,
|
||||||
chef.reverse,
|
chef.reverse,
|
||||||
{
|
{
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import assert from "assert";
|
|||||||
import chef from "cyberchef";
|
import chef from "cyberchef";
|
||||||
import { bake, toHex, reverse, unique, multiply } 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,
|
toHex,
|
||||||
reverse,
|
reverse,
|
||||||
{
|
{
|
||||||
@ -28,7 +28,7 @@ const a = bake("Testing, 1 2 3", [
|
|||||||
|
|
||||||
assert.equal(a.value, "630957449041920");
|
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.toHex,
|
||||||
chef.reverse,
|
chef.reverse,
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import TestRegister from "../../lib/TestRegister.mjs";
|
import TestRegister from "../../lib/TestRegister.mjs";
|
||||||
import Categories from "../../../src/core/config/Categories.json" assert {type: "json"};
|
import Categories from "../../../src/core/config/Categories.json" with { type: "json" };
|
||||||
import OperationConfig from "../../../src/core/config/OperationConfig.json" assert {type: "json"};
|
import OperationConfig from "../../../src/core/config/OperationConfig.json" with { type: "json" };
|
||||||
import it from "../assertionHandler.mjs";
|
import it from "../assertionHandler.mjs";
|
||||||
import assert from "assert";
|
import assert from "assert";
|
||||||
|
|
||||||
|
|||||||
@ -170,77 +170,77 @@ TestRegister.addApiTests([
|
|||||||
assert(chef.bake);
|
assert(chef.bake);
|
||||||
}),
|
}),
|
||||||
|
|
||||||
it("chef.bake: should return NodeDish", () => {
|
it("chef.bake: should return NodeDish", async () => {
|
||||||
const result = chef.bake("input", "to base 64");
|
const result = await chef.bake("input", "to base 64");
|
||||||
assert(result instanceof NodeDish);
|
assert(result instanceof NodeDish);
|
||||||
}),
|
}),
|
||||||
|
|
||||||
it("chef.bake: should take an input and an op name and perform it", () => {
|
it("chef.bake: should take an input and an op name and perform it", async () => {
|
||||||
const result = chef.bake("some input", "to base 32");
|
const result = await chef.bake("some input", "to base 32");
|
||||||
assert.strictEqual(result.toString(), "ONXW2ZJANFXHA5LU");
|
assert.strictEqual(result.toString(), "ONXW2ZJANFXHA5LU");
|
||||||
}),
|
}),
|
||||||
|
|
||||||
it("chef.bake: should complain if recipe isnt a valid object", () => {
|
it("chef.bake: should complain if recipe isnt a valid object", async () => {
|
||||||
assert.throws(() => chef.bake("some input", 3264), {
|
await assert.rejects(() => chef.bake("some input", 3264), {
|
||||||
name: "TypeError",
|
name: "TypeError",
|
||||||
message: "Recipe can only contain function names or functions"
|
message: "Recipe can only contain function names or functions"
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
|
|
||||||
it("chef.bake: Should complain if string op is invalid", () => {
|
it("chef.bake: Should complain if string op is invalid", async () => {
|
||||||
assert.throws(() => chef.bake("some input", "not a valid operation"), {
|
await assert.rejects(() => chef.bake("some input", "not a valid operation"), {
|
||||||
name: "TypeError",
|
name: "TypeError",
|
||||||
message: "Couldn't find an operation with name 'not a valid operation'."
|
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", () => {
|
it("chef.bake: Should take an input and an operation and perform it", async () => {
|
||||||
const result = chef.bake("https://google.com/search?q=help", chef.parseURI);
|
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");
|
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", () => {
|
it("chef.bake: Should complain if an invalid operation is inputted", async () => {
|
||||||
assert.throws(() => chef.bake("https://google.com/search?q=help", () => {}), {
|
await assert.rejects(() => chef.bake("https://google.com/search?q=help", () => {}), {
|
||||||
name: "TypeError",
|
name: "TypeError",
|
||||||
message: "Inputted function not a Chef operation."
|
message: "Inputted function not a Chef operation."
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
|
|
||||||
it("chef.bake: accepts an array of operation names and performs them all in order", () => {
|
it("chef.bake: accepts an array of operation names and performs them all in order", async () => {
|
||||||
const result = chef.bake("https://google.com/search?q=that's a complicated question", ["URL encode", "URL decode", "Parse URI"]);
|
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");
|
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", () =>{
|
it("chef.bake: forgiving with operation names", async () =>{
|
||||||
const result = chef.bake("https://google.com/search?q=that's a complicated question", ["urlencode", "url decode", "parseURI"]);
|
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");
|
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", () =>{
|
it("chef.bake: forgiving with operation names", async () =>{
|
||||||
const result = chef.bake("hello", ["to base 64"]);
|
const result = await chef.bake("hello", ["to base 64"]);
|
||||||
assert.strictEqual(result.toString(), "aGVsbG8=");
|
assert.strictEqual(result.toString(), "aGVsbG8=");
|
||||||
}),
|
}),
|
||||||
|
|
||||||
it("chef.bake: if recipe is empty array, return input as dish", () => {
|
it("chef.bake: if recipe is empty array, return input as dish", async () => {
|
||||||
const result = chef.bake("some input", []);
|
const result = await chef.bake("some input", []);
|
||||||
assert.strictEqual(result.toString(), "some input");
|
assert.strictEqual(result.toString(), "some input");
|
||||||
assert(result instanceof NodeDish, "Result is not instance of NodeDish");
|
assert(result instanceof NodeDish, "Result is not instance of NodeDish");
|
||||||
}),
|
}),
|
||||||
|
|
||||||
it("chef.bake: accepts an array of operations as recipe", () => {
|
it("chef.bake: accepts an array of operations as recipe", async () => {
|
||||||
const result = chef.bake("https://google.com/search?q=that's a complicated question", [chef.URLEncode, chef.URLDecode, chef.parseURI]);
|
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");
|
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", () => {
|
it("should complain if an invalid operation is inputted as part of array", async () => {
|
||||||
assert.throws(() => chef.bake("something", [() => {}]), {
|
await assert.rejects(() => chef.bake("something", [() => {}]), {
|
||||||
name: "TypeError",
|
name: "TypeError",
|
||||||
message: "Inputted function not a Chef operation."
|
message: "Inputted function not a Chef operation."
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
|
|
||||||
it("chef.bake: should take single JSON object describing op and args OBJ", () => {
|
it("chef.bake: should take single JSON object describing op and args OBJ", async () => {
|
||||||
const result = chef.bake("some input", {
|
const result = await chef.bake("some input", {
|
||||||
op: chef.toHex,
|
op: chef.toHex,
|
||||||
args: {
|
args: {
|
||||||
Delimiter: "Colon"
|
Delimiter: "Colon"
|
||||||
@ -249,23 +249,23 @@ TestRegister.addApiTests([
|
|||||||
assert.strictEqual(result.toString(), "73:6f:6d:65:20:69:6e:70:75:74");
|
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", () => {
|
it("chef.bake: should take single JSON object desribing op with optional args", async () => {
|
||||||
const result = chef.bake("some input", {
|
const result = await chef.bake("some input", {
|
||||||
op: chef.toHex,
|
op: chef.toHex,
|
||||||
});
|
});
|
||||||
assert.strictEqual(result.toString(), "73 6f 6d 65 20 69 6e 70 75 74");
|
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", () => {
|
it("chef.bake: should take single JSON object describing op and args ARRAY", async () => {
|
||||||
const result = chef.bake("some input", {
|
const result = await chef.bake("some input", {
|
||||||
op: chef.toHex,
|
op: chef.toHex,
|
||||||
args: ["Colon"]
|
args: ["Colon"]
|
||||||
});
|
});
|
||||||
assert.strictEqual(result.toString(), "73:6f:6d:65:20:69:6e:70:75:74");
|
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", () => {
|
it("chef.bake: should error if op in JSON is not chef op", async () => {
|
||||||
assert.throws(() => chef.bake("some input", {
|
await assert.rejects(() => chef.bake("some input", {
|
||||||
op: () => {},
|
op: () => {},
|
||||||
args: ["Colon"],
|
args: ["Colon"],
|
||||||
}), {
|
}), {
|
||||||
@ -274,8 +274,8 @@ TestRegister.addApiTests([
|
|||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
|
|
||||||
it("chef.bake: should take multiple ops in JSON object form, some ops by string", () => {
|
it("chef.bake: should take multiple ops in JSON object form, some ops by string", async () => {
|
||||||
const result = chef.bake("some input", [
|
const result = await chef.bake("some input", [
|
||||||
{
|
{
|
||||||
op: chef.toHex,
|
op: chef.toHex,
|
||||||
args: ["Colon"]
|
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");
|
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", () => {
|
it("chef.bake: should take multiple ops in JSON object form, some without args", async () => {
|
||||||
const result = chef.bake("some input", [
|
const result = await chef.bake("some input", [
|
||||||
{
|
{
|
||||||
op: chef.toHex,
|
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");
|
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", () => {
|
it("chef.bake: should handle op with multiple args", async () => {
|
||||||
const result = chef.bake("some input", {
|
const result = await chef.bake("some input", {
|
||||||
op: "to morse code",
|
op: "to morse code",
|
||||||
args: {
|
args: {
|
||||||
formatOptions: "Dash/Dot",
|
formatOptions: "Dash/Dot",
|
||||||
@ -317,13 +317,13 @@ TestRegister.addApiTests([
|
|||||||
assert.strictEqual(result.toString(), "DotDotDot\\DashDashDash\\DashDash\\Dot,DotDot\\DashDot\\DotDashDashDot\\DotDotDash\\Dash");
|
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", () => {
|
it("chef.bake: should take compact JSON format from Chef Website as recipe", async () => {
|
||||||
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]}]);
|
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");
|
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", () => {
|
it("chef.bake: should accept Clean JSON format from Chef website as recipe", async () => {
|
||||||
const result = chef.bake("some input", [
|
const result = await chef.bake("some input", [
|
||||||
{ "op": "To Morse Code",
|
{ "op": "To Morse Code",
|
||||||
"args": ["Dash/Dot", "Backslash", "Comma"] },
|
"args": ["Dash/Dot", "Backslash", "Comma"] },
|
||||||
{ "op": "Hex to PEM",
|
{ "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");
|
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", () => {
|
it("chef.bake: should accept Clean JSON format from Chef website - args optional", async () => {
|
||||||
const result = chef.bake("some input", [
|
const result = await chef.bake("some input", [
|
||||||
{ "op": "To Morse Code" },
|
{ "op": "To Morse Code" },
|
||||||
{ "op": "Hex to PEM",
|
{ "op": "Hex to PEM",
|
||||||
"args": ["SOMETHING"] },
|
"args": ["SOMETHING"] },
|
||||||
@ -345,31 +345,28 @@ TestRegister.addApiTests([
|
|||||||
assert.strictEqual(result.toString(), "begin_something_aaaaaaaaaaaaaa_end_something");
|
assert.strictEqual(result.toString(), "begin_something_aaaaaaaaaaaaaa_end_something");
|
||||||
}),
|
}),
|
||||||
|
|
||||||
it("chef.bake: should accept operation names from Chef Website which contain forward slash", () => {
|
it("chef.bake: should accept operation names from Chef Website which contain forward slash", async () => {
|
||||||
const result = chef.bake("I'll have the test salmon", [
|
const result = await chef.bake("I'll have the test salmon", [
|
||||||
{ "op": "Find / Replace",
|
{ "op": "Find / Replace",
|
||||||
"args": [{ "option": "Regex", "string": "test" }, "good", true, false, true, false]}
|
"args": [{ "option": "Regex", "string": "test" }, "good", true, false, true, false]}
|
||||||
]);
|
]);
|
||||||
assert.strictEqual(result.toString(), "I'll have the good salmon");
|
assert.strictEqual(result.toString(), "I'll have the good salmon");
|
||||||
}),
|
}),
|
||||||
|
|
||||||
it("chef.bake: should accept operation names from Chef Website which contain a hyphen", () => {
|
it("chef.bake: should accept operation names from Chef Website which contain a hyphen", async () => {
|
||||||
const result = chef.bake("I'll have the test salmon", [
|
const result = await chef.bake("I'll have the test salmon", [
|
||||||
{ "op": "Adler-32 Checksum",
|
{ "op": "Adler-32 Checksum",
|
||||||
"args": [] }
|
"args": [] }
|
||||||
]);
|
]);
|
||||||
assert.strictEqual(result.toString(), "6e4208f8");
|
assert.strictEqual(result.toString(), "6e4208f8");
|
||||||
}),
|
}),
|
||||||
|
|
||||||
it("chef.bake: should accept operation names from Chef Website which contain a period", () => {
|
it("chef.bake: should accept operation names from Chef Website which contain a period", async () => {
|
||||||
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", [
|
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",
|
{ "op": "Parse ASN.1 hex string",
|
||||||
"args": [0, 32] }
|
"args": [0, 32] }
|
||||||
]);
|
]);
|
||||||
assert.strictEqual(result.toString(), `SEQUENCE
|
assert.strictEqual(result.toString(), `SEQUENCE\n INTEGER 05\n IA5String 'Anybody there?'\n`);
|
||||||
INTEGER 05
|
|
||||||
IA5String 'Anybody there?'
|
|
||||||
`);
|
|
||||||
}),
|
}),
|
||||||
|
|
||||||
it("Excluded operations: throw a sensible error when you try and call one", () => {
|
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", () => {
|
it("chef.bake: cannot accept flowControl operations in recipe", async () => {
|
||||||
assert.throws(() => chef.bake("some input", "magic"), {
|
await assert.rejects(() => chef.bake("some input", "magic"), {
|
||||||
name: "TypeError",
|
name: "TypeError",
|
||||||
message: "flowControl operations like Magic are not currently allowed in recipes for chef.bake in the Node API"
|
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",
|
name: "TypeError",
|
||||||
message: "flowControl operations like Magic are not currently allowed in recipes for chef.bake in the Node API"
|
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",
|
name: "TypeError",
|
||||||
message: "flowControl operations like Magic are not currently allowed in recipes for chef.bake in the Node API"
|
message: "flowControl operations like Magic are not currently allowed in recipes for chef.bake in the Node API"
|
||||||
});
|
});
|
||||||
|
|||||||
@ -11,6 +11,7 @@
|
|||||||
* @license Apache-2.0
|
* @license Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import "../lib/wasmFetchPolyfill.mjs";
|
||||||
import { setLongTestFailure, logTestReport } from "../lib/utils.mjs";
|
import { setLongTestFailure, logTestReport } from "../lib/utils.mjs";
|
||||||
|
|
||||||
import TestRegister from "../lib/TestRegister.mjs";
|
import TestRegister from "../lib/TestRegister.mjs";
|
||||||
@ -72,6 +73,7 @@ import "./tests/ExtractAudioMetadata.mjs";
|
|||||||
import "./tests/ExtractEmailAddresses.mjs";
|
import "./tests/ExtractEmailAddresses.mjs";
|
||||||
import "./tests/ExtractHashes.mjs";
|
import "./tests/ExtractHashes.mjs";
|
||||||
import "./tests/ExtractIPAddresses.mjs";
|
import "./tests/ExtractIPAddresses.mjs";
|
||||||
|
import "./tests/Fernet.mjs";
|
||||||
import "./tests/Float.mjs";
|
import "./tests/Float.mjs";
|
||||||
import "./tests/FileTree.mjs";
|
import "./tests/FileTree.mjs";
|
||||||
import "./tests/FletcherChecksum.mjs";
|
import "./tests/FletcherChecksum.mjs";
|
||||||
|
|||||||
@ -51,5 +51,23 @@ TestRegister.addTests([
|
|||||||
{ "op": "BLAKE3",
|
{ "op": "BLAKE3",
|
||||||
"args": [8, "ThiskeyisexactlythirtytwoByteslo"] }
|
"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"] }
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|||||||
@ -116,4 +116,15 @@ TestRegister.addTests([
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "Show Base64 offsets: escapes static output",
|
||||||
|
input: "\x00\x10\x83\x10\x51\x87",
|
||||||
|
expectedOutput: "<script>\n<AQmsBRk66\n<ia1AEIM6",
|
||||||
|
recipeConfig: [
|
||||||
|
{
|
||||||
|
op: "Show Base64 offsets",
|
||||||
|
args: ["<script>ale(1)/.ABCDEFGHIJKLMNOPQRSTUVWXYZbdfghjkmnoquvwxyz023456", false, "Raw"],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
]);
|
]);
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
* @copyright Karsten Silkenbäumer 2019
|
* @copyright Karsten Silkenbäumer 2019
|
||||||
* @license Apache-2.0
|
* @license Apache-2.0
|
||||||
*/
|
*/
|
||||||
import TestRegister from "../TestRegister";
|
import TestRegister from "../../lib/TestRegister.mjs";
|
||||||
|
|
||||||
TestRegister.addTests([
|
TestRegister.addTests([
|
||||||
{
|
{
|
||||||
@ -47,7 +47,7 @@ TestRegister.addTests([
|
|||||||
{
|
{
|
||||||
name: "Fernet Encrypt: no input",
|
name: "Fernet Encrypt: no input",
|
||||||
input: "",
|
input: "",
|
||||||
expectedMatch: /^gAAAAABce-[\w-]+={0,2}$/,
|
expectedMatch: /^gAAA[\w-]+={0,2}$/,
|
||||||
recipeConfig: [
|
recipeConfig: [
|
||||||
{
|
{
|
||||||
op: "Fernet Encrypt",
|
op: "Fernet Encrypt",
|
||||||
@ -69,12 +69,27 @@ TestRegister.addTests([
|
|||||||
{
|
{
|
||||||
name: "Fernet Encrypt: valid arguments",
|
name: "Fernet Encrypt: valid arguments",
|
||||||
input: "This is a secret message.\n",
|
input: "This is a secret message.\n",
|
||||||
expectedMatch: /^gAAAAABce-[\w-]+={0,2}$/,
|
expectedMatch: /^gAAA[\w-]+={0,2}$/,
|
||||||
recipeConfig: [
|
recipeConfig: [
|
||||||
{
|
{
|
||||||
op: "Fernet Encrypt",
|
op: "Fernet Encrypt",
|
||||||
args: ["MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI="]
|
args: ["MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI="]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Fernet Encrypt/Decrypt: round trip",
|
||||||
|
input: "This is a secret message.\n",
|
||||||
|
expectedOutput: "This is a secret message.\n",
|
||||||
|
recipeConfig: [
|
||||||
|
{
|
||||||
|
op: "Fernet Encrypt",
|
||||||
|
args: ["MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI="]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
op: "Fernet Decrypt",
|
||||||
|
args: ["MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI="]
|
||||||
|
},
|
||||||
|
],
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user