Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

251
Views
Frontend security - Is it possible to limit access scope?

Given the growing size of frontend code, the concept of micro-frontend and module federation provided by Webpack 5 is a possible solution. However, considering the possibility that you are integrating code from other teams / 3rd parties, the foreign code could potentially try to access information it's not meant to by simply accessing the window object and iterating through its children.

This doesn't have to be critical information like passwords and credit cards, which are often isolated using an iframe. Less sensitive information like user emails, or tracking data could be collected and misused.

In this case, is there any technical set up that doesn't involve iframes that could limit the access scope of scripts? Is this something that could technically be implemented inside a WebAssembly program?

Edit: Yes, the conservative rule is to simply not run untrusted code. The question posed however is if it's technically possible to sandbox frontend code without using iframe to limit its access to information.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Javascript is inherently "public", so at some point stuff you put in or get out will eventually be exposed, either through the network fetch/XHR, or through function execution.

There is a "private" pattern in javascript, which prevents snooping around inside an object -- where you explicitely define the methods/properties that are exposed:

window.myThing = (function(){

    var a = "a";
    var private_b = "b";

    function one(){
        return "one"
    }

    function private_two(){
        return private_b
    }

    return {
        public_a : a,
        public_one : one
    }

}());


for(var prop in window.myThing){
    console.log(prop, window.myThing[prop])
}

// ----------------------------------
// only the following properties 
// are exposed from the window scope:
// ----------------------------------
//  + public_a as - a
//  + public_one as ƒ one()

In theory, this type of pattern could allow for internal (non-exposed/non-traversable) methods and properties... and leverage some form of encryption for "ins and outs".

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!