cs278/composer-audit 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

cs278/composer-audit

Composer 安装命令:

composer require cs278/composer-audit

包简介

Audit your Composer dependencies for security vulnerabilities.

README 文档

README

Audit your Composer dependencies for security vulnerabilities, uses data from FriendsOfPHP/security-advisories. Compatible with Composer 1 and 2.

This Composer plugin allows you to audit your dependencies for security vulnerabilities without sending your lock file to an external service or using closed source software.

Note this command is distinct from the audit command built into Composer ≥ 2.4.

Installation

This plugin can either be installed as a dependency in your project or “globally” so that it is always available on your machine.

Install as a development dependency

composer require --dev cs278/composer-audit ^1

Install globally

composer global require cs278/composer-audit ^1

Usage

Audit dependencies

This will audit all locked dependencies from composer.lock.

If your package does not have a composer.lock file (e.g. because it’s a library) the installed packages, located in vendor/composer/installed.json will be validated instead.

composer security-audit

Audit non development dependencies

Only audit your production dependencies from composer.lock, this option only works when there is a composer.lock file.

composer security-audit --no-dev

Update security advisories database

You can force an update of the security advisories database using the --update option, without this option being supplied the database will be downloaded if it does not exist or it’s more than an hour old. For example:

composer security-audit --update

Configuration

Composer Audit can be configured using the extra property in your composer.json file, all configuration should be supplied under the composer-audit key.

{
    ...
    "extra": {
        ...
        "composer-audit": {
            "option1": "super"
        },
        ...
    },
    ...
}

Ignoring an advisory

Currently only filtering advisories by CVE is possible, further options are planned.

Ignoring an advisory by CVE

You are able to ignore warnings about an advisory by filtering based on its CVE reference, this is useful if you decide the risk is acceptable or not applicable and you cannot otherwise upgrade the package to resolve the problem.

{
    ...
    "extra": {
        ...
        "composer-audit": {
            "ignore": [
                {"type": "cve", "value": "CVE-2000-1234567"},
                {"type": "cve", "value": "CVE-2000-7654321"}
            ]
        },
        ...
    },
    ...
}

Example

# Require a vulnerable package
composer require symfony/http-foundation 2.0.4

# Require Composer Audit
composer require --dev cs278/composer-audit ^1

composer security-audit
Found 9 advisories affecting 1 package(s).

composer://symfony/http-foundation (2.0.4)
* Request::getClientIp() when the trust proxy mode is enabled
* CVE-2012-6431: Routes behind a firewall are accessible even when not logged in
* CVE-2013-4752: Request::getHost() poisoning
* CVE-2014-5244: Denial of service with a malicious HTTP Host header
* CVE-2014-6061: Security issue when parsing the Authorization header
* CVE-2015-2309: Unsafe methods in the Request class
* CVE-2018-11386: Denial of service when using PDOSessionHandler
* CVE-2018-14773: Remove support for legacy and risky HTTP headers
* CVE-2019-18888: Prevent argument injection in a MimeTypeGuesser

Hyperlinks will be rendered to the appropriate CVE and advisory where available.

cs278/composer-audit 适用场景与选型建议

cs278/composer-audit 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 97.35k 次下载、GitHub Stars 达 8, 最近一次更新时间为 2020 年 10 月 20 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 cs278/composer-audit 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 97.35k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 8
  • 点击次数: 39
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 8
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-10-20