LavaMoat is a set of tools for securing JavaScript projects against a category of attacks called software supply chain attacks.
This genre of attack occurs when a malicious dependency makes it way into a developer's application. An attacker could use the vulerable dependency to then steal important secrets like credit card numbers, private keys, or personal data.
These attacks have already hit the cryptocurrency ecosystem and present a significant risk for the developers and users of wallets and apps.
In order to help mitigate the risk of such an attack we are building a suite of tools that range from a node-based runtime, to plugins for common app bundlers (eg webpack, browserify), to dependecy analysis and visualization tools.
The goal of LavaMoat is to bring added protections to modern JavaScript apps without having to rewrite them from scratch and automate a good first-start security configuration.
- disable/whitelist dependency lifecycle scripts (eg. "postinstall") via @lavamoat/allow-scripts
- run your server or build process in lavamoat-node
- build your ui with LavaMoat for Webpack or Browserify
The LavaMoat runtime reduces the supplychain risk in three primary ways:
- Prevent modifying JavaScript's primordials (Object, String, Number, Array, ...)
- Limit access to the platform API (window, document, XHR, etc) per-package
Both are provided by SES containers. Platform API access is passed in via a LavaMoat configuration file.
SES is the sandbox used in LavaMoat. See SES's secure computing guide to learn more about the risks of untrusted javascript.
Run your server or app building code with protections via LavaMoat Node
When using LavaMoat in the browser, you can just use your favorite bundler if there is an available plugin.
App bundles have two major components:
-
Runtime (aka kernel / loader / prelude / trusted computing base) This is the code that initializes and runs the bundle. For example, the implementation of the
require
function. -
Module sources This includes the js content of the module sources, and sometimes some config information like module name alaises.
LavaMoat modifies the bundle's runtime to enforce the configured constraints.
In addition to the LavaMoat runtime bundler plugins, there are some tools to help analyze your dependecy graph and configuration.
See lavamoat-viz for a demo of the tool.
- HackerNoon - I’m harvesting credit card numbers and passwords from your site. Here’s how
- Agoric - POLA Would Have Prevented the Event-Stream Incident
- Snyk - Why npm lockfiles can be a security blindspot for injecting malicious modules
- Bytecode Alliance - Building a secure by default, composable future for WebAssembly
- Making 'npm install' Safe - Kate Sills - QCon 2020 ~40min
- JavaScript Supply Chain Security - Adam Baldwin - LocoMocoSec 2019 ~25min
- Analysis of an exploited npm package – Jarrod Overson - Amsterdam JSNation Conference 2019 ~25min
Made with love by MetaMask
Funded by ConsenSys
Runs on Agoric