by londons_explore · 11mo ago · 0 comments
I=c=>c.map?c[0]?c.reduce((a,b)=>a[b=I(b)]||a(b),self):c[1]:c
(How it works is an exercise to the reader)
The actual code to run can be delivered as an innocuous looking JavaScript array from some server, and potentially only delivered to one high value target.
Wow, it deconstructed it beautifully
A Concrete Example Imagine you pass this array to the function: ['alert', 'Hello World'] Here is the step-by-step execution:
Initialization: The accumulator a starts as self (the window object).
Iteration 1 (b = "alert"):
I("alert") returns string "alert".
It tries a["alert"] (which is window["alert"]).
This finds the alert function.
New Accumulator a: The alert function.
Iteration 2 (b = "Hello World"):
I("Hello World") returns string "Hello World".
It tries a["Hello World"]. The alert function does not have a property named "Hello World", so this is undefined.
The || operator moves to the right side: a(b).
It executes alert("Hello World").
Result: A browser popup appears.Mozilla allows minification but you're required to provide the original buildable source. Mozilla actually looks at the code and they reject updates all the time.
https://blog.chromium.org/2018/10/trustworthy-chrome-extensi...