Closed Bug 1550471 Opened 6 years ago Closed 5 years ago

Usage of `new Function` in third-party library jszip.js

Categories

(Core :: DOM: Security, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla70
Tracking Status
firefox70 --- fixed

People

(Reporter: jallmann, Assigned: jdescottes)

References

(Blocks 1 open bug)

Details

(Whiteboard: [domsecurity-backlog1])

Attachments

(2 files)

All eval()-like functions (eval(), new Function(), setTimeout("")) are being removed from code running with system privileges, see Bug 1473549. An assertion is active to enforce this.

There are two occurences of new Function in jszip.js that require the file to be whitelisted for this assertion. In order to clear jszip.js from the whitelist, new Function needs to be removed or refactored.

new Function to get the global object:

https://searchfox.org/mozilla-central/source/devtools/client/shared/vendor/jszip.js#4298

Not sure about second ocurence:

https://searchfox.org/mozilla-central/source/devtools/client/shared/vendor/jszip.js#4393

Thankfully the latest version of JSZip doesn't rely on the very old setImmediate polyfill that was present in our old version. Let's update it.

Assignee: nobody → jdescottes
Status: NEW → ASSIGNED

Depends on D38516

The new version of JSZip doesn't rely on any eval like code.

Pushed by jdescottes@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/cad92991c22e Migrate to JSZip v3.2.1 to avoid usage of eval-like code r=Honza https://hg.mozilla.org/integration/autoland/rev/22539b8e0829 Remove jszip.js from nsContentSecurityManager whitelist r=ckerschb
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: