codelayer/bubblewrap
Composer 安装命令:
composer require codelayer/bubblewrap
包简介
Sandbox console commands using bubblewrap
README 文档
README
A PHP wrapper class for the bubblewrap cli tool. Can be used to execute external commands like imagemagick or ghostscript in a separated environment as a protection against possible security issues.
Installation
The package can be installed using composer:
$ composer require codelayer/bubblewrap
Usage
At the moment most commands that don't take a file descriptor as argument are implemented. This snippet shows how the example from the bubblewrap readme looks in PHP:
$bwrap = new \Codelayer\Bubblewrap\Bubblewrap(); $bwrap ->readOnlyBind('/usr') // If src equals dest only one parameter is required for bind commands ->symlink('usr/lib64', '/lib') ->proc() // /proc is used as default location for procfs ->dev() // /dev is used as default location for devtmpfs ->unsharePid() ->exec(['bash']);
Exec returns a Symfony Process object.
Additional methods
Two additional methods are available to modify how bubblewrap is called:
setBinary($binary)sets the location of the bwrap binaryclearEnv()prependsenv -ito the bwrap calls and unsets all environment variablesgetCommand($cmd)show the full command thatexec($cmd)would execute
License
This package is licensed under the MIT License. For more information see the LICENSE file.
About us
codelayer is a software company from Karlsruhe, Germany which specializes in web application development.
For more information about codelayer, visit our website at codelayer.de.
统计信息
- 总下载量: 204
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-12-13