Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do Web Workers Increase (or Decrease) Security?

Do web workers alleviate or intensify any of JavaScript's and the Browser Environment's known security issues?

like image 482
Noah Freitas Avatar asked Oct 09 '12 01:10

Noah Freitas


People also ask

What are web workers good for?

Web Workers are primarily used for CPU-intensive tasks to be run in the background without any network connectivity required to work on the tasks.

What is true about web workers?

Web Workers are a simple means for web content to run scripts in background threads. The worker thread can perform tasks without interfering with the user interface.

What are the limitations of web workers?

Limitations Of Web WorkersA worker can't directly manipulate the DOM and has limited access to methods and properties of the window object. A worker can not be run directly from the filesystem. It can only be run via a server.

How does a web worker work?

A web worker is a piece of browser functionality. It is the real OS threads that can be spawned in the background of your current page so that it can perform complex and resource-intensive tasks. Imagine that you have some large data to fetch from the server, or some complex rendering needs to be done on the UI.


1 Answers

According to the Mozilla Web Workers Security Review:

  • Workers execute in a tightly controlled sandbox.
  • No access to Components or other global JS components.
  • Only basic JS (Math, Date, etc.), timeouts, XHR, and importScripts.
  • Script loading is subject to the same restrictions as on the main thread (content policies, same origin restrictions, etc.).
  • XHR uses the same code as the main thread.

These answered all the security considerations I had.

like image 118
Stumpy7 Avatar answered Oct 27 '22 22:10

Stumpy7