定制 designsecurity/progpilot 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

designsecurity/progpilot

Composer 安装命令:

composer require designsecurity/progpilot

包简介

A Static Analyser for security

README 文档

README

A static application security testing (SAST) for PHP

Build Status Packagist Packagist

Installation

There are many options available, select the one that best suits your use case.

Use PHAR releases

  • Download the latest PHAR archive from the releases page.
  • Place the file somewhere in your path and make it executable:
chmod +x progpilot_vX.Y.Z.phar
sudo mv progpilot_vX.Y.Z.phar /usr/local/bin/progpilot

Use Docker

docker build -t progpilot .
docker run -v $(pwd):/workspace progpilot /workspace/path/to/your/file.php

Build PHAR archive from source code

phar-composer.phar should be located in a directory listed in the $PATH environment variable:

git clone https://github.com/designsecurity/progpilot
cd progpilot
./build.sh

The resulting phar archive will be located in the builds folder at the root of this project.

Use composer

Install the package with composer, typically when using progpilot as a library of your PHP project:

composer require --dev designsecurity/progpilot

Configuration

Use a yaml configuration file (look at this example) to configure and customize the progpilot analysis otherwise the default configuration will be used with, in particular the standard taint configuration data.

Usage

CLI example

The progpilot command takes as arguments the path to the files and folders to be analyzed and optionally a configuration file:

# without config file
progpilot example1.php example2.php folder1/ folder2/
# with a config file
progpilot --configuration configuration.yml example1.php example2.php folder1/ folder2/

If you installed it with composer, the program will be located at vendor/bin/progpilot.

Library example

It is also possible to use progpilot inside PHP code. For more information look at the API documentation.

Use this code to analyze source_code1.php:

<?php
require_once './vendor/autoload.php';

$context = new \progpilot\Context;
$analyzer = new \progpilot\Analyzer;

$context->inputs->setFile("source_code1.php");

try {
  $analyzer->run($context);
} catch (Exception $e) {
   echo "Exception : ".$e->getMessage()."\n";
}  
  
$results = $context->outputs->getResults();

var_dump($results);

When source_code1.php contains this code:

<?php
$var7 = $_GET["p"];
$var4 = $var7;
echo "$var4";

The simplified output will be:

array(1) {
  [0]=>
  array(11) {
    ["source_name"]=>
    array(1) {
      [0]=>
      string(5) "$var4"
    }
    ["source_line"]=>
    array(1) {
      [0]=>
      int(4)
    }
    ["sink_name"]=>
    string(4) "echo"
    ["sink_line"]=>
    int(5)
    ["vuln_name"]=>
    string(3) "xss"
  }
}

All files (composer.json, example1.php, source_code1.php) used in this example are in the projects/example folder. For more examples look also at this page.

Specify an analysis

It is strongly recommended to customize the taint analysis configuration (the definitions of sinks, sources, sanitizers and validators) according to the context of the application to be analyzed. In the following specification, superglobals variables _GET, _POST or _COOKIE are defined as untrusted and also the return of the shell_exec() function:

{
    "sources": [
        {"name": "_GET", "is_array": true, "language": "php"},
        {"name": "_POST", "is_array": true, "language": "php"},
        {"name": "_COOKIE", "is_array": true, "language": "php"},
        {"name": "shell_exec", "is_function": true, "language": "php"}
    ]
}

See available settings in the corresponding chapter about specifying an analysis.
Custom rules can be created too, see the corresponding chapter about custom rules.

Development

Learn more about the development of Progpilot.

Faq

Here

designsecurity/progpilot 适用场景与选型建议

designsecurity/progpilot 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 79.13k 次下载、GitHub Stars 达 362, 最近一次更新时间为 2017 年 07 月 30 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 designsecurity/progpilot 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 designsecurity/progpilot 我们能提供哪些服务?
定制开发 / 二次开发

基于 designsecurity/progpilot 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 79.13k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 363
  • 点击次数: 13
  • 依赖项目数: 2
  • 推荐数: 4

GitHub 信息

  • Stars: 362
  • Watchers: 14
  • Forks: 64
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-07-30