← All projects
Project record1 mention
Originally shared on Hacker News

SafeScript

A safe version of JavaScript for executing untrusted code, inspired by Google’s CaJa project. SafeScript compiles to plain JavaScript (just like TypeScript) and also to plain PHP, auto-awaits every promise so it can run in non-evented environments like vanilla PHP, and is positioned as a safer, modern alternative to Lua, including for native embedded applications.

Last shared
01 / The problem

What it addresses

Safely executing untrusted JavaScript code.

02 / Source history

Shared over time

Each entry reflects what was shared on that date. Details may have changed since then.

  1. SafeScript

    A safe version of JavaScript for executing untrusted code, inspired by Google’s CaJa project. SafeScript compiles to plain JavaScript (just like TypeScript) and also to plain PHP, auto-awaits every promise so it can run in non-evented environments like vanilla PHP, and is positioned as a safer, modern alternative to Lua, including for native embedded applications.

    Problem: Safely executing untrusted JavaScript code.

    Posted by @EGreg · Original source ↗

    Story title · @EGreg · · Source ↗

    Show HN: SafeScript, a safe version of JavaScript for executing untrusted code

    Submitted URL · @EGreg · · Source ↗

    https://github.com/SafeScript/safescript

    Source text · @EGreg · · Source ↗

    SafeScript was just inspired by Google’s CaJa project from 10 years ago.

    Source text · @EGreg · · Source ↗

    I chose JS as the base because it’s everywhere. I then made it also execute inside PHP. I made it auto-await every promise so it could work in non-evented environments like vanilla PHP.

    Source text · @EGreg · · Source ↗

    This could be the next Lua, for instance, but for the modern era and far safer.

    Source text · @EGreg · · Source ↗

    SafeScript actually compiles to plain JavaScript, just like Typescript does In PHP, it compiles to plain PHP :)

    Source text · @EGreg · · Source ↗

    For native embedded applications, where SafeScript is positioned to replace Lua, the situation is quite good.

    Source text · @EGreg · · Source ↗

    https://github.com/SafeScript/safescript-php

    Source text · @EGreg · · Source ↗

    https://github.com/SafeScript/safescript-quickjs