feat(playground): support safe-mode script libraries in the quickjs sandbox - #56
Open
sundram-bruno wants to merge 11 commits into
Open
feat(playground): support safe-mode script libraries in the quickjs sandbox#56sundram-bruno wants to merge 11 commits into
sundram-bruno wants to merge 11 commits into
Conversation
sundram-bruno
force-pushed
the
feat/playground-script-libraries
branch
from
August 23, 2026 19:00
32064b1 to
7ddd5c0
Compare
sundram-bruno
marked this pull request as draft
August 24, 2026 10:43
- require absolute http(s) urls and omit credentials in the axios shim - reject asymmetric keys and missing secrets in the jwt helper - keep the crypto shim working under minified builds - replace local-file require with a clear error and remove the unused loader - strip __proto__ when marshalling host values into the sandbox
- add jwt guard, marshalling and node: builtin parity cases - rewrite the script-execution e2e to a self-contained tests script - drop the now-unused sample collection script
…ipt-libraries # Conflicts: # package-lock.json # packages/bruno-api-docs/package.json
… callbacks - omit typ and reject claim options for string payloads - invoke the callback at most once - add node crypto interop tests for HS signatures
sundram-bruno
marked this pull request as ready for review
August 26, 2026 15:35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Jira: BRU-3838
Description
The docs playground runs collection scripts in a QuickJS sandbox, but the inbuilt script libraries available in the Bruno app were not supported there. Only chai was available, so any script using moment, crypto-js, axios or the other libraries worked in the app but failed in the playground.
Solution
The playground sandbox now supports the same safe mode library set as the Bruno app: axios, moment, crypto-js, jsonwebtoken, uuid, nanoid, chai, tv4, ajv, ajv-formats, buffer, path, btoa and atob. Scripts can use them through require() or the matching globals, exactly like in the app.
Libraries that are only available in the app's developer mode now fail with a clear message instead of a generic one. Pre-request scripts that set their own Authorization header now win over the request's auth config, matching the app. The scripting engine and libraries are lazy loaded, so docs readers who never use the playground do not download any of it.
Bundle size
The scripting engine and the library bundle are loaded only on the first Send in the playground, so pages that only read docs download none of it.
First Send is a one time cost of roughly 398 KB gzipped, then served from cache. The single file standalone build cannot code split, so it inlines this instead.