Node Promiscuous Modules

    pitboss

    0.1.1 • Public • Published

    BuildStatus

    Pitboss

    Pitboss

    A module for running untrusted code

    Runs JS code and returns the last eval'd statement

    code = """
      num = num % 5;
      num;
    """
    pitboss = new Pitboss(code)
    pitboss.run {num: 23}, (err, result) ->
      assert.equal 3, result
    

    Handles processes that take too damn long

    code = """
      while(true) { num % 3 };
    """
    pitboss = new Pitboss code
      timeout: 2000
    pitboss.run {num: 23}, (err, result) ->
      assert.equal "Timeout", err
    

    Doesn't choke under pressure(or shitty code)

    code = """
      What the fuck am I writing?
    """
    pitboss = new Pitboss code
      timeout: 2000
    pitboss.run {num: 23}, (err, result) ->
      assert.equal "VM Syntax Error: SyntaxError: Unexpected identifier", err
    

    Doesn't handle this! But 'ulimit' does!

    code = """
      str = ''
      while(true) { str = str + "Memory is a finite resource!" };
    """
    pitboss = new Pitboss code
      timeout: 10000
    pitboss.run {num: 23}, (err, result) ->
      assert.equal "Process failed", err
    

    And since Pitboss forks each process, ulimit kills only the runner

    Keywords

    none

    Install

    npm i pitboss

    DownloadsWeekly Downloads

    1

    Version

    0.1.1

    License

    MIT

    Last publish

    Collaborators

    • mdp