Skip to content

Commit

Permalink
Ensure vm.runInNewContext is used securely
Browse files Browse the repository at this point in the history
  • Loading branch information
Anorov committed Sep 4, 2017
1 parent 508cc1d commit c460665
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cfscrape/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def solve_challenge(self, body):

# Use vm.runInNewContext to safely evaluate code
# The sandboxed code cannot use the Node.js standard library
js = "return require('vm').runInNewContext('%s');" % js
js = "return require('vm').runInNewContext('%s', Object.create(null), {timeout: 5000});" % js

try:
node = execjs.get("Node")
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
setup(
name = 'cfscrape',
packages = ['cfscrape'],
version = '1.8.1',
version = '1.9.0',
description = 'A simple Python module to bypass Cloudflare\'s anti-bot page. See https://github.com/Anorov/cloudflare-scrape for more information.',
author = 'Anorov',
author_email = '[email protected]',
Expand Down

0 comments on commit c460665

Please sign in to comment.