Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
fix: add security warning about Mapbox token in HTML exports (#3139) (#3330)
pierreeuropecec11f3cbab6
diff --git a/src/components/src/modals/export-map-modal/export-html-map.tsx b/src/components/src/modals/export-map-modal/export-html-map.tsxindex 1c14d836e..086ba962a 100644--- a/src/components/src/modals/export-map-modal/export-html-map.tsx+++ b/src/components/src/modals/export-map-modal/export-html-map.tsx@@ -105,6 +105,9 @@ function ExportHtmlMapFactory(): React.ComponentType<ExportHtmlMapProps> {<StyledWarning><FormattedMessage id={'modal.exportMap.html.tokenMisuseWarning'} /></StyledWarning>+ <StyledWarning>+ <FormattedMessage id={'modal.exportMap.html.tokenSecurityWarning'} />+ </StyledWarning><FormattedMessage id={'modal.exportMap.html.tokenDisclaimer'} /><ExportMapLink href={EXPORT_HTML_MAP_DOC}><FormattedMessage id={'modal.exportMap.html.tokenUpdate'} />diff --git a/src/localization/src/translations/en.ts b/src/localization/src/translations/en.tsindex 67d2578a3..96fd28428 100644--- a/src/localization/src/translations/en.ts+++ b/src/localization/src/translations/en.ts@@ -388,6 +388,8 @@ export default {tokenPlaceholder: 'Paste your Mapbox access token',tokenMisuseWarning:'* If you do not provide your own token, the map may fail to display at any time when we replace ours to avoid misuse. ',+ tokenSecurityWarning:+ '* Warning: your Mapbox token will be embedded in the exported HTML file. Anyone with access to this file can see and use your token. Use a scoped token with URL restrictions when possible. ',tokenDisclaimer: 'You can change the Mapbox token later using the following instructions: ',tokenUpdate: 'How to update an existing map token.',modeTitle: 'Map Mode',diff --git a/src/utils/src/export-map-html.ts b/src/utils/src/export-map-html.tsindex 6d4da3bc3..f335a3ac5 100644--- a/src/utils/src/export-map-html.ts+++ b/src/utils/src/export-map-html.ts@@ -63,6 +63,12 @@ export const exportMapToHTML = (options, version = KEPLER_GL_VERSION) => {</style><!--MapBox token-->+ <!--+ SECURITY NOTE: Your Mapbox access token is embedded below in plain text.+ Anyone with access to this HTML file can see and use this token.+ Consider using a scoped token with URL restrictions to limit misuse.+ See: https://docs.mapbox.com/accounts/guides/tokens/#url-restrictions+ --><script>/*** Provide your MapBox Token