承接 lukeelten/cakephp-encrypted-session 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

lukeelten/cakephp-encrypted-session

Composer 安装命令:

composer require lukeelten/cakephp-encrypted-session

包简介

Encrypted Session Middleware which encrypts the session on server-side with a per-user key.

README 文档

README

This is a CakePHP Plugin which encrypts a user's session data transparently before storing it. The session data will be automatically decrypted during the next request.

Why do I need this?

The new GDPR regulation does not enforce encryption on personal data, nevertheless it is recommended to encrypt personal data everywhere, especially at rest. A saved session is simply data stored at rest.

Due to user authorization or other application features, the session often contains data which can be classified as personal data according to the GDPR. Therefore encrypting them is a reasonable safety measure to prevent data breaches.

To increase security, a unique encryption key is generated for each user and stored into a cookie. Keeping the key away from the server, makes decrypting all of the session data at once a very hard task.

Installation

Install plugin using composer:

composer require lukeelten/cakephp-encrypted-session

The plugin does not need any loading during bootstrap.

Configuration

There are several options to configure the behavior, nevertheless the plugin contains a useful set of default values so you do not need any configuration at all.

Nevertheless, it is recommended to configure at least an encryption salt, otherwise Security.salt will be used.

Possible options to add to application config:

'Session' => [
    "Encryption" => [
        "salt" => getenv("SESSION_SALT", "default-salt"), // Server side salt; fill in random string
        "cookieName" => "CAKE_SESSION_KEY", // Cookie name
        "expire" => strtotime("+1 year"), // Default cookie lifetime
        "secure" => false, // Use with https only
        "path" => "/" // Cookie path
    ]
]

Usage

Simply add the middleware to your Application middleware setup (Application.php)

$middleware->add(new EncryptedSessionMiddleware());

Important Note:

If this middleware is used in combination with EncryptedCookieMiddleware and you want to encrypt the session key cookie as well, you must ensure, that the EncryptedCookieMiddleware is loaded into the middleware chain BEFORE the EncryptedSessionMiddleware.

$middleware->add(new EncryptedCookieMiddleware())
    ->add(new EncryptedSessionMiddleware());

统计信息

  • 总下载量: 480
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-04-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固