Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
realms-shim
Advanced tools
This folder contains a shim implementation of the Realm API Proposal.
The current implementation has 3 main limitations:
let
, global function declarations and any other feature that relies on new bindings in global contour are not preserved between difference invocations of eval, instead we create a new contour everytime.git clone https://github.com/Agoric/realms-shim.git
cd realms-shim
npm install
npm run shim:build
This will install the necessary dependencies and build the shim locally.
To open the playground example in your default browser:
npm run shim:build
open examples/simple.html
To use the shim in a webpage, build the shim, then:
<script src="../dist/realm-shim.min.js"></script>
<script>
const r = new Realm();
[...]
</script>
To use the shim with node:
const Realm = require('./realm-shim.min.js');
const r = new Realm();
[...]
You can also use the ES6 module version of the Realms shim in Node.js via the package esm
. To do that, launch node with esm via the "require" option:
npm install esm
node -r esm main.js
And import the realm module in your code:
import Realm from './src/realm';
const r = new Realm();
[...]
To create a root realm with a new global and a fresh set of intrinsics:
const r = new Realm(); // root realm
r.global === this; // false
r.global.JSON === JSON; // false
To create a realm compartment with a new global and inherit the intrinsics from another realm:
const r1 = new Realm(); // root realm
const r2 = new r1.global.Realm({ intrinsics: 'inherit' }); // realm compartment
r1.global === r2.global; // false
r1.global.JSON === r2.global.JSON; // true
To create a realm compartment with a new global and inherit the intrinsics from the current execution context:
const r = new Realm({ intrinsics: 'inherit' }); // realm compartment
r.global === this; // false
r.global.JSON === JSON; // true
Please help us practice coordinated security bug disclosure, by using the instructions in SECURITY.md to report security-sensitive bugs privately.
For non-security bugs, please use the regular Issues page.
FAQs
Spec-compliant shim for Realms TC39 Proposal
We found that realms-shim demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.