From 434acecd0ec955bdf5bfa8f3418702642d3aab24 Mon Sep 17 00:00:00 2001 From: Fra3zz <112791937+Fra3zz@users.noreply.github.com> Date: Mon, 15 Jun 2026 07:08:27 -0500 Subject: [PATCH] Implimented compatable CSP. Currently uses self for all but style due to css injection. --- src/web/html/index.html | 151 ++++----------------- src/web/index_assets/ieCheck.js | 5 + src/web/index_assets/loadTheme.js | 108 +++++++++++++++ src/web/index_assets/style.css | 59 ++++++++ src/web/waiters/BackgroundWorkerWaiter.mjs | 2 +- src/web/waiters/InputWaiter.mjs | 4 +- src/web/waiters/OutputWaiter.mjs | 2 +- src/web/waiters/WorkerWaiter.mjs | 4 +- webpack.config.js | 15 +- 9 files changed, 213 insertions(+), 137 deletions(-) create mode 100644 src/web/index_assets/ieCheck.js create mode 100644 src/web/index_assets/loadTheme.js create mode 100644 src/web/index_assets/style.css diff --git a/src/web/html/index.html b/src/web/html/index.html index 6ce8dd9a..ca7e3aa9 100755 --- a/src/web/html/index.html +++ b/src/web/html/index.html @@ -25,114 +25,15 @@
Please note that these options will persist between sessions.
+Please note that these options will persist between sessions.
A simple, intuitive web app for analysing and decoding data without having to deal with complex tools or programming languages. CyberChef encourages both technical and non-technical people to explore data formats, encryption and compression.
There are hundreds of useful operations in CyberChef for anyone working on anything vaguely Internet-related, whether you just want to convert a timestamp to a different format, decompress gzipped data, create a SHA3 hash, or parse an X.509 certificate to find out who issued it.
It’s the Cyber Swiss Army Knife.
+
" + escapeHtml(msg) + ""; +}; +window.addEventListener("error", loadingErrorHandler); diff --git a/src/web/index_assets/style.css b/src/web/index_assets/style.css new file mode 100644 index 00000000..011bf897 --- /dev/null +++ b/src/web/index_assets/style.css @@ -0,0 +1,59 @@ +#banner .col:first-child { + text-align: left; + padding-left: 10px; +} + +#banner .col:last-child { + text-align: right; + padding-right: 0; +} + +#controls-content .form-group { + display: contents; +} + +#open-folder, +#open-file { + display: none; +} + +#input-tabs-wrapper, +#output-tabs-wrapper { + display: none; +} + +#save-all-to-file { + display: none; +} + +#save-link-group h6 { + display: inline; +} + +#save-link { + word-wrap: break-word; +} + +#options-body > p:first-child { + font-weight: bold; +} + +.favourites-action-label { + font-weight: bold; +} + +#about, +#keybindings { + padding: 20px; +} + +.fork-me-ribbon { + position: absolute; + top: 0; + right: 0; + border: 0; +} + +.clear-both { + clear: both; +} diff --git a/src/web/waiters/BackgroundWorkerWaiter.mjs b/src/web/waiters/BackgroundWorkerWaiter.mjs index 409c2bbb..fccd26fa 100644 --- a/src/web/waiters/BackgroundWorkerWaiter.mjs +++ b/src/web/waiters/BackgroundWorkerWaiter.mjs @@ -4,7 +4,7 @@ * @license Apache-2.0 */ -import ChefWorker from "worker-loader?inline=no-fallback!../../core/ChefWorker.js"; +import ChefWorker from "worker-loader!../../core/ChefWorker.js"; /** * Waiter to handle conversations with a ChefWorker in the background. diff --git a/src/web/waiters/InputWaiter.mjs b/src/web/waiters/InputWaiter.mjs index 94663a0b..0694d3dc 100644 --- a/src/web/waiters/InputWaiter.mjs +++ b/src/web/waiters/InputWaiter.mjs @@ -5,8 +5,8 @@ * @license Apache-2.0 */ -import LoaderWorker from "worker-loader?inline=no-fallback!../workers/LoaderWorker.js"; -import InputWorker from "worker-loader?inline=no-fallback!../workers/InputWorker.mjs"; +import LoaderWorker from "worker-loader!../workers/LoaderWorker.js"; +import InputWorker from "worker-loader!../workers/InputWorker.mjs"; import Utils, {debounce} from "../../core/Utils.mjs"; import {toBase64} from "../../core/lib/Base64.mjs"; import cptable from "codepage"; diff --git a/src/web/waiters/OutputWaiter.mjs b/src/web/waiters/OutputWaiter.mjs index 2b2cb096..61c77aed 100755 --- a/src/web/waiters/OutputWaiter.mjs +++ b/src/web/waiters/OutputWaiter.mjs @@ -10,7 +10,7 @@ import Dish from "../../core/Dish.mjs"; import {isUTF8, CHR_ENC_SIMPLE_REVERSE_LOOKUP} from "../../core/lib/ChrEnc.mjs"; import {detectFileType} from "../../core/lib/FileType.mjs"; import FileSaver from "file-saver"; -import ZipWorker from "worker-loader?inline=no-fallback!../workers/ZipWorker.mjs"; +import ZipWorker from "worker-loader!../workers/ZipWorker.mjs"; import { EditorView, diff --git a/src/web/waiters/WorkerWaiter.mjs b/src/web/waiters/WorkerWaiter.mjs index 296aa956..ca4695ee 100644 --- a/src/web/waiters/WorkerWaiter.mjs +++ b/src/web/waiters/WorkerWaiter.mjs @@ -5,8 +5,8 @@ * @license Apache-2.0 */ -import ChefWorker from "worker-loader?inline=no-fallback!../../core/ChefWorker.js"; -import DishWorker from "worker-loader?inline=no-fallback!../workers/DishWorker.mjs"; +import ChefWorker from "worker-loader!../../core/ChefWorker.js"; +import DishWorker from "worker-loader!../workers/DishWorker.mjs"; import { debounce } from "../../core/Utils.mjs"; /** diff --git a/webpack.config.js b/webpack.config.js index 4c6c00ba..e97c845b 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -99,6 +99,9 @@ module.exports = { context: "node_modules/node-forge/dist", from: "prime.worker.min.js", to: "assets/forge/" + }, { + from: "src/web/index_assets/", + to: "assets/index_assets/" } ] }), @@ -202,7 +205,10 @@ module.exports = { }, { test: /\.svg$/, - type: "asset/inline", + type: "asset/resource", + generator: { + filename: "assets/[hash][ext]" + } }, { // Store font .fnt and .png files in a separate fonts folder test: /(\.fnt$|bmfonts\/.+\.png$)/, @@ -219,10 +225,13 @@ module.exports = { filename: "images/[name][ext]" } }, - { // Third party images are inlined + { // Third party images served as files test: /\.(png|jpg|gif)$/, exclude: /web\/static/, - type: "asset/inline", + type: "asset/resource", + generator: { + filename: "assets/[hash][ext]" + } }, ] },