JS: Add a js/client-side-url-redirect sink/source for importScripts. #4263
Merged
codeql-ci merged 8 commits intogithub:mainfrom Sep 16, 2020
Merged
JS: Add a js/client-side-url-redirect sink/source for importScripts. #4263codeql-ci merged 8 commits intogithub:mainfrom
importScripts. #4263codeql-ci merged 8 commits intogithub:mainfrom
Conversation
importScripts. importScripts.
ee7eeb6 to
03a3c4f
Compare
esbena
reviewed
Sep 15, 2020
Contributor
esbena
left a comment
There was a problem hiding this comment.
LGTM. One question and a nit.
| */ | ||
| class ImportScriptsSink extends ScriptUrlSink { | ||
| ImportScriptsSink() { | ||
| this = DataFlow::globalVarRef("importScripts").getACall().getAnArgument() |
Contributor
There was a problem hiding this comment.
importScripts() and self.importScripts() are effectively equivalent — both represent importScripts() being called from inside the worker's inner scope.
(https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/importScripts)
Do we support the mentioned self.importScripts as well?
Contributor
Author
There was a problem hiding this comment.
We should - I'll add a test for it.
Edit: It worked.
Co-authored-by: Esben Sparre Andreasen <esbena@github.com>
esbena
approved these changes
Sep 15, 2020
Contributor
esbena
left a comment
There was a problem hiding this comment.
(tests are failing though)
Contributor
Author
They just needed a restart. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.


Adds support for the sink and source in CVE-2020-14000.
importScripts() is a global function in WebWorkers that is used for importing scripts.
(It's used quite a lot).
Calling
importScripts(url)does the same as the belowdocument.createElement(..)snippet, but in a WebWorker.This PR also adds support for registering
postMessage(..)handlers usingglobal.onmessage.E.g.