Okay, so the other server just got the secret, right? And the stuff still works. Okay, so what if we want to prevent it? That's where Lavamote comes in and Lavamote generates a policy for you which contains information like this package can access fetch and buffer for other versions of that package that I wanted to demo.
Okay, so with Lavamote, if I do, I have Lavamote wire as npm test. I'm gonna run it and it's gonna say this. It's slightly garbled but it says process did not exist. Process was undefined actually for this package only. So you can use process in the main app or other packages but this package doesn't have access to it.
Okay, so let's do some more hacking. Have you heard of prototype pollution? There was a chance to hear about it today. So if I take object prototype and I define a setter as authorization field on that and I pass authorization header to fetch, fetch is going to call my setter that I set on the global prototype. How funny. Okay, so this is still gonna work under regular node. Okay, and then with, yeah, I got the bearer and the secret. Okay, but if I run under Lava mode, I'm gonna get an error that says cannot define property authorization, object is not extensible. Lava mode is also using a technology behind the scenes called LockDown that locks down everything and it's impossible to tamper with the JavaScript environment itself.
Okay, going back here. So what's the magic? It's called hardened JavaScript. It lets you isolate, in our case, we're using it to isolate each dependency within the same process. There's no other context or realms involved in all of this. It has compartment, LockDown, hardened, yeah let's skip over that. It's becoming part of the language eventually. It's an early stage proposal right now, but coming from people who are responsible for stuff like Command JS, promise in the language, et cetera. If you want to know more, these links are available. And I'm offering to help you set up Lava MultiView project if you get in touch early enough. But I promised I'll evo all the strings, right? So I have one more demo that's, oh, I'm not over time yet. Cool. I made this thing, I used this technology to make this thing where I can run any code and get prompted synchronously for everything it reaches for. So I took actual malware from NPM. It's already removed but it was there. Yeah, let's run it.
Comments