ekino/data-protection-bundle
Composer 安装命令:
composer require ekino/data-protection-bundle
包简介
Data protection bundle
关键字:
README 文档
README
This is a work in progress, so if you'd like something implemented please feel free to ask for it or contribute to help us!
Purpose
This bundle protects the data of your project through encryption.
Installation
Step 1: add dependency
$ composer require ekino/data-protection-bundle
Step 2: register the bundle
Symfony 2 or 3:
<?php // app/AppKernel.php public function registerBundles() { $bundles = [ // ... new Ekino\DataProtectionBundle\EkinoDataProtectionBundle(), // ... ]; }
Symfony 4:
<?php // config/bundles.php return [ // ... Ekino\DataProtectionBundle\EkinoDataProtectionBundle::class => ['all' => true], // ... ];
Step 3: configure the bundle
ekino_data_protection: encryptor: method: aes-256-cbc # default secret: foo # required encrypt_logs: true # default use_sonata_admin: false # default
The method is one of openssl_get_cipher_methods().
Usage
Encrypt the logs
This bundle provides a processor for Monolog to encrypt your logs in order
to not be human-readable. To use it, just add the prefix private_ on the
context key for each data you want to encrypt, for instance:
<?php $logger->critical('Something to be logged', [ 'a_non_sensitive_data' => 'foo', // won't be encrypted 'private_firstname' => 'John', // will be encrypted ]);
Then the data can be decrypted in a secure area using the encryptor.
If you don't want it, you can disable it in the config:
ekino_data_protection: encrypt_logs: false
Decrypt the logs
This bundle provides a Sonata Admin panel to decrypt your logs that would have been encrypted by the above processor. To use it, enable it in configuration:
ekino_data_protection: use_sonata_admin: true
Then, you will be able to add the following route admin_app_logs_decrypt_encrypt into
your menu for example. This route provides a form with only one field in which you
can fill in only the encrypted part of the log or a full text containing several logs.
In case of several encrypted logs, each decrypted result will be displayed in a
dedicated tab.
Decrypt your secrets at runtime
This bundle provides a processor using the configured encryptor to decrypt a secret at runtime. This allows you to not reveal your secrets and easy rotate them without flushing the cache.
To use it, just use the prefix ekino_encrypted as this example shows:
# .env
DATABASE_URL=d6NhbhWDBVpj5l3gYD5BiKLeYxJllx7Lf8hJXhtoJ70=
# config/packages/doctrine.yaml doctrine: dbal: url: '%env(ekino_encrypted:DATABASE_URL)%'
Encrypt texts using the CLI
To encrypt a text, run the following command:
bin/console ekino-data-protection:encrypt myText, optionally with --secret mySecret and/or --method myCipher
ekino/data-protection-bundle 适用场景与选型建议
ekino/data-protection-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 34.42k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2019 年 02 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「log」 「data」 「encryption」 「protection」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ekino/data-protection-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ekino/data-protection-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ekino/data-protection-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Shoot aims to make providing data to your templates more manageable
A simple PHP class to encrypt a string and decrypt an encrypted string
Adds the EDTF data type to Wikibase
A package for automatically encrypting and decrypting Eloquent attributes in Laravel 5.5+, based on configuration settings.
A simple library that allows transform any kind of data to native php data or whatever
Encryption with AES-256 and HMAC-SHA256
统计信息
- 总下载量: 34.42k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-02-15