From efda16b0398d162420c971993f13d0743cbfa2b6 Mon Sep 17 00:00:00 2001 From: Jed Laundry Date: Thu, 31 Aug 2023 03:20:20 +0000 Subject: [PATCH 01/21] change Diff to output , --- src/core/operations/Diff.mjs | 4 ++-- src/web/stylesheets/index.css | 1 + src/web/stylesheets/operations/diff.css | 8 ++++++++ tests/operations/tests/StrUtils.mjs | 6 +++--- 4 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 src/web/stylesheets/operations/diff.css diff --git a/src/core/operations/Diff.mjs b/src/core/operations/Diff.mjs index 84107245..9f180f86 100644 --- a/src/core/operations/Diff.mjs +++ b/src/core/operations/Diff.mjs @@ -119,9 +119,9 @@ class Diff extends Operation { for (let i = 0; i < diff.length; i++) { if (diff[i].added) { - if (showAdded) output += "" + Utils.escapeHtml(diff[i].value) + ""; + if (showAdded) output += "" + Utils.escapeHtml(diff[i].value) + ""; } else if (diff[i].removed) { - if (showRemoved) output += "" + Utils.escapeHtml(diff[i].value) + ""; + if (showRemoved) output += "" + Utils.escapeHtml(diff[i].value) + ""; } else if (!showSubtraction) { output += Utils.escapeHtml(diff[i].value); } diff --git a/src/web/stylesheets/index.css b/src/web/stylesheets/index.css index 960c7006..0565399f 100755 --- a/src/web/stylesheets/index.css +++ b/src/web/stylesheets/index.css @@ -36,4 +36,5 @@ @import "./layout/_structure.css"; /* Operations */ +@import "./operations/diff.css"; @import "./operations/json.css"; diff --git a/src/web/stylesheets/operations/diff.css b/src/web/stylesheets/operations/diff.css new file mode 100644 index 00000000..008cbbf5 --- /dev/null +++ b/src/web/stylesheets/operations/diff.css @@ -0,0 +1,8 @@ +del { + background-color: var(--hl3); +} + +ins { + text-decoration: underline; /* shouldn't be needed, but Chromium doesn't copy to clipboard without it */ + background-color: var(--hl5); +} diff --git a/tests/operations/tests/StrUtils.mjs b/tests/operations/tests/StrUtils.mjs index c78b6b23..70e9c362 100644 --- a/tests/operations/tests/StrUtils.mjs +++ b/tests/operations/tests/StrUtils.mjs @@ -11,7 +11,7 @@ TestRegister.addTests([ { name: "Diff, basic usage", input: "testing23\n\ntesting123", - expectedOutput: "testing123", + expectedOutput: "testing123", recipeConfig: [ { "op": "Diff", @@ -22,7 +22,7 @@ TestRegister.addTests([ { name: "Diff added with subtraction, basic usage", input: "testing23\n\ntesting123", - expectedOutput: "1", + expectedOutput: "1", recipeConfig: [ { "op": "Diff", @@ -33,7 +33,7 @@ TestRegister.addTests([ { name: "Diff removed with subtraction, basic usage", input: "testing123\n\ntesting3", - expectedOutput: "12", + expectedOutput: "12", recipeConfig: [ { "op": "Diff", From e973ea6f08ce4a433a5d1be460c7891419b49143 Mon Sep 17 00:00:00 2001 From: Jed Laundry Date: Sun, 11 Feb 2024 01:18:52 +0000 Subject: [PATCH 02/21] update Diff sanity check test --- tests/browser/02_ops.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/browser/02_ops.js b/tests/browser/02_ops.js index e2c8a219..7cb0e941 100644 --- a/tests/browser/02_ops.js +++ b/tests/browser/02_ops.js @@ -108,7 +108,7 @@ module.exports = { // testOp(browser, "Derive EVP key", "test input", "test_output"); // testOp(browser, "Derive PBKDF2 key", "test input", "test_output"); // testOp(browser, "Detect File Type", "test input", "test_output"); - testOpHtml(browser, "Diff", "The cat sat on the mat\n\nThe mat cat on the sat", ".hl5:first-child", "mat", ["\\n\\n", "Word", true, true, false, false]); + testOpHtml(browser, "Diff", "The cat sat on the mat\n\nThe mat cat on the sat", "ins:first-child", "mat", ["\\n\\n", "Word", true, true, false, false]); // testOp(browser, "Disassemble x86", "test input", "test_output"); testOpImage(browser, "Dither Image", "files/Hitchhikers_Guide.jpeg"); // testOp(browser, "Divide", "test input", "test_output"); From 0da30813da9903ba40e03842fe8d2eb613e95f22 Mon Sep 17 00:00:00 2001 From: Ashleigh Carr Date: Tue, 30 Jan 2024 12:24:45 +0000 Subject: [PATCH 03/21] Add new steps to publish a containerized CyberChef to GHCR --- .github/workflows/pull_requests.yml | 4 +++ .github/workflows/releases.yml | 47 ++++++++++++++++++++++++++++- Containerfile | 3 ++ 3 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 Containerfile diff --git a/.github/workflows/pull_requests.yml b/.github/workflows/pull_requests.yml index b485edad..42027c93 100644 --- a/.github/workflows/pull_requests.yml +++ b/.github/workflows/pull_requests.yml @@ -38,3 +38,7 @@ jobs: run: | sudo apt-get install xvfb xvfb-run --server-args="-screen 0 1200x800x24" npx grunt testui + image: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index b1be78f9..8fbac9f3 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -6,6 +6,12 @@ on: tags: - 'v*' +env: + REGISTRY: ghcr.io + REGISTRY_USER: ${{ github.actor }} + REGISTRY_PASSWORD: ${{ github.token }} + IMAGE_NAME: ${{ github.repository }} + jobs: main: runs-on: ubuntu-latest @@ -16,10 +22,14 @@ jobs: uses: actions/setup-node@v3 with: node-version: '18.x' + - name: Install qemu dependency + run: | + sudo apt-get update + sudo apt-get install -y qemu-user-static - name: Install run: | - npm install + npm ci npm run setheapsize - name: Lint @@ -40,6 +50,31 @@ jobs: sudo apt-get install xvfb xvfb-run --server-args="-screen 0 1200x800x24" npx grunt testui + - name: Image Metadata + if: success() + id: image-metadata + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=semver,pattern={{major}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{version}} + + - name: Production Image Build + if: success() + id: build-image + uses: redhat-actions/buildah-build@v2 + with: + image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: ${{ steps.image-metadata.outputs.tags }} + labels: ${{ steps.image-metadata.outputs.labels }} + containerfiles: ./Containerfile + platforms: linux/arm64, linux/amd64 + oci: true + extra-args: | + --ulimit nofile=4096:4096 + - name: Upload Release Assets if: success() id: upload-release-assets @@ -57,3 +92,13 @@ jobs: uses: JS-DevTools/npm-publish@v1 with: token: ${{ secrets.NPM_TOKEN }} + + - name: Publish to GHCR + if: success() + uses: redhat-actions/push-to-registry@v2 + with: + image: ${{ steps.build-image.outputs.image }} + tags: ${{ steps.build-image.outputs.tags }} + registry: ${{ env.REGISTRY }} + username: ${{ env.REGISTRY_USER }} + password: ${{ env.REGISTRY_PASSWORD }} diff --git a/Containerfile b/Containerfile new file mode 100644 index 00000000..7727754d --- /dev/null +++ b/Containerfile @@ -0,0 +1,3 @@ +FROM ghcr.io/static-web-server/static-web-server:2.25-alpine + +COPY ./build/prod /public From 3b265322e09286cad8b593bccef4ebb1c1a7a67a Mon Sep 17 00:00:00 2001 From: Ashleigh Carr Date: Tue, 30 Jan 2024 15:18:45 +0000 Subject: [PATCH 04/21] Build container on PR (but don't publish) to verify Containerfile syntax --- .github/workflows/pull_requests.yml | 14 ++++++++++++++ .github/workflows/releases.yml | 2 -- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull_requests.yml b/.github/workflows/pull_requests.yml index 42027c93..654669d1 100644 --- a/.github/workflows/pull_requests.yml +++ b/.github/workflows/pull_requests.yml @@ -5,6 +5,10 @@ on: pull_request: types: [synchronize, opened, reopened] +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + jobs: main: runs-on: ubuntu-latest @@ -33,6 +37,16 @@ jobs: if: success() run: npx grunt prod + - name: Production Image Build + if: success() + id: build-image + uses: redhat-actions/buildah-build@v2 + with: + image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + containerfiles: ./Containerfile + platforms: linux/arm64, linux/amd64 + oci: true + - name: UI Tests if: success() run: | diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 8fbac9f3..c5c4cf2e 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -72,8 +72,6 @@ jobs: containerfiles: ./Containerfile platforms: linux/arm64, linux/amd64 oci: true - extra-args: | - --ulimit nofile=4096:4096 - name: Upload Release Assets if: success() From 40a4872f70f0da19557642a2d43069535114375f Mon Sep 17 00:00:00 2001 From: Ashleigh Carr Date: Tue, 6 Feb 2024 10:26:33 +0000 Subject: [PATCH 05/21] Generate prod build inside container --- .github/workflows/pull_requests.yml | 6 +----- .github/workflows/releases.yml | 4 ++++ Containerfile | 8 +++++++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pull_requests.yml b/.github/workflows/pull_requests.yml index 654669d1..16fbb6de 100644 --- a/.github/workflows/pull_requests.yml +++ b/.github/workflows/pull_requests.yml @@ -44,7 +44,7 @@ jobs: with: image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} containerfiles: ./Containerfile - platforms: linux/arm64, linux/amd64 + platforms: linux/amd64 oci: true - name: UI Tests @@ -52,7 +52,3 @@ jobs: run: | sudo apt-get install xvfb xvfb-run --server-args="-screen 0 1200x800x24" npx grunt testui - image: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index c5c4cf2e..c016e24c 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -72,6 +72,10 @@ jobs: containerfiles: ./Containerfile platforms: linux/arm64, linux/amd64 oci: true + # Webpack seems to use a lot of open files, increase the max open file limit to accomodate. + extra-args: | + --ulimit nofile=10000 + - name: Upload Release Assets if: success() diff --git a/Containerfile b/Containerfile index 7727754d..125ef18c 100644 --- a/Containerfile +++ b/Containerfile @@ -1,3 +1,9 @@ +FROM node:18-alpine AS build + +COPY . . +RUN npm ci +RUN npm run build + FROM ghcr.io/static-web-server/static-web-server:2.25-alpine -COPY ./build/prod /public +COPY --from=build ./build/prod /public From 7588e50f9fe2dc94efd8fd074c15177c53e607e2 Mon Sep 17 00:00:00 2001 From: Ashleigh Carr Date: Tue, 6 Feb 2024 10:28:02 +0000 Subject: [PATCH 06/21] Remove unecessary QEMU install step --- .github/workflows/releases.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index c016e24c..f00e44f6 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -22,10 +22,6 @@ jobs: uses: actions/setup-node@v3 with: node-version: '18.x' - - name: Install qemu dependency - run: | - sudo apt-get update - sudo apt-get install -y qemu-user-static - name: Install run: | From dbdcb460e542ce57199dd550e76f51d7d50ecb83 Mon Sep 17 00:00:00 2001 From: Ashleigh Carr Date: Tue, 6 Feb 2024 10:29:20 +0000 Subject: [PATCH 07/21] Remove unecessary `if: success()` from Github release workflow --- .github/workflows/releases.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index f00e44f6..f3895f8c 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -37,17 +37,14 @@ jobs: npm run testnodeconsumer - name: Production Build - if: success() run: npx grunt prod - name: UI Tests - if: success() run: | sudo apt-get install xvfb xvfb-run --server-args="-screen 0 1200x800x24" npx grunt testui - name: Image Metadata - if: success() id: image-metadata uses: docker/metadata-action@v4 with: @@ -58,7 +55,6 @@ jobs: type=semver,pattern={{version}} - name: Production Image Build - if: success() id: build-image uses: redhat-actions/buildah-build@v2 with: @@ -74,7 +70,6 @@ jobs: - name: Upload Release Assets - if: success() id: upload-release-assets uses: svenstaro/upload-release-action@v2 with: @@ -86,13 +81,11 @@ jobs: body: "See the [CHANGELOG](https://github.com/gchq/CyberChef/blob/master/CHANGELOG.md) and [commit messages](https://github.com/gchq/CyberChef/commits/master) for details." - name: Publish to NPM - if: success() uses: JS-DevTools/npm-publish@v1 with: token: ${{ secrets.NPM_TOKEN }} - name: Publish to GHCR - if: success() uses: redhat-actions/push-to-registry@v2 with: image: ${{ steps.build-image.outputs.image }} From a0729304d1441accc032232c37406d7db79f9c75 Mon Sep 17 00:00:00 2001 From: Ashleigh Carr Date: Thu, 8 Feb 2024 10:15:29 +0000 Subject: [PATCH 08/21] Add packages write permission --- .github/workflows/releases.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index f3895f8c..76a426be 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -15,6 +15,8 @@ env: jobs: main: runs-on: ubuntu-latest + permissions: + packages: write steps: - uses: actions/checkout@v3 From 4b95ab2477bc3fbc79969266c8e686db55b4d699 Mon Sep 17 00:00:00 2001 From: Ashleigh Carr Date: Thu, 8 Feb 2024 10:28:14 +0000 Subject: [PATCH 09/21] Increase nofile limit to 10,000 when building container on PR workflow too --- .github/workflows/pull_requests.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/pull_requests.yml b/.github/workflows/pull_requests.yml index 16fbb6de..f6a9683c 100644 --- a/.github/workflows/pull_requests.yml +++ b/.github/workflows/pull_requests.yml @@ -46,6 +46,9 @@ jobs: containerfiles: ./Containerfile platforms: linux/amd64 oci: true + # Webpack seems to use a lot of open files, increase the max open file limit to accomodate. + extra-args: | + --ulimit nofile=10000 - name: UI Tests if: success() From 2b85336c71695c2d1aa15ed46bcd23419c018427 Mon Sep 17 00:00:00 2001 From: Ashleigh Carr Date: Thu, 8 Feb 2024 19:32:56 +0000 Subject: [PATCH 10/21] Remove ARM64 Container build from release workflow --- .github/workflows/releases.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 76a426be..89e4efc5 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -64,7 +64,7 @@ jobs: tags: ${{ steps.image-metadata.outputs.tags }} labels: ${{ steps.image-metadata.outputs.labels }} containerfiles: ./Containerfile - platforms: linux/arm64, linux/amd64 + platforms: linux/amd64 oci: true # Webpack seems to use a lot of open files, increase the max open file limit to accomodate. extra-args: | From 1a2207a045f069032d1e6317de8d6ab3c8892dcf Mon Sep 17 00:00:00 2001 From: Ashleigh Carr Date: Sun, 11 Feb 2024 13:29:18 +0000 Subject: [PATCH 11/21] Swtich to nginx for container --- Containerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Containerfile b/Containerfile index 125ef18c..be4c8bad 100644 --- a/Containerfile +++ b/Containerfile @@ -4,6 +4,6 @@ COPY . . RUN npm ci RUN npm run build -FROM ghcr.io/static-web-server/static-web-server:2.25-alpine +FROM nginx:1.25-alpine3.18 AS cyberchef -COPY --from=build ./build/prod /public +COPY --from=build ./build/prod /usr/share/nginx/html/ From d700d1d459751c0c1d28092396c3691393e9d7fa Mon Sep 17 00:00:00 2001 From: Ashleigh Carr Date: Sun, 11 Feb 2024 13:30:15 +0000 Subject: [PATCH 12/21] Switch to using Dockerfile --- Containerfile => Dockerfile | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Containerfile => Dockerfile (100%) diff --git a/Containerfile b/Dockerfile similarity index 100% rename from Containerfile rename to Dockerfile From 314b925ec916057799f30a229446f6600d816a0f Mon Sep 17 00:00:00 2001 From: Ashleigh Carr Date: Sun, 11 Feb 2024 13:31:03 +0000 Subject: [PATCH 13/21] Add a comment to the README about using Docker --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 24f56e77..2f951d66 100755 --- a/README.md +++ b/README.md @@ -20,6 +20,22 @@ Cryptographic operations in CyberChef should not be relied upon to provide secur [A live demo can be found here][1] - have fun! +## Containers + +If you would like to try out CyberChef locally you can either build it yourself: + +```bash +docker build --tag cyberchef --ulimit nofile=10000 . +docker run -it -p 8080:80 cyberchef +``` + +Or you can use our image directly: + +```bash +docker run -it -p 8080:80 ghcr.io/gchq/cyberchef:latest +``` + +This image is built and published through our [GitHub Workflows](.github/workflows/docker.yml) ## How it works From abd90240975e33aeee12ad6242046a3bf6b787eb Mon Sep 17 00:00:00 2001 From: Ashleigh Carr Date: Sun, 11 Feb 2024 13:32:26 +0000 Subject: [PATCH 14/21] Add a .dockerignore file --- .dockerignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..dd87e2d7 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +node_modules +build From c5e880628a1b769105b4586aa3ef1be221b05fd4 Mon Sep 17 00:00:00 2001 From: Ashleigh Carr Date: Sun, 11 Feb 2024 13:38:43 +0000 Subject: [PATCH 15/21] Fix CI using Containerfile --- .github/workflows/pull_requests.yml | 2 +- .github/workflows/releases.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull_requests.yml b/.github/workflows/pull_requests.yml index f6a9683c..5d2b7e40 100644 --- a/.github/workflows/pull_requests.yml +++ b/.github/workflows/pull_requests.yml @@ -43,7 +43,7 @@ jobs: uses: redhat-actions/buildah-build@v2 with: image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - containerfiles: ./Containerfile + containerfiles: ./Dockerfile platforms: linux/amd64 oci: true # Webpack seems to use a lot of open files, increase the max open file limit to accomodate. diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 89e4efc5..c5433742 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -63,7 +63,7 @@ jobs: image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: ${{ steps.image-metadata.outputs.tags }} labels: ${{ steps.image-metadata.outputs.labels }} - containerfiles: ./Containerfile + containerfiles: ./Dockerfile platforms: linux/amd64 oci: true # Webpack seems to use a lot of open files, increase the max open file limit to accomodate. From 3f89a94df2a438245d4881ec5c581d1532517a62 Mon Sep 17 00:00:00 2001 From: Ashleigh Carr Date: Mon, 12 Feb 2024 09:49:44 +0000 Subject: [PATCH 16/21] Remove `image` property from Container build & push actions --- .github/workflows/pull_requests.yml | 5 ----- .github/workflows/releases.yml | 2 -- 2 files changed, 7 deletions(-) diff --git a/.github/workflows/pull_requests.yml b/.github/workflows/pull_requests.yml index 5d2b7e40..af1c6422 100644 --- a/.github/workflows/pull_requests.yml +++ b/.github/workflows/pull_requests.yml @@ -5,10 +5,6 @@ on: pull_request: types: [synchronize, opened, reopened] -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} - jobs: main: runs-on: ubuntu-latest @@ -42,7 +38,6 @@ jobs: id: build-image uses: redhat-actions/buildah-build@v2 with: - image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} containerfiles: ./Dockerfile platforms: linux/amd64 oci: true diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index c5433742..421cb5cd 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -60,7 +60,6 @@ jobs: id: build-image uses: redhat-actions/buildah-build@v2 with: - image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: ${{ steps.image-metadata.outputs.tags }} labels: ${{ steps.image-metadata.outputs.labels }} containerfiles: ./Dockerfile @@ -90,7 +89,6 @@ jobs: - name: Publish to GHCR uses: redhat-actions/push-to-registry@v2 with: - image: ${{ steps.build-image.outputs.image }} tags: ${{ steps.build-image.outputs.tags }} registry: ${{ env.REGISTRY }} username: ${{ env.REGISTRY_USER }} From 7582abfa277f00478fa3b235e6f442d1a7b52096 Mon Sep 17 00:00:00 2001 From: Ashleigh Carr Date: Mon, 12 Feb 2024 10:41:45 +0000 Subject: [PATCH 17/21] Fix PR workflow, Buildah requires atleast an image name if no tags specified --- .github/workflows/pull_requests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pull_requests.yml b/.github/workflows/pull_requests.yml index af1c6422..daa59490 100644 --- a/.github/workflows/pull_requests.yml +++ b/.github/workflows/pull_requests.yml @@ -38,6 +38,8 @@ jobs: id: build-image uses: redhat-actions/buildah-build@v2 with: + # Not being uploaded to any registry, use a simple name to allow Buildah to build correctly. + image: cyberchef containerfiles: ./Dockerfile platforms: linux/amd64 oci: true From 62dfa8f9dddbb76ffa620a972bf13d04095494b9 Mon Sep 17 00:00:00 2001 From: Ashleigh Carr Date: Mon, 12 Feb 2024 10:45:20 +0000 Subject: [PATCH 18/21] Point to the correct workflow in the README for Container releases. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2f951d66..5549bda2 100755 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ Or you can use our image directly: docker run -it -p 8080:80 ghcr.io/gchq/cyberchef:latest ``` -This image is built and published through our [GitHub Workflows](.github/workflows/docker.yml) +This image is built and published through our [GitHub Workflows](.github/workflows/releases.yml) ## How it works From c7377da37f33711824222f7aba4d0e302fd38c21 Mon Sep 17 00:00:00 2001 From: sw5678 <151949597+sw5678@users.noreply.github.com> Date: Mon, 12 Feb 2024 16:52:43 +0000 Subject: [PATCH 19/21] Adding and removing tests --- tests/operations/index.mjs | 123 ++++++++++++------------- tests/operations/tests/FileTree.mjs | 7 +- tests/operations/tests/FromGeohash.mjs | 55 ----------- tests/operations/tests/ToGeohash.mjs | 55 ----------- 4 files changed, 65 insertions(+), 175 deletions(-) delete mode 100644 tests/operations/tests/FromGeohash.mjs delete mode 100644 tests/operations/tests/ToGeohash.mjs diff --git a/tests/operations/index.mjs b/tests/operations/index.mjs index aa120ba0..98374650 100644 --- a/tests/operations/index.mjs +++ b/tests/operations/index.mjs @@ -17,131 +17,130 @@ import { } from "../lib/utils.mjs"; import TestRegister from "../lib/TestRegister.mjs"; -import "./tests/BCD.mjs"; -import "./tests/BSON.mjs"; +import "./tests/AESKeyWrap.mjs"; +import "./tests/AvroToJSON.mjs"; import "./tests/BaconCipher.mjs"; import "./tests/Base45.mjs"; import "./tests/Base58.mjs"; -import "./tests/Base64.mjs"; import "./tests/Base62.mjs"; +import "./tests/Base64.mjs"; import "./tests/Base85.mjs"; import "./tests/Base92.mjs"; +import "./tests/BCD.mjs"; import "./tests/BitwiseOp.mjs"; +import "./tests/BLAKE2b.mjs"; +import "./tests/BLAKE2s.mjs"; +import "./tests/Bombe.mjs"; +import "./tests/BSON.mjs"; import "./tests/ByteRepr.mjs"; +import "./tests/CaesarBoxCipher.mjs"; import "./tests/CartesianProduct.mjs"; -import "./tests/CetaceanCipherEncode.mjs"; +import "./tests/CBORDecode.mjs"; +import "./tests/CBOREncode.mjs"; import "./tests/CetaceanCipherDecode.mjs"; +import "./tests/CetaceanCipherEncode.mjs"; import "./tests/ChaCha.mjs"; -import "./tests/CharEnc.mjs"; import "./tests/ChangeIPFormat.mjs"; +import "./tests/CharEnc.mjs"; import "./tests/Charts.mjs"; import "./tests/Checksum.mjs"; import "./tests/Ciphers.mjs"; +import "./tests/CipherSaber2.mjs"; +import "./tests/CMAC.mjs"; import "./tests/Code.mjs"; +import "./tests/Colossus.mjs"; import "./tests/Comment.mjs"; import "./tests/Compress.mjs"; import "./tests/ConditionalJump.mjs"; +import "./tests/ConvertCoordinateFormat.mjs"; +import "./tests/ConvertToNATOAlphabet.mjs"; import "./tests/Crypt.mjs"; import "./tests/CSV.mjs"; import "./tests/DateTime.mjs"; +import "./tests/DefangIP.mjs"; +import "./tests/ELFInfo.mjs"; +import "./tests/Enigma.mjs"; import "./tests/ExtractEmailAddresses.mjs"; +import "./tests/FileTree.mjs"; +import "./tests/FletcherChecksum.mjs"; import "./tests/Fork.mjs"; import "./tests/FromDecimal.mjs"; import "./tests/GenerateAllHashes.mjs"; -import "./tests/Gzip.mjs"; +import "./tests/GenerateDeBruijnSequence.mjs"; +import "./tests/GetAllCasings.mjs"; +import "./tests/GOST.mjs"; import "./tests/Gunzip.mjs"; +import "./tests/Gzip.mjs"; import "./tests/Hash.mjs"; +import "./tests/HASSH.mjs"; import "./tests/HaversineDistance.mjs"; import "./tests/Hex.mjs"; import "./tests/Hexdump.mjs"; +import "./tests/HKDF.mjs"; import "./tests/Image.mjs"; import "./tests/IndexOfCoincidence.mjs"; -import "./tests/Jump.mjs"; +import "./tests/JA3Fingerprint.mjs"; +import "./tests/JA3SFingerprint.mjs"; import "./tests/JSONBeautify.mjs"; import "./tests/JSONMinify.mjs"; import "./tests/JSONtoCSV.mjs"; +import "./tests/Jump.mjs"; import "./tests/JWTDecode.mjs"; import "./tests/JWTSign.mjs"; import "./tests/JWTVerify.mjs"; +import "./tests/LevenshteinDistance.mjs"; +import "./tests/Lorenz.mjs"; +import "./tests/LS47.mjs"; +import "./tests/LuhnChecksum.mjs"; import "./tests/LZNT1Decompress.mjs"; -import "./tests/MS.mjs"; +import "./tests/LZString.mjs"; import "./tests/Magic.mjs"; +import "./tests/Media.mjs"; import "./tests/MorseCode.mjs"; +import "./tests/MS.mjs"; +import "./tests/MultipleBombe.mjs"; import "./tests/MurmurHash3.mjs"; import "./tests/NetBIOS.mjs"; import "./tests/NormaliseUnicode.mjs"; +import "./tests/NTLM.mjs"; import "./tests/OTP.mjs"; +import "./tests/ParseIPRange.mjs"; +import "./tests/ParseObjectIDTimestamp.mjs"; +import "./tests/ParseQRCode.mjs"; +import "./tests/ParseSSHHostKey.mjs"; +import "./tests/ParseTCP.mjs"; +import "./tests/ParseTLV.mjs"; +import "./tests/ParseUDP.mjs"; +import "./tests/PEMtoHex.mjs"; import "./tests/PGP.mjs"; import "./tests/PHP.mjs"; -import "./tests/ParseIPRange.mjs"; -import "./tests/ParseQRCode.mjs"; -import "./tests/PEMtoHex.mjs"; import "./tests/PowerSet.mjs"; +import "./tests/Protobuf.mjs"; +import "./tests/Rabbit.mjs"; import "./tests/Regex.mjs"; import "./tests/Register.mjs"; +import "./tests/RisonEncodeDecode.mjs"; import "./tests/Rotate.mjs"; +import "./tests/RSA.mjs"; import "./tests/SeqUtils.mjs"; import "./tests/SetDifference.mjs"; import "./tests/SetIntersection.mjs"; import "./tests/SetUnion.mjs"; +import "./tests/Shuffle.mjs"; +import "./tests/SIGABA.mjs"; import "./tests/SM4.mjs"; +// import "./tests/SplitColourChannels.mjs"; // Cannot test operations that use the File type yet import "./tests/StrUtils.mjs"; +import "./tests/Subsection.mjs"; +import "./tests/SwapCase.mjs"; import "./tests/SymmetricDifference.mjs"; import "./tests/TextEncodingBruteForce.mjs"; -import "./tests/TranslateDateTimeFormat.mjs"; -import "./tests/Magic.mjs"; -import "./tests/ParseTLV.mjs"; -import "./tests/Media.mjs"; import "./tests/ToFromInsensitiveRegex.mjs"; -import "./tests/YARA.mjs"; -import "./tests/ConvertCoordinateFormat.mjs"; -import "./tests/Enigma.mjs"; -import "./tests/Bombe.mjs"; -import "./tests/MultipleBombe.mjs"; +import "./tests/TranslateDateTimeFormat.mjs"; import "./tests/Typex.mjs"; -import "./tests/BLAKE2b.mjs"; -import "./tests/BLAKE2s.mjs"; -import "./tests/Protobuf.mjs"; -import "./tests/ParseSSHHostKey.mjs"; -import "./tests/DefangIP.mjs"; -import "./tests/ParseUDP.mjs"; -import "./tests/ParseTCP.mjs"; -import "./tests/AvroToJSON.mjs"; -import "./tests/Lorenz.mjs"; -import "./tests/LuhnChecksum.mjs"; -import "./tests/CipherSaber2.mjs"; -import "./tests/Colossus.mjs"; -import "./tests/ParseObjectIDTimestamp.mjs"; -import "./tests/Unicode.mjs"; -import "./tests/RSA.mjs"; -import "./tests/CBOREncode.mjs"; -import "./tests/CBORDecode.mjs"; -import "./tests/RisonEncodeDecode.mjs"; -import "./tests/JA3Fingerprint.mjs"; -import "./tests/JA3SFingerprint.mjs"; -import "./tests/HASSH.mjs"; -import "./tests/GetAllCasings.mjs"; -import "./tests/SIGABA.mjs"; -import "./tests/ELFInfo.mjs"; -import "./tests/Subsection.mjs"; -import "./tests/CaesarBoxCipher.mjs"; import "./tests/UnescapeString.mjs"; -import "./tests/LS47.mjs"; -import "./tests/LZString.mjs"; -import "./tests/NTLM.mjs"; -import "./tests/Shuffle.mjs"; -import "./tests/FletcherChecksum.mjs"; -import "./tests/CMAC.mjs"; -import "./tests/AESKeyWrap.mjs"; -import "./tests/Rabbit.mjs"; -import "./tests/LevenshteinDistance.mjs"; -import "./tests/SwapCase.mjs"; -import "./tests/HKDF.mjs"; -import "./tests/GenerateDeBruijnSequence.mjs"; -import "./tests/GOST.mjs"; - -// Cannot test operations that use the File type yet -// import "./tests/SplitColourChannels.mjs"; +import "./tests/Unicode.mjs"; +import "./tests/YARA.mjs"; const testStatus = { allTestsPassing: true, diff --git a/tests/operations/tests/FileTree.mjs b/tests/operations/tests/FileTree.mjs index 34249e3c..fc97678f 100644 --- a/tests/operations/tests/FileTree.mjs +++ b/tests/operations/tests/FileTree.mjs @@ -1,4 +1,6 @@ /** + * File tree tests. + * * @author sw5678 * @copyright Crown Copyright 2023 * @license Apache-2.0 @@ -7,14 +9,13 @@ import TestRegister from "../../lib/TestRegister.mjs"; TestRegister.addTests([ { - "name": "Swap Case: basic example", + "name": "File Tree: basic example", "input": "/test_dir1/test_file1.txt\n/test_dir1/test_file2.txt\n/test_dir2/test_file1.txt", "expectedOutput": "test_dir1\n|---test_file1.txt\n|---test_file2.txt\ntest_dir2\n|---test_file1.txt", "recipeConfig": [ { "op": "File Tree", - "args": [ - ], + "args": ["/", "Line feed"], }, ], } diff --git a/tests/operations/tests/FromGeohash.mjs b/tests/operations/tests/FromGeohash.mjs deleted file mode 100644 index dec58687..00000000 --- a/tests/operations/tests/FromGeohash.mjs +++ /dev/null @@ -1,55 +0,0 @@ -/** - * To Geohash tests - * - * @author gchq77703 - * @copyright Crown Copyright 2018 - * @license Apache-2.0 - */ -import TestRegister from "../../lib/TestRegister.mjs"; - -TestRegister.addTests([ - { - name: "From Geohash", - input: "ww8p1r4t8", - expectedOutput: "37.83238649368286,112.55838632583618", - recipeConfig: [ - { - op: "From Geohash", - args: [], - }, - ], - }, - { - name: "From Geohash", - input: "ww8p1r", - expectedOutput: "37.83416748046875,112.5604248046875", - recipeConfig: [ - { - op: "From Geohash", - args: [], - }, - ], - }, - { - name: "From Geohash", - input: "ww8", - expectedOutput: "37.265625,113.203125", - recipeConfig: [ - { - op: "From Geohash", - args: [], - }, - ], - }, - { - name: "From Geohash", - input: "w", - expectedOutput: "22.5,112.5", - recipeConfig: [ - { - op: "From Geohash", - args: [], - }, - ], - }, -]); diff --git a/tests/operations/tests/ToGeohash.mjs b/tests/operations/tests/ToGeohash.mjs deleted file mode 100644 index 96dece85..00000000 --- a/tests/operations/tests/ToGeohash.mjs +++ /dev/null @@ -1,55 +0,0 @@ -/** - * To Geohash tests - * - * @author gchq77703 - * @copyright Crown Copyright 2018 - * @license Apache-2.0 - */ -import TestRegister from "../../lib/TestRegister.mjs"; - -TestRegister.addTests([ - { - name: "To Geohash", - input: "37.8324,112.5584", - expectedOutput: "ww8p1r4t8", - recipeConfig: [ - { - op: "To Geohash", - args: [9], - }, - ], - }, - { - name: "To Geohash", - input: "37.9324,-112.2584", - expectedOutput: "9w8pv3ruj", - recipeConfig: [ - { - op: "To Geohash", - args: [9], - }, - ], - }, - { - name: "To Geohash", - input: "37.8324,112.5584", - expectedOutput: "ww8", - recipeConfig: [ - { - op: "To Geohash", - args: [3], - }, - ], - }, - { - name: "To Geohash", - input: "37.9324,-112.2584", - expectedOutput: "9w8pv3rujxy5b99", - recipeConfig: [ - { - op: "To Geohash", - args: [15], - }, - ], - }, -]); From 47f1f4c549e125f68bc2311710c26290a54e2fe0 Mon Sep 17 00:00:00 2001 From: a3957273 <89583054+a3957273@users.noreply.github.com> Date: Tue, 13 Feb 2024 00:18:08 +0000 Subject: [PATCH 20/21] Bump to 10.8.0 --- CHANGELOG.md | 6 ++++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7dabea66..145d1b14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,9 @@ All major and minor version changes will be documented in this file. Details of ## Details +### [10.8.0] - 2024-02-13 +- Add official Docker images [@AshCorr] | [#1699] + ### [10.7.0] - 2024-02-09 - Added 'File Tree' operation [@sw5678] | [#1667] - Added 'RISON' operation [@sg5506844] | [#1555] @@ -383,6 +386,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) +[10.8.0]: https://github.com/gchq/CyberChef/releases/tag/v10.7.0 [10.7.0]: https://github.com/gchq/CyberChef/releases/tag/v10.7.0 [10.6.0]: https://github.com/gchq/CyberChef/releases/tag/v10.6.0 [10.5.0]: https://github.com/gchq/CyberChef/releases/tag/v10.5.0 @@ -546,6 +550,7 @@ All major and minor version changes will be documented in this file. Details of [@sw5678]: https://github.com/sw5678 [@sg5506844]: https://github.com/sg5506844 [@AliceGrey]: https://github.com/AliceGrey +[@AshCorr]: https://github.com/AshCorr [8ad18b]: https://github.com/gchq/CyberChef/commit/8ad18bc7db6d9ff184ba3518686293a7685bf7b7 @@ -672,3 +677,4 @@ All major and minor version changes will be documented in this file. Details of [#1667]: https://github.com/gchq/CyberChef/issues/1667 [#1555]: https://github.com/gchq/CyberChef/issues/1555 [#1694]: https://github.com/gchq/CyberChef/issues/1694 +[#1699]: https://github.com/gchq/CyberChef/issues/1694 diff --git a/package-lock.json b/package-lock.json index 1d1c6333..29717727 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "cyberchef", - "version": "10.7.0", + "version": "10.8.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cyberchef", - "version": "10.7.0", + "version": "10.8.0", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { diff --git a/package.json b/package.json index 0ab4990e..e0c3b136 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cyberchef", - "version": "10.7.0", + "version": "10.8.0", "description": "The Cyber Swiss Army Knife for encryption, encoding, compression and data analysis.", "author": "n1474335 ", "homepage": "https://gchq.github.io/CyberChef", From 112d52cb9900817be3f3ab9bee803faa5fd86bff Mon Sep 17 00:00:00 2001 From: a3957273 <89583054+a3957273@users.noreply.github.com> Date: Tue, 13 Feb 2024 00:42:41 +0000 Subject: [PATCH 21/21] Remove specified permissions --- .github/workflows/releases.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 421cb5cd..a068ffbb 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -15,8 +15,6 @@ env: jobs: main: runs-on: ubuntu-latest - permissions: - packages: write steps: - uses: actions/checkout@v3