GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - simonkoeck/code-execution-engine: A fast and secure Code-Execution-Engine in Javascript.

BranchesTags
Open more actions menu

Latest commit

 

History

163 Commits
163 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
runners
runners
 
 
src
src
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
.npmignore
.npmignore
 
 
CNAME
CNAME
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
SECURITY.md
SECURITY.md
 
 
_config.yml
_config.yml
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
tsconfig.json
tsconfig.json
 
 

Repository files navigation

Maintenance GitHub license npm GitHub last commit npm

Code-Execution-Engine

A fast and secure Code-Execution-Engine in Javascript.

❗This package is not secure by default. Visit Security for production projects.❗

Table of Contents

  • Installation

  • Usage

  • Supported Languages

  • Security

  • LXC

  • Contributing

  • Credits

  • License

Installation

Use the package manager npm to install Code-Execution-Engine.

$ npm install code-execution-engine

Or use the yarn package manager.

$ yarn add code-execution-engine
Usage
const cee = require("code-execution-engine");

cee
  .execute("print('Hello World')", cee.languages.PYTHON3, [], "", {
    timeout: 5,
  })
  .then((result) => {
    console.log(result);
  })
  .catch((error) => {
    console.error(error);
  });

execute(input, language, [args], [stdin], [options]) → Promise<String>

Returns the result (stdout) of the executed code. If stderr is not empty, an exception will be thrown with the content of stderr.

input: string – The source code that should be executed.

language: cee.Language – Pass the language the code is written in, for example, cee.languages.PYTHON3. Supported Lanuages

args: string[] - Command-Line arguments that are passed to the script

stdin: string - Set the stdin for the script

options: IExecuteOptions

      timeout: number - Max execution time of the script. This option doesn't work on windows. Defaults to 5

Supported Languages

Get the supported languages on your platform by calling

cee.getSupportedLanguages();
Linux / MacOS Windows
Python3 ✔️ ✔️
Python2 ✔️ ✔️
Javascript ✔️ ✔️
Ruby ✔️ ✔️
Go ✔️ ✔️
Batch ✔️
Bash ✔️
C ✔️
C++ ✔️
Java ✔️

More supported languages coming soon.

Security

IMPORTANT: There are no security modules available for windows!

const cee = require("code-execution-engine");

const executor = new cee.LXC("[NAME OF YOUR LXC-CONTAINER]");

// Run this function after the installation of the container
executor.init({
  runners: 150,
  // limitations per runner
  maxProcesses: 64,
  maxFiles: 2048,
});

executor
  .execute("echo 'Im in a secure environment!'", cee.languages.BASH)
  .then((result) => {
    console.log(result);
  })
  .catch((error) => {
    console.error(error);
  });

To use LXC, follow the instructions below to set up LXC.

LXC

LXC's are Linux containers, that run the code in a different and secure environment. To use them, you need to install them first. LXC's are only available on Linux-Systems.

To use this package with LXC, you need to install an unprivileged container.

Follow these instructions: linuxcontainers.org

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Credits

Inspired by: engineer-man/piston

License

MIT

About

A fast and secure Code-Execution-Engine in Javascript.

www.npmjs.com/package/code-execution-engine

Topics

code-execution-enginelxcnodejsnpmshell

Resources

Readme
MIT license

Security policy

Security policy
Activity

Stars

9 stars

Watchers

2 watching

Forks

1 fork
Report repository

Releases

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.