Developer Documentation
Official documentation for μ's secure JavaScript sandboxing environment. Learn how to safely test and iterate code with enterprise-grade security.
Start LearningTable of Contents
1. Introduction
μ provides a secure environment for executing JavaScript code with WebAssembly-based isolation. This documentation covers all aspects of using the sandbox, from basic setup to advanced security features and API integrations.
2. Getting Started
Basic Usage
Open the sandbox in your browser and start writing JavaScript code immediately. No setup required.
Security Requirements
By default, μ enforces:
- • Memory-isolated execution
- • No network access
- • Restricted filesystem access
- • Real-time execution monitoring
Code Execution Example
// Open in μ Sandbox:
function main() {
console.log('Secure execution environment')
return 'Hello from sandbox!'
}
main()
3. Security Overview
μ provides enterprise-grade security through:
Isolation Features
- • WebAssembly-based runtime
- • Memory-protected execution
- • No privileged system access
Threat Detection Features
- • Real-time execution monitoring
- • Automatic resource limits
- • Sandboxing violations detection
4. API Reference
Sandbox Methods
run(code: string)
: Execute JavaScript code in secure sandboxclear()
: Clear current execution contextgetStats()
: Get last execution performance
Example API Integration
const { run } = require('@microsandbox/runtime')
try {
const result = run("console.log(1+2)")
console.log(result)
} catch (e) {
console.error('Execution error:', e)
}
5. Best Practices
- Always test code in sandbox before production systems
- Never execute untrusted code without thorough inspection
- Use resource limits for all untrusted code execution
- Monitor execution stats for performance anomalies
Security Tip
For maximum security, use μ's sandbox as final validation step before deploying code
6. Frequently Asked Questions
Q: How long does sessions persist?
Sessions are ephemeral and automatically cleared after 5 minutes of inactivity.
Q: Can I save/restore sessions?
You can manually save/restore code using the session ID and our REST API.
Need additional help?
Contact Support