PHP Class PhpSandbox\WhitelistVisitor

This class takes parsed AST code and checks it against the passed PHPSandbox instance configuration to autmatically whitelist trusted code functions, classes, etc. if the appropriate settings are configured.
Author: Elijah Horton ([email protected])
Inheritance: extends PhpParser\NodeVisitorAbstract
Show file Open project: Corveda/PHPSandbox

Protected Properties

Property Type Description
$sandbox PHPSandbox The PHPSandbox instance to check against

Public Methods

Method Description
__construct ( PHPSandbox $sandbox ) WhitelistVisitor class constructor
leaveNode ( PhpParser\Node $node ) : null | boolean Examine the current PhpParser_Node node against the PHPSandbox configuration for whitelisting trusted code

Method Details

__construct() public method

This constructor takes a passed PHPSandbox instance to check against for whitelisting trusted code.
public __construct ( PHPSandbox $sandbox )
$sandbox PHPSandbox The PHPSandbox instance to check against

leaveNode() public method

Examine the current PhpParser_Node node against the PHPSandbox configuration for whitelisting trusted code
public leaveNode ( PhpParser\Node $node ) : null | boolean
$node PhpParser\Node The trusted $node to examine
return null | boolean Return false if node must be removed, or null if no changes to the node are made

Property Details

$sandbox protected property

The PHPSandbox instance to check against
protected PHPSandbox,phpsandbox $sandbox
return PHPSandbox