-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Maps] Use static worker with mapbox-gl #40667
Closed
thomasneirynck
wants to merge
1
commit into
elastic:master
from
thomasneirynck:maps/load_mapboxgl_with_worker
+5
−6
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove the
worker-src blob:
andchild-src blob:
directives because of this change.The
script-src
directive, as is, will no longer work as the mapbox-gl code is now trying to load an external script. We could modify it and addstrict-dynamic
(?)e.g.:
This is the suggested work-around as discussed here for workers and nonce-based policies w3c/webappsec-csp#375.
Maybe we should load mapbox-gl in a separate script tag (and not as a vendors-bundle), and only enable
strict-dynamic
for mapbox-gl?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume we don't have any options for specifying the
nonce
attribute on the script tag which is added to the DOM?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. We don't have control over how the worker-script loaded by
mapbox-gl-csp.js
, which in turn loads content withimportScripts
.If we want to preserve a custom
script-src
directive withnonce
based security (do we want this in the long run (?)), maybe we could modify how we load scripts and provided nonces on all<script>
tags (same as now), but loadmapbox-gl-csp.js
in a separate script-tag (different as now, as it is packaged withvendors.dll.js
now). Only for thatmapbox-gl-csp.js
script, we could enablestrict-dynamic
, because it's I think the only script which loads child-scripts (ie. the worker).^ just a thought. Not 100% sure about the impact of adding
strict-dynamic
(or the removal ofscript-src
directive completely for that matter).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At this time, that's the intent. There's potential for us to switch to
script-src 'unsafe-inline' 'self'
but it's not something we have a plan to do.I believe that we have to add
strict-dynamic
as the CSP policy which applies to all scripts, I don't believe there's a way to scope this to only a single script tag.