Skip to content

Commit e8f6a7d

Browse files
authored
Merge pull request #8035 from plotly/cam/8031/upgrade-maplibre-v6
fix: Upgrade MapLibre to v6 to address CVE
2 parents 174319a + f3d750b commit e8f6a7d

18 files changed

Lines changed: 368 additions & 108 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,16 @@ jobs:
599599
- name: Verify entry point declarations are in sync
600600
run: npm run entry-point-types-check
601601

602+
maplibre-worker-drift:
603+
needs: install-and-cibuild
604+
runs-on: ubuntu-latest
605+
steps:
606+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
607+
- uses: ./.github/actions/setup-workspace
608+
609+
- name: Verify the inlined maplibre-gl worker is in sync
610+
run: npm run maplibre-worker-diff-check
611+
602612
package-resolution:
603613
needs: install-and-cibuild
604614
runs-on: ubuntu-latest

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ node_modules
22

33
build/*
44
!build/plotcss.js
5+
!build/maplibre_worker.js
56
!build/README.md
67

78
dist/*.LICENSE.txt

‎.npmignore‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# Exclude all hidden files and folders
22
.*
33

4-
# Exclude all files in build/, except for plotcss.js and README.md
4+
# Exclude all files in build/, except for those required when bundling the package
55
build/*
66
!build/plotcss.js
7+
!build/maplibre_worker.js
78
!build/README.md
89

910
# Exclude these directories

‎CONTRIBUTING.md‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,11 @@ files.
220220

221221
#### Other npm scripts that may be of interest in development
222222

223-
- `npm run preprocess`: pre-processes the css and svg source file in js. This
224-
script must be run manually when updating the css and svg source files.
223+
- `npm run preprocess`: regenerates the sources that the build depends on, and
224+
must be run manually when their inputs change. Commit the result.
225+
`build/README.md` describes the committed files under `build/` and what
226+
triggers each one. Note that the `preprocess` step is always run automatically
227+
as part of `npm run build`.
225228

226229
## Testing
227230

@@ -386,7 +389,14 @@ If you would like a link to the dev build for your PR but don't have permission
386389
- All tasks can be run using [`npm run-script`](https://docs.npmjs.com/cli/run-script)
387390
- Tests are in `test/`; they are partitioned into `image` and `jasmine` tests
388391
- Test dashboard and image viewer code is in `devtools/`
389-
- Built files are in `build/` (the files in here are git-ignored, except for `plotcss.js`)
392+
- Built files are in `build/` (mostly git-ignored, with a few exceptions: see `build/README.md`)
393+
394+
### The bundled maplibre-gl worker
395+
396+
`map` traces render through `maplibre-gl`, which parses tiles in a web worker.
397+
As of v6, the library no longer includes a UMD bundle with this code. As such,
398+
it's now necessary to extract it and include it as part of the build process.
399+
See `tasks/util/bundle_maplibre_worker.js` for more information.
390400

391401
## Trace module design
392402

‎build/README.md‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,15 @@
1-
Directory of non-distributed built files
1+
## Directory of generated build files
2+
3+
Most of what lands here is scratch output that git and npm both ignore. The dev server and the image tests read their bundles from here.
4+
5+
There are exceptions for the files listed below. These files are used in the build process, but need to be generated prior to that.
6+
7+
- `plotcss.js`: The stylesheet compiled from `src/css/style.scss`. Required by `src/core.js`.
8+
- `maplibre_worker.js`: The maplibre-gl web worker, bundled into one standalone script and exported as a string. `src/plots/map/map.js` requires it and turns the string into a blob URL.
9+
10+
These files are committed and shipped in the npm package. Anyone who installs plotly.js and bundles it from `lib/` or `src/` resolves all of these, so leaving any out of the package breaks that build. These are specifically allowlisted in `.gitignore` and `.npmignore` for that reason.
11+
12+
`npm run preprocess` regenerates these files. Run that command and commit the result whenever the input changes.
13+
14+
- For `maplibre_worker.js` this means every time the version of `maplibre-gl` is updated in `package.json`. The worker file must match the `maplibre-gl` version used by plotly.js. The command `npm run maplibre-worker-diff-check` runs in CI to verify that the two are in sync.
15+
- For `plotcss.js` this means every time a stylesheet under `src/css/` changes, including the partials that `style.scss` pulls in with `@use`. The same command also writes `dist/plotly.css`, which strict-CSP applications load instead of the inlined styles.

‎build/maplibre_worker.js‎

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎draftlogs/8035_change.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- Update `maplibre-gl` to v6 to address [CVE-2026-85061](https://github.com/advisories/GHSA-jrc7-96c5-q579) [[#8035](https://github.com/plotly/plotly.js/pull/8035)]
2+
- `maplibre-gl` v6 dropped WebGL1 support, so some older browsers won't be able to use the map traces. Safari 15, Chrome 56, Firefox 51 and later are now required for the map traces.

‎draftlogs/8035_fix.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Box and lasso selection of `scattermap` points are now supported on a rotated or pitched map [[#8035](https://github.com/plotly/plotly.js/pull/8035)]

‎package-lock.json‎

Lines changed: 32 additions & 74 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"locales": "node tasks/locales.mjs",
4545
"schema": "node tasks/schema.mjs",
4646
"schema-typegen-diff-check": "npm run schema && git diff --exit-code src/types/generated/schema.d.ts test/plot-schema.json",
47+
"maplibre-worker-diff-check": "npm run preprocess && git diff --exit-code build/maplibre_worker.js",
4748
"entry-point-types": "node tasks/entry_point_types.mjs",
4849
"entry-point-types-check": "node tasks/entry_point_types.mjs --check",
4950
"stats": "node tasks/stats.mjs",
@@ -109,7 +110,7 @@
109110
"has-hover": "^1.0.1",
110111
"has-passive-events": "^1.0.0",
111112
"is-mobile": "^5.0.0",
112-
"maplibre-gl": "^5.24.0",
113+
"maplibre-gl": "6.9.0",
113114
"mouse-event-offset": "^3.0.2",
114115
"native-promise-only": "^0.8.1",
115116
"parse-svg-path": "^0.2.0",

0 commit comments

Comments
 (0)