diff --git a/.github/dependabot.yml b/.github/dependabot.yml index f5e52ed9..4e1a74f0 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -25,12 +25,8 @@ updates: # see issue #2214 for rationale for each of these - dependency-name: '@xmldom/xmldom' versions: [ '>=0.9.0' ] - - dependency-name: 'bcryptjs' - versions: [ '>=3.0.0' ] - dependency-name: 'bootstrap' versions: [ '>=5.0.0' ] - - dependency-name: 'bson' - versions: [ '>=5.0.0' ] - dependency-name: 'cbor' versions: [ '>=10.0.0' ] - dependency-name: 'eslint' diff --git a/.github/workflows/pull_requests.yml b/.github/workflows/pull_requests.yml index b293352f..f72f187b 100644 --- a/.github/workflows/pull_requests.yml +++ b/.github/workflows/pull_requests.yml @@ -69,6 +69,6 @@ jobs: - name: Production Image Build if: success() id: build-image - uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0 + uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0 with: platforms: linux/amd64,linux/arm64,linux/arm/v7 diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 68dc364c..ea66b7c6 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -84,7 +84,7 @@ jobs: password: ${{ env.REGISTRY_PASSWORD }} - name: Publish to GHCR - uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0 + uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0 with: context: . push: true diff --git a/Gruntfile.js b/Gruntfile.js index 6f87b2a6..475701b8 100755 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -89,6 +89,8 @@ module.exports = function (grunt) { const compileYear = grunt.template.today("UTC:yyyy"), compileTime = grunt.template.today("UTC:dd/mm/yyyy HH:MM:ss") + " UTC", pkg = grunt.file.readJSON("package.json"), + version = process.env.GITHUB_SHA || `v${pkg.version}`, + downloadZipFilename = `CyberChef_${version}.zip`, webpackConfig = require("./webpack.config.js"), BUILD_CONSTANTS = { COMPILE_YEAR: JSON.stringify(compileYear), @@ -129,7 +131,9 @@ module.exports = function (grunt) { chunks: ["main"], compileYear: compileYear, compileTime: compileTime, - version: pkg.version, + version: version, + latestReleaseVersion: pkg.version, + downloadZipFilename: downloadZipFilename, minify: { removeComments: true, collapseWhitespace: true, @@ -245,7 +249,7 @@ module.exports = function (grunt) { "!build/prod/index.html", "!build/prod/BundleAnalyzerReport.html", ], - dest: `build/prod/CyberChef_v${pkg.version}.zip` + dest: `build/prod/${downloadZipFilename}` } }, connect: { @@ -333,12 +337,12 @@ module.exports = function (grunt) { switch (process.platform) { case "darwin": return chainCommands([ - `shasum -a 256 build/prod/CyberChef_v${pkg.version}.zip | awk '{print $1;}' > build/prod/sha256digest.txt`, + `shasum -a 256 build/prod/${downloadZipFilename} | awk '{print $1;}' > build/prod/sha256digest.txt`, `sed -i '' -e "s/DOWNLOAD_HASH_PLACEHOLDER/$(cat build/prod/sha256digest.txt)/" build/prod/index.html` ]); default: return chainCommands([ - `sha256sum build/prod/CyberChef_v${pkg.version}.zip | awk '{print $1;}' > build/prod/sha256digest.txt`, + `sha256sum build/prod/${downloadZipFilename} | awk '{print $1;}' > build/prod/sha256digest.txt`, `sed -i -e "s/DOWNLOAD_HASH_PLACEHOLDER/$(cat build/prod/sha256digest.txt)/" build/prod/index.html` ]); } diff --git a/package-lock.json b/package-lock.json index 9a168ec5..246477a2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,7 +27,7 @@ "bootstrap-colorpicker": "^3.4.0", "bootstrap-material-design": "^4.1.3", "browserify-zlib": "^0.2.0", - "bson": "^4.7.2", + "bson": "^7.2.0", "buffer": "^6.0.3", "cbor": "9.0.2", "chi-squared": "^1.1.0", @@ -85,7 +85,7 @@ "path": "^0.12.7", "popper.js": "^1.16.1", "process": "^0.11.10", - "protobufjs": "^7.5.8", + "protobufjs": "^7.6.0", "punycode.js": "^2.3.1", "qr-image": "^3.2.0", "reflect-metadata": "^0.2.2", @@ -94,7 +94,7 @@ "snackbarjs": "^1.1.0", "sortablejs": "^1.15.7", "split.js": "^1.6.5", - "sql-formatter": "^15.7.4", + "sql-formatter": "^15.8.0", "ssdeep.js": "0.0.3", "stream-browserify": "^3.0.0", "tesseract.js": "^6.0.1", @@ -157,7 +157,7 @@ "prompt": "^1.3.0", "sitemap": "^8.0.3", "terser": "^5.46.2", - "webpack": "^5.106.2", + "webpack": "^5.107.1", "webpack-bundle-analyzer": "^5.3.0", "webpack-dev-server": "^5.0.4", "webpack-node-externals": "^3.0.0", @@ -4441,13 +4441,12 @@ "license": "BSD-3-Clause" }, "node_modules/@protobufjs/fetch": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", - "integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.1.tgz", + "integrity": "sha512-GpptLrs57adMSuHi3VNj0mAF8dwh36LMaYF6XyJ6JMWlVsc+t42tm1HSEDmOs3A8fC9yyeisgLhsTVQokOZ0zw==", "license": "BSD-3-Clause", "dependencies": { - "@protobufjs/aspromise": "^1.1.1", - "@protobufjs/inquire": "^1.1.0" + "@protobufjs/aspromise": "^1.1.1" } }, "node_modules/@protobufjs/float": { @@ -4457,9 +4456,9 @@ "license": "BSD-3-Clause" }, "node_modules/@protobufjs/inquire": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.1.tgz", - "integrity": "sha512-mnzgDV26ueAvk7rsbt9L7bE0SuAoqyuys/sMMrmVcN5x9VsxpcG3rqAUSgDyLp0UZlmNfIbQ4fHfCtreVBk8Ew==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.2.tgz", + "integrity": "sha512-pa0vFRuws4wkvaXKK1uXZMAwAX4/t8ANaJo45iw/oQHNQ9q5xUzwgFmVJGXiga2BeN+zpX7Vf9vmsiIa2J+MUw==", "license": "BSD-3-Clause" }, "node_modules/@protobufjs/path": { @@ -4637,28 +4636,6 @@ "@types/node": "*" } }, - "node_modules/@types/eslint": { - "version": "9.6.1", - "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-9.6.1.tgz", - "integrity": "sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/estree": "*", - "@types/json-schema": "*" - } - }, - "node_modules/@types/eslint-scope": { - "version": "3.7.7", - "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.7.tgz", - "integrity": "sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/eslint": "*", - "@types/estree": "*" - } - }, "node_modules/@types/estree": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", @@ -6535,39 +6512,12 @@ } }, "node_modules/bson": { - "version": "4.7.2", - "resolved": "https://registry.npmjs.org/bson/-/bson-4.7.2.tgz", - "integrity": "sha512-Ry9wCtIZ5kGqkJoi6aD8KjxFZEx78guTQDnpXWiNthsxzrxAK/i8E6pCHAIZTbaEFWcOCvbecMukfK7XUvyLpQ==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/bson/-/bson-7.2.0.tgz", + "integrity": "sha512-YCEo7KjMlbNlyHhz7zAZNDpIpQbd+wOEHJYezv0nMYTn4x31eIUM2yomNNubclAt63dObUzKHWsBLJ9QcZNSnQ==", "license": "Apache-2.0", - "dependencies": { - "buffer": "^5.6.0" - }, "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/bson/node_modules/buffer": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT", - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" + "node": ">=20.19.0" } }, "node_modules/buffer": { @@ -8996,14 +8946,14 @@ } }, "node_modules/enhanced-resolve": { - "version": "5.20.1", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.20.1.tgz", - "integrity": "sha512-Qohcme7V1inbAfvjItgw0EaxVX5q2rdVEZHRBrEQdRZTssLDGsL8Lwrznl8oQ/6kuTJONLaDcGjkNP247XEhcA==", + "version": "5.21.6", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.21.6.tgz", + "integrity": "sha512-aNnGCvbJ/RIyWo1IuhNdVjnNF+EjH9wpzpNHt+ci/m9He9LJvUN8wrCcXjp9cWsGNAuvSpVFTx/vraAFQ8qGjQ==", "dev": true, "license": "MIT", "dependencies": { "graceful-fs": "^4.2.4", - "tapable": "^2.3.0" + "tapable": "^2.3.3" }, "engines": { "node": ">=10.13.0" @@ -9116,9 +9066,9 @@ "license": "MIT" }, "node_modules/es-module-lexer": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.0.0.tgz", - "integrity": "sha512-5POEcUuZybH7IdmGsD8wlf0AI55wMecM9rVBTI/qEAy2c1kTOm3DjFYjrBdI2K3BaJjJYfYFeRtM0t9ssnRuxw==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.1.0.tgz", + "integrity": "sha512-n27zTYMjYu1aj4MjCWzSP7G9r75utsaoc8m61weK+W8JMBGGQybd43GstCXZ3WNmSFtGT9wi59qQTW6mhTR5LQ==", "dev": true, "license": "MIT" }, @@ -12936,9 +12886,9 @@ "license": "MIT" }, "node_modules/loader-runner": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.1.tgz", - "integrity": "sha512-IWqP2SCPhyVFTBtRcgMHdzlf9ul25NwaFx4wCEH/KjAXuuHY4yNjvPXsBokp8jCB936PyWRaPKUNh8NvylLp2Q==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.2.tgz", + "integrity": "sha512-DFEqQ3ihfS9blba08cLfYf1NRAIEm+dDjic073DRDc3/JspI/8wYmtDsHwd3+4hwvdxSK7PGaElfTmm0awWJ4w==", "dev": true, "license": "MIT", "engines": { @@ -15328,9 +15278,9 @@ "license": "MIT" }, "node_modules/protobufjs": { - "version": "7.5.8", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.5.8.tgz", - "integrity": "sha512-dvpCIeLPbXZS/Ete7yLaO7RenOdken2NHKykBXbsaGxZT0UTltcarBciw+A78SRQs9iMAAVpsYA+l8b1hTePIA==", + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.6.0.tgz", + "integrity": "sha512-LtESOsMPTZgyYtwxhvdgdjGL0HmXEaRA/hVD6sol4zA60hVXXXP/SGmxnqDbgGE8gy7pYex7cym+5vYPcmaXBQ==", "hasInstallScript": true, "license": "BSD-3-Clause", "dependencies": { @@ -15338,14 +15288,14 @@ "@protobufjs/base64": "^1.1.2", "@protobufjs/codegen": "^2.0.5", "@protobufjs/eventemitter": "^1.1.0", - "@protobufjs/fetch": "^1.1.0", + "@protobufjs/fetch": "^1.1.1", "@protobufjs/float": "^1.0.2", - "@protobufjs/inquire": "^1.1.1", + "@protobufjs/inquire": "^1.1.2", "@protobufjs/path": "^1.1.2", "@protobufjs/pool": "^1.1.0", "@protobufjs/utf8": "^1.1.1", "@types/node": ">=13.7.0", - "long": "^5.0.0" + "long": "^5.3.2" }, "engines": { "node": ">=12.0.0" @@ -17016,9 +16966,9 @@ "license": "BSD-3-Clause" }, "node_modules/sql-formatter": { - "version": "15.7.4", - "resolved": "https://registry.npmjs.org/sql-formatter/-/sql-formatter-15.7.4.tgz", - "integrity": "sha512-87VsXfl9ng7oNZlV0p3c/DfraFneH4EPYZ1F7v+ZbGTdddtI0FHcqRRshJx6/Sy7saXOiCwstw0J2cP4Z6Xj5A==", + "version": "15.8.0", + "resolved": "https://registry.npmjs.org/sql-formatter/-/sql-formatter-15.8.0.tgz", + "integrity": "sha512-HnjdRHlSsO4Ap2erB5YXAvWggrnk/S4TezUn8zmpq9J/hEKn9+6gGaqiKPyDtI10Xf4zJmHYPREGjMjZmmP1fg==", "license": "MIT", "dependencies": { "argparse": "^2.0.1", @@ -17266,9 +17216,9 @@ "license": "MIT" }, "node_modules/tapable": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.3.0.tgz", - "integrity": "sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg==", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.3.3.tgz", + "integrity": "sha512-uxc/zpqFg6x7C8vOE7lh6Lbda8eEL9zmVm/PLeTPBRhh1xCgdWaQ+J1CUieGpIfm2HdtsUpRv+HshiasBMcc6A==", "dev": true, "license": "MIT", "engines": { @@ -17405,9 +17355,9 @@ } }, "node_modules/terser-webpack-plugin": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.4.0.tgz", - "integrity": "sha512-Bn5vxm48flOIfkdl5CaD2+1CiUVbonWQ3KQPyP7/EuIl9Gbzq/gQFOzaMFUEgVjB1396tcK0SG8XcNJ/2kDH8g==", + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.6.0.tgz", + "integrity": "sha512-Eum+5ajkaOhf5KbM26osvv21kLD7BaGqQ1UA4Ami4arYwylmGUQTgHFpHDdmJod1q4QXa66p0to/FBKID+J1vA==", "dev": true, "license": "MIT", "dependencies": { @@ -17427,12 +17377,39 @@ "webpack": "^5.1.0" }, "peerDependenciesMeta": { + "@minify-html/node": { + "optional": true + }, "@swc/core": { "optional": true }, + "@swc/css": { + "optional": true + }, + "@swc/html": { + "optional": true + }, + "clean-css": { + "optional": true + }, + "cssnano": { + "optional": true + }, + "csso": { + "optional": true + }, "esbuild": { "optional": true }, + "html-minifier-terser": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "postcss": { + "optional": true + }, "uglify-js": { "optional": true } @@ -18233,13 +18210,12 @@ } }, "node_modules/webpack": { - "version": "5.106.2", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.106.2.tgz", - "integrity": "sha512-wGN3qcrBQIFmQ/c0AiOAQBvrZ5lmY8vbbMv4Mxfgzqd/B6+9pXtLo73WuS1dSGXM5QYY3hZnIbvx+K1xxe6FyA==", + "version": "5.107.1", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.107.1.tgz", + "integrity": "sha512-mvdIWxj/H6QsfgDdH9djne3a5dYcmEmtsXGESkypaGN5jXjF/b+9KDlmTDQ2TKlFUeA2fI9Y65kihD30JOdB+Q==", "dev": true, "license": "MIT", "dependencies": { - "@types/eslint-scope": "^3.7.7", "@types/estree": "^1.0.8", "@types/json-schema": "^7.0.15", "@webassemblyjs/ast": "^1.14.1", @@ -18249,20 +18225,20 @@ "acorn-import-phases": "^1.0.3", "browserslist": "^4.28.1", "chrome-trace-event": "^1.0.2", - "enhanced-resolve": "^5.20.0", - "es-module-lexer": "^2.0.0", + "enhanced-resolve": "^5.21.4", + "es-module-lexer": "^2.1.0", "eslint-scope": "5.1.1", "events": "^3.2.0", "glob-to-regexp": "^0.4.1", "graceful-fs": "^4.2.11", - "loader-runner": "^4.3.1", + "loader-runner": "^4.3.2", "mime-db": "^1.54.0", "neo-async": "^2.6.2", "schema-utils": "^4.3.3", "tapable": "^2.3.0", - "terser-webpack-plugin": "^5.3.17", + "terser-webpack-plugin": "^5.5.0", "watchpack": "^2.5.1", - "webpack-sources": "^3.3.4" + "webpack-sources": "^3.4.1" }, "bin": { "webpack": "bin/webpack.js" @@ -18475,9 +18451,9 @@ } }, "node_modules/webpack-sources": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.3.4.tgz", - "integrity": "sha512-7tP1PdV4vF+lYPnkMR0jMY5/la2ub5Fc/8VQrrU+lXkiM6C4TjVfGw7iKfyhnTQOsD+6Q/iKw0eFciziRgD58Q==", + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.4.1.tgz", + "integrity": "sha512-eACpxRN02yaawnt+uUNIF7Qje6A9zArxBbcAJjK1PK3S9Ycg5jIuJ8pW4q8EMnwNZCEGltcjkRx1QzOxOkKD8A==", "dev": true, "license": "MIT", "engines": { diff --git a/package.json b/package.json index 555f6e26..475d2c36 100644 --- a/package.json +++ b/package.json @@ -87,7 +87,7 @@ "prompt": "^1.3.0", "sitemap": "^8.0.3", "terser": "^5.46.2", - "webpack": "^5.106.2", + "webpack": "^5.107.1", "webpack-bundle-analyzer": "^5.3.0", "webpack-dev-server": "^5.0.4", "webpack-node-externals": "^3.0.0", @@ -111,7 +111,7 @@ "bootstrap-colorpicker": "^3.4.0", "bootstrap-material-design": "^4.1.3", "browserify-zlib": "^0.2.0", - "bson": "^4.7.2", + "bson": "^7.2.0", "buffer": "^6.0.3", "cbor": "9.0.2", "chi-squared": "^1.1.0", @@ -169,7 +169,7 @@ "path": "^0.12.7", "popper.js": "^1.16.1", "process": "^0.11.10", - "protobufjs": "^7.5.8", + "protobufjs": "^7.6.0", "punycode.js": "^2.3.1", "qr-image": "^3.2.0", "reflect-metadata": "^0.2.2", @@ -178,7 +178,7 @@ "snackbarjs": "^1.1.0", "sortablejs": "^1.15.7", "split.js": "^1.6.5", - "sql-formatter": "^15.7.4", + "sql-formatter": "^15.8.0", "ssdeep.js": "0.0.3", "stream-browserify": "^3.0.0", "tesseract.js": "^6.0.1", diff --git a/src/core/operations/BSONDeserialise.mjs b/src/core/operations/BSONDeserialise.mjs index cb46b357..d52bde1b 100644 --- a/src/core/operations/BSONDeserialise.mjs +++ b/src/core/operations/BSONDeserialise.mjs @@ -5,7 +5,7 @@ */ import Operation from "../Operation.mjs"; -import bson from "bson"; +import { deserialize } from "bson"; import OperationError from "../errors/OperationError.mjs"; /** @@ -37,7 +37,7 @@ class BSONDeserialise extends Operation { if (!input.byteLength) return ""; try { - const data = bson.deserialize(new Buffer(input)); + const data = deserialize(new Uint8Array(input)); return JSON.stringify(data, null, 2); } catch (err) { throw new OperationError(err.toString()); diff --git a/src/core/operations/BSONSerialise.mjs b/src/core/operations/BSONSerialise.mjs index 25eed876..cd975cbb 100644 --- a/src/core/operations/BSONSerialise.mjs +++ b/src/core/operations/BSONSerialise.mjs @@ -5,7 +5,7 @@ */ import Operation from "../Operation.mjs"; -import bson from "bson"; +import { serialize } from "bson"; import OperationError from "../errors/OperationError.mjs"; /** @@ -38,7 +38,8 @@ class BSONSerialise extends Operation { try { const data = JSON.parse(input); - return bson.serialize(data).buffer; + const result = serialize(data); + return result.buffer.slice(result.byteOffset, result.byteOffset + result.byteLength); } catch (err) { throw new OperationError(err.toString()); } diff --git a/src/core/operations/ParseObjectIDTimestamp.mjs b/src/core/operations/ParseObjectIDTimestamp.mjs index f86c098e..1b16f68a 100644 --- a/src/core/operations/ParseObjectIDTimestamp.mjs +++ b/src/core/operations/ParseObjectIDTimestamp.mjs @@ -6,7 +6,7 @@ import Operation from "../Operation.mjs"; import OperationError from "../errors/OperationError.mjs"; -import BSON from "bson"; +import { ObjectId } from "bson"; /** * Parse ObjectID timestamp operation @@ -35,7 +35,7 @@ class ParseObjectIDTimestamp extends Operation { */ run(input, args) { try { - const objectId = new BSON.ObjectID(input); + const objectId = new ObjectId(input); return objectId.getTimestamp().toISOString(); } catch (err) { throw new OperationError(err); diff --git a/src/web/App.mjs b/src/web/App.mjs index 143545d6..e84363f8 100644 --- a/src/web/App.mjs +++ b/src/web/App.mjs @@ -42,6 +42,14 @@ class App { this.progress = 0; this.ingId = 0; + // stateChangeId increments on every statechange dispatch; bakeStateId records + // the stateChangeId captured when the most recent bake started. autoBake uses + // these to decide whether the output is genuinely stale, so a debounced + // autoBake firing shortly after a manual bake doesn't clobber the bake's + // hideStaleIndicator with a redundant showStaleIndicator. + this.stateChangeId = 0; + this.bakeStateId = -1; + this.appLoaded = false; this.workerLoaded = false; this.waitersLoaded = false; @@ -136,6 +144,9 @@ class App { bake(step=false) { if (this.baking) return; + // Record which state version this bake is covering. + this.bakeStateId = this.stateChangeId; + // Reset attemptHighlight flag this.options.attemptHighlight = true; @@ -166,7 +177,10 @@ class App { nums: [this.manager.tabs.getActiveTab("input")], step: false }); - } else { + } else if (this.bakeStateId < this.stateChangeId) { + // Only show stale-indicator if the most recent bake didn't cover the + // current state. Without this guard, a debounced autoBake firing after + // a manual bake completed would re-show the indicator on fresh output. this.manager.controls.showStaleIndicator(); } } @@ -768,6 +782,10 @@ class App { * @param {event} e */ stateChange(e) { + // Bump the state-change counter synchronously so a manual bake invoked between + // here and the debounced autoBake firing can record it via bakeStateId. + this.stateChangeId++; + debounce(function() { this.progress = 0; this.autoBake(); diff --git a/src/web/html/index.html b/src/web/html/index.html index 335f8c44..6ce8dd9a 100755 --- a/src/web/html/index.html +++ b/src/web/html/index.html @@ -868,15 +868,15 @@ Be aware that the standalone version will never update itself, meaning it will not receive bug fixes or new features until you re-download newer versions manually.

-
CyberChef v<%= htmlWebpackPlugin.options.version %>
+
CyberChef <%= htmlWebpackPlugin.options.version %>
- Download ZIP file + Download ZIP file