@mastertanzeel/safe-run
v1.0.0
Published
Run untrusted Node.js projects with safer defaults, transparent risk prompts, and sandboxed execution.
Downloads
10
Maintainers
Readme
safe-run
Run untrusted Node.js projects with safer defaults, transparent prompts, and sandboxed execution.
Why safe-run?
safe-run is built for developers who need to inspect and run unknown repositories without blindly executing dependency scripts.
It focuses on:
- Zero-trust install flow
- Explicit user consent for risky actions
- Human-readable risk insights
- Least-privilege Docker sandboxing
Install
npm i -g @mastertanzeel/safe-runOr run directly:
npx @mastertanzeel/safe-run devModes
1) Dev mode (default low-friction)
safe-run devWhat it does:
- Runs
npm install --ignore-scripts - Runs
npm audit --json - Detects suspicious dependency install scripts
- Prompts before running risky scripts (default: no)
- Prompts before running your command (
npm run devby default)
2) Sandbox mode (Docker isolation)
safe-run sandboxWhat it does:
- Runs in Docker
- Uses non-root user
- Uses
no-new-privileges - Drops Linux capabilities
- Uses
--network noneby default
3) Freelance mode (high security)
safe-run freelanceWhat it does:
- Safe install with scripts blocked
- Strict script approvals (default deny)
- Hardened Docker sandbox
- Restricted environment passthrough (no secret env injection)
Prompt Example
⚠️ Package "xyz" wants to run install scripts.
This may be dangerous.
Allow execution? (yes/no, default: no)Suspicious Script Detection
safe-run flags patterns such as:
curlorwget- Piping to shell (
| bash,| sh) - Remote URL downloads
- Base64 decode + execute patterns
eval/new Function
Optional External Scans
safe-run includes:
npm audit(MVP, built-in)- Optional OSV.dev query batch
- Optional Socket.dev lookups (API key prompt with hidden input)
Security behavior:
- API keys are prompted via hidden input
- Keys are kept in-memory only
- Keys are never logged or stored to disk
Network Monitoring (Best Effort)
Use --monitor-network in Docker modes to print basic socket activity from inside container.
safe-run sandbox --monitor-networkCLI Help
safe-run --helpDevelopment
npm install
npm run lint
node index.js --helpSecurity Principles
- Zero trust for external code
- Explicit consent for risky actions
- Least privilege by default
- No hidden behavior
License
MIT
