Skip to content

Commit bd00846

Browse files
Replaced monaco-editor bundled dompurify with 3.2.4 version (#242522)
## Summary `kbn-ui-shared-deps-src` embeds DOMPurify 3.0.5 instead of 3.2.4 because Monaco Editor bundles its own DOMPurify 3.0.5. `@kbn/monaco` imports from `monaco-editor`, which includes a bundled DOMPurify 3.0.5 at `node_modules/monaco-editor/esm/vs/base/browser/dompurify/dompurify.js` ## How to test Build and check that we have embedded DOMPurify 3.2.4 ```grep -a "@license DOMPurify" kibana/target/build/src/platform/packages/private/kbn-ui-shared-deps-src/shared_built_assets/kbn-ui-shared-deps-src.js``` ### Checklist - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [x] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels.
1 parent 57a3dc7 commit bd00846

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/platform/packages/private/kbn-ui-shared-deps-src/webpack.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const UiSharedDepsNpm = require('@kbn/ui-shared-deps-npm');
2020
const { distDir: UiSharedDepsSrcDistDir } = require('./src/definitions');
2121

2222
const MOMENT_SRC = require.resolve('moment/min/moment-with-locales.js');
23+
const DOMPURIFY_SRC = require.resolve('dompurify/purify.js');
2324
const { REPO_ROOT } = require('@kbn/repo-info');
2425

2526
/** @returns {import('webpack').Configuration} */
@@ -154,5 +155,12 @@ module.exports = {
154155
context: REPO_ROOT,
155156
manifest: require(UiSharedDepsNpm.dllManifestPath), // eslint-disable-line import/no-dynamic-require
156157
}),
158+
159+
// Replace Monaco Editor's bundled DOMPurify 3.0.5 with the project's DOMPurify 3.2.4
160+
// Monaco Editor imports DOMPurify using relative paths like './dompurify/dompurify.js' or '../../dompurify/dompurify.js'
161+
new webpack.NormalModuleReplacementPlugin(
162+
/(\.\.\/)*(\.\/)?dompurify[/\\]dompurify\.js$/,
163+
DOMPURIFY_SRC
164+
),
157165
],
158166
};

0 commit comments

Comments
 (0)