austinheap/php-security-txt

此包已被弃用且不再维护。没有建议的替代包。

用于操作 PHP 7+ 中的 `security.txt` 文档的包,基于配置设置。

v0.4.0 2017-11-22 18:36 UTC

This package is auto-updated.

Last update: 2021-04-29 00:57:11 UTC


README

php-security-txt banner from the documentation

License Current Release Total Downloads Build Status Dependency Status Scrutinizer CI StyleCI Maintainability Test Coverage SensioLabs

用于操作 PHP 7+ 中的 security.txt 文档的包,基于配置设置。

此项目旨在创建一个“设置后即可忘记”的包,可以操作遵循当前 security.txt 规范的文档。因此,它具有很高的主观性,但专为配置而构建。

security.txt 是一个 草案 "标准",允许网站定义安全策略。该“标准”为安全研究人员提供了关于如何报告安全问题的明确指南,并允许赏金计划定义范围。Security.txt 是 robots.txt 的对应物,但用于安全问题。

有关 php-security-txt 的在线文档,其源代码位于 docs/ 目录中。最合理的地方是从 SecurityTxt 类的文档 开始。

目录

安装

步骤 1:Composer

通过 Composer 命令行

$ composer require austinheap/php-security-txt

或将包添加到您的 composer.json

{
    "require": {
        "austinheap/php-security-txt": "0.3.*"
    }
}

步骤 2:操作 security.txt 文档

要编程创建 security.txt 文档,您可以这样做

require_once 'vendor/autoload.php';

$writer = new \AustinHeap\Security\Txt\Writer;

print $writer->setContact('me@austinheap.com')
             ->setEncryption('http://some.url/pgp.key')
             ->setDisclosure('full')
             ->setAcknowledgement('http://some.url/acks')
             ->getText();

它应该输出

# Our security address
Contact: me@austinheap.com

# Our PGP key
Encryption: http://some.url/pgp.key

# Our disclosure policy
Disclosure: Full

# Our public acknowledgement
Acknowledgement: http://some.url/acks

#
# Generated by "php-security-txt" v0.3.2 (https://github.com/austinheap/php-security-txt/releases/tag/v0.3.2)
# in 0.041008 seconds on 2017-10-26 20:31:25.
#

单元测试

此包使用 PHPUnit 构建了积极的单元测试。

有关 php-security-txt 的代码覆盖率报告可在网上找到。

参考

致谢

这是一个 austinheap/laravel-security-txt 的分支,后者是 InfusionWeb/laravel-robots-route 的分支,后者是 ellisthedev/laravel-5-robots 的分支,后者是 jayhealey/Robots 的分支,后者基于早期工作。

授权

MIT 许可证 (MIT)。请参阅授权文件获取更多信息。