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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@ jobs:

- name: Install
run: |
export DETECT_CHROMEDRIVER_VERSION=true
npm install
npm run setheapsize

- name: Lint
run: npx grunt lint
run: npm run lint

- name: Unit Tests
run: |
Expand All @@ -40,20 +39,22 @@ jobs:

- name: Production Build
if: success()
run: npx grunt prod --msg=""
run: npm run build

- name: Generate sitemap
run: npx grunt exec:sitemap
run: npm run build:sitemap

- name: Install Playwright Browsers
if: success()
run: npx playwright install --with-deps chromium

- name: UI Tests
if: success()
run: |
sudo apt-get install xvfb
xvfb-run --server-args="-screen 0 1200x800x24" npx grunt testui
run: npm run testui

- name: Prepare for GitHub Pages
if: success()
run: npx grunt copy:ghPages
run: npm run build:ghpages

- name: Deploy to GitHub Pages
if: success() && github.ref == 'refs/heads/master'
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/pull_requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ jobs:

- name: Install
run: |
export DETECT_CHROMEDRIVER_VERSION=true
npm install
npm run setheapsize

- name: Lint
run: npx grunt lint
run: npm run lint

- name: Unit Tests
run: |
Expand All @@ -36,7 +35,7 @@ jobs:

- name: Production Build
if: success()
run: npx grunt prod
run: npm run build

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand All @@ -50,8 +49,11 @@ jobs:
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64

- name: Install Playwright Browsers
if: success()
run: npx playwright install --with-deps chromium

- name: UI Tests
if: success()
run: |
sudo apt-get install xvfb
xvfb-run --server-args="-screen 0 1200x800x24" npx grunt testui
run: npm run testui
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ COPY package.json .
COPY package-lock.json .

# Install dependencies
# --ignore-scripts prevents postinstall script (which runs grunt) as it depends on files other than package.json
# --ignore-scripts prevents postinstall script as it depends on files other than package.json
RUN npm ci --ignore-scripts

# Copy files needed for postinstall and build
COPY . .

# npm postinstall runs grunt, which depends on files other than package.json
RUN npm run postinstall
# Run postinstall to fix dependency issues
RUN node scripts/postinstall.mjs

# Build the app
RUN npm run build
Expand Down
107 changes: 99 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,102 @@
# CyberChef
# CyberChef (Modernized Fork)

[![](https://github.com/gchq/CyberChef/workflows/Master%20Build,%20Test%20&%20Deploy/badge.svg)](https://github.com/gchq/CyberChef/actions?query=workflow%3A%22Master+Build%2C+Test+%26+Deploy%22)
[![npm](https://img.shields.io/npm/v/cyberchef.svg)](https://www.npmjs.com/package/cyberchef)
[![](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/gchq/CyberChef/blob/master/LICENSE)
[![Gitter](https://badges.gitter.im/gchq/CyberChef.svg)](https://gitter.im/gchq/CyberChef?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

#### *The Cyber Swiss Army Knife - Modernized*

> This is a modernized fork of [GCHQ's CyberChef](https://github.com/gchq/CyberChef). The original project's tech stack dates back to 2016-2017. This fork upgrades the build system, replaces deprecated dependencies, removes jQuery, upgrades Bootstrap, modernizes testing, and fixes pre-existing Node 24 test failures -- all while keeping 100% operation compatibility.

---

## What Changed (Modernization Summary)

### Build System Overhaul
| Before | After |
|--------|-------|
| Grunt task runner (obsolete) | npm scripts + Node.js helper scripts |
| worker-loader (deprecated) | Native Webpack 5 `new Worker(new URL(...))` |
| Babel 7 + core-js polyfills | SWC via Rspack `builtin:swc-loader` |
| Webpack 5 only | Rspack configs added (5-23x faster builds) |
| Platform-specific `sed` postinstall hacks | Cross-platform Node.js `scripts/postinstall.mjs` |
| Chrome 50 / Firefox 38 targets (2015-2016) | Chrome 80 / Firefox 78 / Safari 14 / Node 18+ |
| `assert {type: "json"}` (broken on Node 24) | `with {type: "json"}` (Node 24 compatible) |

### Dependency Modernization
| Removed | Replaced With |
|---------|--------------|
| `crypto-js` (deprecated by maintainer) | Native RC4 implementation + `@noble/hashes` EVP KDF |
| `blakejs` | `@noble/hashes/blake2b` and `@noble/hashes/blake2s` (audited, zero-dep) |
| `lodash` (only 3 functions used) | Native `src/core/lib/CaseConvert.mjs` (~50 lines) |
| `moment-timezone` (web layer) | `date-fns` + `date-fns-tz` |
| `jquery` 3.7.1 | Native DOM APIs |
| `snackbarjs` + `arrive` | Custom `src/web/utils/Snackbar.mjs` (~60 lines) |
| `bootstrap-material-design` (unmaintained) | Removed (Bootstrap 5 handles styling) |
| `bootstrap-colorpicker` (jQuery-dependent) | Native `<input type="color">` |
| `popper.js` v1 | `@popperjs/core` v2 (via Bootstrap 5) |
| `bootstrap` 4.6.2 | `bootstrap` 5.3 |
| `nightwatch` + `chromedriver` | `@playwright/test` |

### New Dependencies Added
| Package | Purpose |
|---------|---------|
| `@noble/hashes` | Audited, zero-dependency crypto (MD5, SHA1/2/3, BLAKE2, HMAC, HKDF) |
| `@rspack/core` + `@rspack/cli` | Rust-based bundler, Webpack 5 compatible, 5-23x faster |
| `date-fns` + `date-fns-tz` | Modern date/time library (tree-shakeable, immutable) |
| `@popperjs/core` | Tooltip/popover positioning (Bootstrap 5 dependency) |
| `vitest` | Modern test runner (Vite-powered, Jest-compatible API) |
| `@playwright/test` | Cross-browser E2E testing (Chrome, Firefox, Safari) |
| `concurrently` | Run npm scripts in parallel |
| `rimraf` | Cross-platform `rm -rf` |
| `archiver` | Cross-platform zip creation |

### UI Modernization
- **Bootstrap 4 to 5**: 87 `data-toggle`/`data-target` attributes renamed to `data-bs-*`
- **jQuery removed**: 38 `$()` calls across 13 files replaced with native DOM + Bootstrap 5 JS API
- **All Bootstrap components** now use native API: `new bootstrap.Modal()`, `new bootstrap.Tooltip()`, `new bootstrap.Popover()`

### Testing Modernization
- **Vitest adapter** bridges existing `TestRegister.addTests()` format to Vitest `describe/it/expect`
- **Playwright E2E tests** replace Nightwatch (auto-wait, parallel execution, Chrome+Firefox+Safari)
- **Node 24 test fix**: 3 pre-existing test failures fixed (Base64 padding in Hex-to-PEM pipeline)
- **243/243 Node API tests passing**

### New Files Created
```
scripts/
buildStandalone.mjs # Cross-platform standalone HTML + ZIP + SHA256 (replaces Grunt copy/zip/hash)
listEntryModules.mjs # Module entry point discovery (replaces Grunt findModules)
listEntryModulesSync.cjs # CJS version for webpack/rspack configs
postinstall.mjs # Cross-platform dep fixes (replaces sed hacks)
prepareGhPages.mjs # GitHub Pages prep (replaces Grunt copy:ghPages)
testNodeConsumers.mjs # CJS/ESM consumer tests (replaces Grunt exec tasks)
watchConfig.mjs # File watcher for config regeneration

src/core/lib/
CaseConvert.mjs # Native camelCase/kebabCase/snakeCase (replaces lodash)
RC4.mjs # Pure JS RC4 stream cipher (replaces crypto-js RC4)

src/web/utils/
Snackbar.mjs # Lightweight toast notifications (replaces snackbarjs)

rspack.config.js # Rspack base config
rspack.dev.config.js # Rspack development config
rspack.prod.config.js # Rspack production config
webpack.dev.config.js # Webpack development config (standalone, no Grunt)
webpack.prod.config.js # Webpack production config (standalone, no Grunt)
vitest.config.mjs # Vitest test runner config
playwright.config.mjs # Playwright E2E test config
tests/lib/VitestAdapter.mjs # Bridges TestRegister format to Vitest
tests/operations/operations.test.mjs # Vitest entry for all operation tests
tests/browser/app.spec.mjs # Playwright E2E tests
```

### Upstream Compatibility
- All 475 operations preserved and working
- Crypto-api kept as fallback for obscure hash algorithms (Snefru, Whirlpool, MD2, MD4, etc.)
- Moment-timezone kept in date/time operations (changing format strings would break user recipes)
- Original test files unchanged (Vitest adapter wraps them without modification)

#### *The Cyber Swiss Army Knife*
---

CyberChef is a simple, intuitive web app for carrying out all manner of "cyber" operations within a web browser. These operations include simple encoding like XOR and Base64, more complex encryption like AES, DES and Blowfish, creating binary and hexdumps, compression and decompression of data, calculating hashes and checksums, IPv6 and X.509 parsing, changing character encodings, and much more.

Expand Down Expand Up @@ -114,13 +204,14 @@ Supported arguments are `recipe`, `input` (encoded in Base64), and `theme`.

CyberChef is built to support

- Google Chrome 50+
- Mozilla Firefox 38+
- Google Chrome 80+
- Mozilla Firefox 78+
- Safari 14+


## 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 `v18+` (tested up to v24). For more information, see the ["Node API" wiki page](https://github.com/gchq/CyberChef/wiki/Node-API)


## Contributing
Expand Down
9 changes: 2 additions & 7 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,12 @@ module.exports = function(api) {
"presets": [
["@babel/preset-env", {
"modules": false,
"useBuiltIns": "entry",
"useBuiltIns": "usage",
"corejs": 3
}]
],
"plugins": [
"@babel/plugin-syntax-import-assertions",
[
"@babel/plugin-transform-runtime", {
"regenerator": true
}
]
"@babel/plugin-syntax-import-assertions"
]
};
};
Loading