360 Secure SkillHub
360 安全技能中心

XPR Code Sandbox

提供 execute_js 与 eval_expression 两个工具:前者在隔离 V8 沙箱中运行 JavaScript 脚本,通过 input 参数传入 JSON 数据并以 INPUT 访问,console.log 结果在 logs 中返回;后者用于求值单条表达式。沙箱无网络、无文件系统、无导入,默认超时 5 秒、最大 30 秒,输出上限 10MB,适合多步数据加工、算法验证与快速计算。

paulgnz
paulgnz
热度 81.59
最近更新 2026-05-20 03:40:05
分类:开发依赖:代码执行应用场景:数据处理 / 自动化脚本

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add xpr-code-sandbox
Metadata
name
code-sandbox
description
Execute JavaScript code in a sandboxed VM for data processing and computation

Code Sandbox

You have sandboxed JavaScript execution tools for computation and data processing:

Full scripts:

  • execute_js — run JavaScript code in an isolated V8 sandbox
    • Pass data via the input parameter (JSON) — access it as INPUT in your code
    • Use console.log() to capture intermediate values (returned in logs array)
    • Available globals: JSON, Math, Date, Array, Object, String, Number, RegExp, Map, Set, parseInt, parseFloat, isNaN, isFinite, encodeURIComponent, decodeURIComponent, atob, btoa
    • No network access, no filesystem, no imports — pure computation only
    • Default timeout 5 seconds, max 30 seconds
    • 10MB output limit

Quick expressions:

  • eval_expression — evaluate a single JavaScript expression and return the result
    • Use for quick math: "15 * 4500 * 0.01" → 675
    • Date calculations: "new Date().toISOString()"
    • Array operations: "[1,2,3].map(x => x*x)" → [1, 4, 9]

Best practices:

  • Use execute_js for multi-step data processing, algorithm testing, code validation
  • Use eval_expression for quick math, string ops, date calculations
  • Pass large datasets via input parameter rather than embedding in code
  • Combine with parse_csv (structured-data skill) for CSV → transform → output workflows
  • Combine with store_deliverable to save computed results as job evidence