fix(createproxy): allow proxy under non-eval csp #274
Merged
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.
Description
I think this is fix to somewhat specific usecases, but hope this is not hurting general environments but also fixes my problem.
In our application we use comlink to communicate between the different context in Electron (https://electronjs.org/), specifically for now being used between
preload
script to actual web page we load into BrowserWindow. Since we inject script in preload it does not have url for endpoint while our endpoint have CSP policy to prevent execution of script viaeval
or similar way - and usingnew Function()
violates those rules.And effectively blocks to create new proxy object in preload context we created.
This PR replaces creation of function in non-eval way to allow preload script can run under specific CSP policy.