New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@giteeteam/apps-runtime-vm

Package Overview
Dependencies
Maintainers
4
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@giteeteam/apps-runtime-vm - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

12

lib/sandbox-isolate/index.js

@@ -38,3 +38,3 @@ "use strict";

// 获取函数执行的上下文:注入全局变量和api
const context = await this.createContext(isolate, params, runtimeApis);
const context = await this.createContext(isolate, { ...params, timeout }, runtimeApis);
// 构建函数执行模块

@@ -129,2 +129,4 @@ const appModule = await this.createAppModule(isolate, filename);

buildMainScript(indexFilename, functionName) {
// 使用了Promise.race来保证超时时间,因为isolated-vm自带的timeout只是执行时间的timeout,不包括idle时间
// https://github.com/laverdet/isolated-vm/issues/318
return `

@@ -136,7 +138,11 @@ import * as ${indexFilename} from 'app';

try {
res = await ${functionName}(global.params);
res = await Promise.race([
${functionName}(global.params),
new Promise((resolve,reject) => setTimeout(() => reject('Script execution timed out.'), timeout))
])
} catch (e) {
res = {
message: e.message,
message: e.message ?? e,
stack: e.stack,
code: 500,
}

@@ -143,0 +149,0 @@ }

@@ -13,3 +13,3 @@ export declare type Params = Record<string, any>;

runtimeApis?: RuntimeApis;
timeout?: number;
timeout: number;
}
{
"name": "@giteeteam/apps-runtime-vm",
"version": "0.1.4",
"version": "0.1.5",
"description": "Giteeteam Apps Runtime VM",

@@ -40,3 +40,3 @@ "keywords": [

},
"gitHead": "b9c916cc5d6b3ebcc552c3ee63941d2a397af596"
"gitHead": "63aa645e12ebcd0519c98fcf46e5ad6338a79c07"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc