Skip to content

Commit 4ac39f0

Browse files
authored
Merge pull request #54 from genecommerce/bugifx/dont-log-not-encrypted-type-values
Don't logging not encrypted types values
2 parents 37bc5d7 + aa4bab6 commit 4ac39f0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Plugin/LogDecrypts.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Psr\Log\LoggerInterface;
66
use Magento\Framework\Encryption\Encryptor;
77
use Magento\Framework\App\DeploymentConfig;
8+
use Gene\EncryptionKeyManager\Model\EncodingHelper;
89

910
class LogDecrypts
1011
{
@@ -27,7 +28,8 @@ class LogDecrypts
2728
public function __construct(
2829
Encryptor $encryptor,
2930
DeploymentConfig $deploymentConfig,
30-
private readonly LoggerInterface $logger
31+
private readonly LoggerInterface $logger,
32+
private readonly EncodingHelper $encodingHelper
3133
) {
3234
$this->keyCount = count(explode(PHP_EOL, $encryptor->exportKeys())) - 1;
3335

@@ -65,6 +67,11 @@ public function afterDecrypt(Encryptor $subject, $result, $data)
6567
return $result;
6668
}
6769

70+
// don't logging values don't like as an encrypted value
71+
if (!$this->encodingHelper->isEncryptedValue($data)) {
72+
return $result;
73+
}
74+
6875
$exception = new \Exception();
6976

7077
/**

0 commit comments

Comments
 (0)