Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

stag-sandbox-lambda

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stag-sandbox-lambda

AWS Lambda wrapper for Esprima component of Stagirite "Sandboxer"

  • 0.3.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Stagirite Sandboxer as an AWS Lambda Service with REST API

A Lambda and Amazon API Gateway wrapper around the Esprima based 'Sandboxer' in the Stagirite core.

The key module is require'd by private npm: @andynuss/stag0jsmunge

Usage

Install project:
npm install

Deploy to AWS Lambda with updated code:
npm run-script deploy

Get AWS Lambda info:
npm run-script info

Note: to deploy to AWS, you must have credentials. Also, be sure to set default region to "us-west-2". Note: npm run-script deploy will tag and push to remote repo.

Client API

Currently, the API supports one method: a POST of a JavaScript "script", which will respond with the sandbox'ed result.

The API endpoint can be found at:
https://kdldbofr5a.execute-api.us-west-2.amazonaws.com/dev/sandbox-lambda

Request Body should be of type JSON(application/json), in the form:

{
  "script": "var a = b[c]"
}

Response Body returns the sandbox'ed "result" in stringify'd JSON:

{
  "result": "\"//var a=b[c];\nvar a=$$_s.Get($$_w,b,c,1);\n\""
}

Note: The AWS API Gateway endpoint is currently "open", meaning that the access to the API doesn't require an auth token. This does not mean that the Lambda function code is visible/accessible on the public Internet; the AWS API Gateway hides and secures everything behind itself.

AWS Console

AWS API Gateway console:
https://us-west-2.console.aws.amazon.com/apigateway/home?region=us-west-2#/restapis/kdldbofr5a/resources/6kw15ioppi

The Sandboxer Lambda function itself, including monitoring and logging:
https://us-west-2.console.aws.amazon.com/lambda/home?region=us-west-2#/functions/sandbox-lambda

Notes and lessons learned:

  • The 'export'ed function in this file MUST be called handler or Lambda will barf.

TODO

  • API key management
  • Add a second endpoint called "test".

FAQs

Package last updated on 21 Jul 2016

Did you know?

Socket

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.

Install

Related posts

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