Skip to content

EspoCRM – Open Source CRM Application

Add sensitive parameter attribute

Yurii2afc8d31489f
diff --git a/application/Espo/Core/Authentication/TwoFactor/Totp/TotpUserSetup.php b/application/Espo/Core/Authentication/TwoFactor/Totp/TotpUserSetup.php
index 39e6365268..9ac9679813 100644
--- a/application/Espo/Core/Authentication/TwoFactor/Totp/TotpUserSetup.php
+++ b/application/Espo/Core/Authentication/TwoFactor/Totp/TotpUserSetup.php
@@ -38,6 +38,7 @@ use Espo\Core\Authentication\TwoFactor\UserSetup;
use Espo\Core\Utils\Config;
use RuntimeException;
+use SensitiveParameter;
use stdClass;
/**
@@ -92,7 +93,7 @@ class TotpUserSetup implements UserSetup
return $this->totp->verifyCode($secret, $codeModified);
}
- private function storeSecret(User $user, string $secret): void
+ private function storeSecret(User $user, #[SensitiveParameter] string $secret): void
{
$userData = $this->getUserDataRepository()->getByUserId($user->getId());
diff --git a/application/Espo/Core/Utils/ApiKey.php b/application/Espo/Core/Utils/ApiKey.php
index 3c78c8df53..f1b0afc2c7 100644
--- a/application/Espo/Core/Utils/ApiKey.php
+++ b/application/Espo/Core/Utils/ApiKey.php
@@ -30,6 +30,7 @@
namespace Espo\Core\Utils;
use Espo\Core\Utils\Config\ConfigWriter;
+use SensitiveParameter;
class ApiKey
{
@@ -71,7 +72,7 @@ class ApiKey
return $apiSecretKeys->$id;
}
- public function storeSecretKeyForUserId(string $id, string $secretKey): void
+ public function storeSecretKeyForUserId(string $id, #[SensitiveParameter] string $secretKey): void
{
$apiSecretKeys = $this->config->get('apiSecretKeys');
diff --git a/application/Espo/Core/Utils/Hasher.php b/application/Espo/Core/Utils/Hasher.php
index 9522b53efe..1e0696e5d2 100644
--- a/application/Espo/Core/Utils/Hasher.php
+++ b/application/Espo/Core/Utils/Hasher.php
@@ -29,6 +29,8 @@
namespace Espo\Core\Utils;
+use SensitiveParameter;
+
/**
* Hash a string. E.g. hash an email address to use it in opt-out URL
* to recognize a recipient who clicked opt-out.
@@ -40,7 +42,7 @@ class Hasher
public function __construct(private Config $config)
{}
- public function hash(string $string): string
+ public function hash(#[SensitiveParameter] string $string): string
{
$secretKey = $this->config->get($this->secretKeyParam) ?? '';
diff --git a/application/Espo/Core/Webhook/Sender.php b/application/Espo/Core/Webhook/Sender.php
index abbd0c3e7f..560fcbf556 100644
--- a/application/Espo/Core/Webhook/Sender.php
+++ b/application/Espo/Core/Webhook/Sender.php
@@ -37,6 +37,7 @@ use Espo\Entities\Webhook;
use Espo\Core\HttpClient;
use LogicException;
use Psr\Http\Message\RequestInterface;
+use SensitiveParameter;
/**
* Sends a portion.
@@ -100,7 +101,7 @@ class Sender
return $response->getStatusCode();
}
- private function buildSignature(Webhook $webhook, string $payload, string $secretKey): string
+ private function buildSignature(Webhook $webhook, string $payload, #[SensitiveParameter] string $secretKey): string
{
$webhookId = $webhook->getId();
$hash = hash_hmac('sha256', $payload, $secretKey);