area17/twill-security-headers
Composer 安装命令:
composer require area17/twill-security-headers
包简介
A Twill Capsule to add and handle Security Headers
README 文档
README
This Twill Capsule is intended to enable developers add Security Headers configuration to applications, giving users a friendly dashboard to configure these headers:
Screenshots
CMS configuration
Mozilla Observatory security headers check
Supported Headers
- CSP (Content Security Policy)
- HSTS (Strict-Transport-Security)
- Permissions-Policy
- Referrer-Policy
- X-Content-Type-Options
- X-Frame-Options
- Expect-CT (deprecated by most browsers)
- X-XSS-Protection (non-standard, not for production)
Unwanted headers
This capsule also has an option for removing any unwanted headers from the response. Update the config/twill-security-headers.php file to add any unwanted headers from the response:
'unwanted-headers' => ['X-Powered-By', 'server', 'Server'],
Installing
Supported Versions
Composer will manage this automatically for you, but these are the supported versions between Twill and this package.
| Twill Version | HTTP Basic Auth Capsule |
|---|---|
| 3.x | 2.x |
| 2.x | 1.x |
Require the Composer package:
composer require area17/twill-security-headers
Publish the configuration
php artisan vendor:publish --provider="A17\TwillSecurityHeaders\ServiceProvider"
Migrate the database to create package tables
php artisan migrate
Usage
It's pretty straightforward, once installed you will have access to the menu option Twill Security Headers, which is a single page having all the supported headers that you can enable, disable and edit the properties to sent with the response.
Menu
If you are clearing the Twill menu in order to create a new one yourself, you will need to add it manually:
TwillNavigation::clear(); ... TwillNavigation::addLink( NavigationLink::make() ->forModule('TwillSecurityHeaders') ->title('Security headers') );
CSP config
Creating CSP policies usually takes time and it's hard to write them manually. You can make use if Report URI, a great tool that allows you to paste your current policy, edit and generate a new string to be pasted on the package.
Disabling
This package is enabled and injects itself automatically. To disable it you just need to add to .env:
TWILL_SECURITY_HEADERS_ENABLED=false
Contribute
Please contribute to this project by submitting pull requests.
area17/twill-security-headers 适用场景与选型建议
area17/twill-security-headers 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2023 年 01 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 area17/twill-security-headers 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 area17/twill-security-headers 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 4k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 30
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2023-01-19


