Jun 23, 2023 · Originally published at Val Town
Today we are introducing a new API scheme under the new val.run domain. In addition to an urgent security upgrade, the new API scheme is subdomain-based to leave the URL path clear for arbitrary webhook handlers. For example, this is what’s needed to create a ChatGPT plugin, Matrix Push Gateway, or Bluesky Feed Generator.
We had planned to roll this out more gradually over the coming months, but were recently alerted to a potential exploit with our Express API, so we rolled out this new API effective immediately. Going forward all requests to our v0 and v1 Express API redirect to val.run.
This will require no change if:
redirect: "follow" in your fetch requests to our Express APIIf not, it is a simple URL scheme switch - our Upgrade Guide below will walk you through it. We attempted to contact our API users ahead of this change, but we apologize if you were caught unawares and this causes breaking changes for you. We take breaking changes seriously, and only choose this path reluctantly to protect against the new exploit that was reported. The vulnerability was not exploited to the best of our knowledge.
Val Town is a website for users to write and run JavaScript. User code can also be run via the API. The v0 API was launched in late 2022. The v1 API was launched on May 4th, 2023, along with Restricted Library Mode semantics. The v1 API has three modes, Express, Run, and Eval, which give various levels of convenience and customizability, depending on your needs.
Today’s new val.run API change only applies to our Express API. The exploit (explained below) relies running a client-side script on an HTML page, which is only possible in our Express API. The other two APIs (Eval and Run) only return JSON, thus are not affected, and are not being changed.
The changes to the Express API:
express.val.run instead of api.val.townThese changes provide an isolated security model and allow for fully-customizable API paths, as required by some webhook specs.
| Before | Now |
|---|---|
| api.val.town/v1/express/user.val | user-val.express.val.run |
The share menus on vals now automatically point to the new Express API.

The exploit was caused by how cookies are shared from parent domains to subdomains. It was responsibly reported by easrng.
api.val.town/v1/express/username.exploitValThis exploit was not taken advantage of to the best of our knowledge.
We at Val Town will be on call for the next couple days, so please reach out if you have any questions or concerns. Discord is great if it’s a public question and the community might be able to help. You can contact me personally at steve@val.town for anything at all.
Thanks for your help and patience through this change. We’re looking forward to seeing all your cool new GPT Plugins and other integrations this new API scheme enables!