Skip to content

Commit

Permalink
Add SensitiveParameter attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
natanfelles committed Jan 2, 2023
1 parent 325ae03 commit dc18c51
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
9 changes: 6 additions & 3 deletions src/SaveHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

use Framework\Log\Logger;
use Framework\Log\LogLevel;
use SensitiveParameter;

/**
* Class SaveHandler.
Expand Down Expand Up @@ -66,8 +67,10 @@ abstract class SaveHandler implements \SessionHandlerInterface, \SessionUpdateTi
* @param array<string,mixed> $config
* @param Logger|null $logger
*/
public function __construct(array $config = [], Logger $logger = null)
{
public function __construct(
#[SensitiveParameter] array $config = [],
Logger $logger = null
) {
$this->prepareConfig($config);
$this->logger = $logger;
}
Expand All @@ -79,7 +82,7 @@ public function __construct(array $config = [], Logger $logger = null)
*
* @codeCoverageIgnore
*/
protected function prepareConfig(array $config) : void
protected function prepareConfig(#[SensitiveParameter] array $config) : void
{
$this->config = $config;
}
Expand Down
3 changes: 2 additions & 1 deletion src/SaveHandlers/DatabaseHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Framework\Database\Manipulation\Update;
use Framework\Log\LogLevel;
use Framework\Session\SaveHandler;
use SensitiveParameter;

/**
* Class DatabaseHandler.
Expand Down Expand Up @@ -74,7 +75,7 @@ class DatabaseHandler extends SaveHandler
*
* NOTE: The Database::connect configs was not shown.
*/
protected function prepareConfig(array $config) : void
protected function prepareConfig(#[SensitiveParameter] array $config) : void
{
$this->config = \array_replace_recursive([
'table' => 'Sessions',
Expand Down
3 changes: 2 additions & 1 deletion src/SaveHandlers/FilesHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Framework\Session\SaveHandler;
use LogicException;
use RuntimeException;
use SensitiveParameter;

/**
* Class FilesHandler.
Expand Down Expand Up @@ -46,7 +47,7 @@ class FilesHandler extends SaveHandler
* ];
* ```
*/
protected function prepareConfig(array $config) : void
protected function prepareConfig(#[SensitiveParameter] array $config) : void
{
$this->config = \array_replace([
'prefix' => '',
Expand Down
3 changes: 2 additions & 1 deletion src/SaveHandlers/MemcachedHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Framework\Session\SaveHandler;
use Memcached;
use OutOfBoundsException;
use SensitiveParameter;

/**
* Class MemcachedHandler.
Expand Down Expand Up @@ -61,7 +62,7 @@ class MemcachedHandler extends SaveHandler
* ];
* ```
*/
protected function prepareConfig(array $config) : void
protected function prepareConfig(#[SensitiveParameter] array $config) : void
{
$this->config = \array_replace_recursive([
'prefix' => '',
Expand Down
3 changes: 2 additions & 1 deletion src/SaveHandlers/RedisHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Framework\Session\SaveHandler;
use Redis;
use RedisException;
use SensitiveParameter;

/**
* Class RedisHandler.
Expand Down Expand Up @@ -59,7 +60,7 @@ class RedisHandler extends SaveHandler
* ];
* ```
*/
protected function prepareConfig(array $config) : void
protected function prepareConfig(#[SensitiveParameter] array $config) : void
{
$this->config = \array_replace([
'prefix' => '',
Expand Down

0 comments on commit dc18c51

Please sign in to comment.