Skip to content

Pin third-party plugin scripts to exact versions - #2362

Open
KhadeerBasha1232 wants to merge 1 commit into
python-visualization:mainfrom
KhadeerBasha1232:pin-cdn-versions
Open

KhadeerBasha1232 wants to merge 1 commit into
python-visualization:mainfrom
KhadeerBasha1232:pin-cdn-versions

Conversation

@KhadeerBasha1232

Copy link
Copy Markdown
Contributor

Pin third-party plugin scripts to exact versions

Several plugins load their JavaScript and CSS from CDN URLs without a fixed version: @latest, or jsDelivr/unpkg URLs with no version at all. The code that runs in a generated map then changes whenever the upstream package or repo changes, without any change in folium. That includes breaking releases, and a compromised package or GitHub account would inject code into every map that uses the plugin.

This already happened in two cases:

  • BoatMarker is broken. leaflet.boatmarker was unpublished from npm on 2026-09-20, so https://unpkg.com/leaflet.boatmarker/leaflet.boatmarker.min.js returns 404 and the map script fails with TypeError: L.boatMarker is not a function. An unpublished npm name can also be registered again by someone else, and folium would load their package.
  • Geocoder silently moved to a new major version. leaflet-control-geocoder went from 4.0.0 to 42.0.0 on 2026-11-15, with breaking changes listed in its release notes, and every folium map using Geocoder picked it up.

Change

Each URL is pinned to the version it serves today, so nothing changes for users:

Plugin Package Pinned to
GeoMan @geoman-io/leaflet-geoman-free 2.20.8 (was @latest)
VectorGridProtobuf leaflet.vectorgrid 1.3.0 (was @latest)
Geocoder leaflet-control-geocoder 42.0.0
TagFilterButton leaflet-tag-filter-button 0.0.5
DualMap jieter/Leaflet.Sync 0.2.4
BeautifyIcon marslan390/BeautifyMarker commit 55e0436 (repo has no tags)
MousePosition ardhi/Leaflet.MousePosition commit c32f1c8 (repo has no tags)
BoatMarker thomasbrueggemann/leaflet.boatmarker commit 1193728, the source of npm 1.1.5, via jsDelivr

The scripts folium hosts itself (leaflet_heat, pa7_*, leaflet.awesome.rotate) are left as they are, since they come from this repository.

Checks

  • For the npm packages and Leaflet.Sync, the pinned URL returns byte-for-byte the same file as the old URL. For BeautifyMarker and MousePosition, jsDelivr minifies the files on the fly. The output is the same apart from the minifier's header comment and source-map line.
  • I rendered a map for each of the 8 plugins and opened it in a browser. Each library loaded and its control or marker appeared (GeoMan toolbar, VectorGrid, BeautifyIcon marker and CSS, both DualMap maps synced, MousePosition control, Geocoder search box, TagFilterButton button, BoatMarker icon). The same BoatMarker page with the current URL fails with the error above.
  • I compared Geocoder with 42.0.0 and 4.0.0 and saw no visible or functional difference for the way folium uses it.
  • I updated the URL assertions in test_beautify_icon.py, test_boat_marker.py, test_dual_map.py and test_tag_filter_button.py.

Several plugins loaded JavaScript and CSS from CDN URLs without a fixed
version (`@latest`, or jsDelivr/unpkg URLs with no version). The code in
every generated map then changes whenever the upstream package or repo
changes, including breaking releases or a compromised account.

Pin each URL to the version it serves today:

- GeoMan: @geoman-io/leaflet-geoman-free 2.20.8
- VectorGridProtobuf: leaflet.vectorgrid 1.3.0
- Geocoder: leaflet-control-geocoder 42.0.0
- TagFilterButton: leaflet-tag-filter-button 0.0.5
- DualMap: Leaflet.Sync 0.2.4
- BeautifyIcon, MousePosition: the current commit of their GitHub repos,
  which have no tags

leaflet.boatmarker was unpublished from npm, so the unpkg URL now returns
404 and BoatMarker fails with "L.boatMarker is not a function". Load it
from its GitHub repo instead, at the commit matching npm version 1.1.5.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch was previously deployed

1 inactive deployment
pypi — e6e59ceb Deployed Nov 19, 2026 by KhadeerBasha1232 via packages #2117
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant