From d2501a754466a01cf3cbc41e0aa052d4db6f61f2 Mon Sep 17 00:00:00 2001 From: Philip Iezzi Date: Fri, 28 Jun 2024 13:34:03 +0200 Subject: [PATCH] Don't import SensitiveParameter global attribute --- src/Illuminate/Auth/DatabaseUserProvider.php | 11 +++++------ src/Illuminate/Auth/EloquentUserProvider.php | 11 +++++------ src/Illuminate/Auth/Events/Attempting.php | 4 +--- src/Illuminate/Auth/Events/Failed.php | 4 +--- src/Illuminate/Auth/Notifications/ResetPassword.php | 3 +-- src/Illuminate/Auth/Passwords/CanResetPassword.php | 3 +-- .../Auth/Passwords/DatabaseTokenRepository.php | 5 ++--- src/Illuminate/Auth/Passwords/PasswordBroker.php | 13 ++++++------- .../Auth/Passwords/TokenRepositoryInterface.php | 3 +-- src/Illuminate/Auth/RequestGuard.php | 3 +-- src/Illuminate/Auth/SessionGuard.php | 3 +-- src/Illuminate/Contracts/Auth/UserProvider.php | 12 +++++------- src/Illuminate/Contracts/Encryption/Encrypter.php | 4 +--- .../Contracts/Encryption/StringEncrypter.php | 4 +--- src/Illuminate/Contracts/Hashing/Hasher.php | 6 ++---- .../Database/Eloquent/Concerns/HasAttributes.php | 5 ++--- src/Illuminate/Encryption/Encrypter.php | 9 ++++----- src/Illuminate/Hashing/AbstractHasher.php | 4 +--- src/Illuminate/Hashing/Argon2IdHasher.php | 3 +-- src/Illuminate/Hashing/ArgonHasher.php | 5 ++--- src/Illuminate/Hashing/BcryptHasher.php | 5 ++--- src/Illuminate/Hashing/HashManager.php | 7 +++---- src/Illuminate/Log/Context/Repository.php | 5 ++--- 23 files changed, 51 insertions(+), 81 deletions(-) diff --git a/src/Illuminate/Auth/DatabaseUserProvider.php b/src/Illuminate/Auth/DatabaseUserProvider.php index 88775699b7ca..3fd6b4061895 100755 --- a/src/Illuminate/Auth/DatabaseUserProvider.php +++ b/src/Illuminate/Auth/DatabaseUserProvider.php @@ -8,7 +8,6 @@ use Illuminate\Contracts\Hashing\Hasher as HasherContract; use Illuminate\Contracts\Support\Arrayable; use Illuminate\Database\ConnectionInterface; -use SensitiveParameter; class DatabaseUserProvider implements UserProvider { @@ -68,7 +67,7 @@ public function retrieveById($identifier) * @param string $token * @return \Illuminate\Contracts\Auth\Authenticatable|null */ - public function retrieveByToken($identifier, #[SensitiveParameter] $token) + public function retrieveByToken($identifier, #[\SensitiveParameter] $token) { $user = $this->getGenericUser( $this->connection->table($this->table)->find($identifier) @@ -85,7 +84,7 @@ public function retrieveByToken($identifier, #[SensitiveParameter] $token) * @param string $token * @return void */ - public function updateRememberToken(UserContract $user, #[SensitiveParameter] $token) + public function updateRememberToken(UserContract $user, #[\SensitiveParameter] $token) { $this->connection->table($this->table) ->where($user->getAuthIdentifierName(), $user->getAuthIdentifier()) @@ -98,7 +97,7 @@ public function updateRememberToken(UserContract $user, #[SensitiveParameter] $t * @param array $credentials * @return \Illuminate\Contracts\Auth\Authenticatable|null */ - public function retrieveByCredentials(#[SensitiveParameter] array $credentials) + public function retrieveByCredentials(#[\SensitiveParameter] array $credentials) { $credentials = array_filter( $credentials, @@ -153,7 +152,7 @@ protected function getGenericUser($user) * @param array $credentials * @return bool */ - public function validateCredentials(UserContract $user, #[SensitiveParameter] array $credentials) + public function validateCredentials(UserContract $user, #[\SensitiveParameter] array $credentials) { return $this->hasher->check( $credentials['password'], $user->getAuthPassword() @@ -168,7 +167,7 @@ public function validateCredentials(UserContract $user, #[SensitiveParameter] ar * @param bool $force * @return void */ - public function rehashPasswordIfRequired(UserContract $user, #[SensitiveParameter] array $credentials, bool $force = false) + public function rehashPasswordIfRequired(UserContract $user, #[\SensitiveParameter] array $credentials, bool $force = false) { if (! $this->hasher->needsRehash($user->getAuthPassword()) && ! $force) { return; diff --git a/src/Illuminate/Auth/EloquentUserProvider.php b/src/Illuminate/Auth/EloquentUserProvider.php index 78e40dda117c..428c2e78976f 100755 --- a/src/Illuminate/Auth/EloquentUserProvider.php +++ b/src/Illuminate/Auth/EloquentUserProvider.php @@ -7,7 +7,6 @@ use Illuminate\Contracts\Auth\UserProvider; use Illuminate\Contracts\Hashing\Hasher as HasherContract; use Illuminate\Contracts\Support\Arrayable; -use SensitiveParameter; class EloquentUserProvider implements UserProvider { @@ -67,7 +66,7 @@ public function retrieveById($identifier) * @param string $token * @return \Illuminate\Contracts\Auth\Authenticatable|null */ - public function retrieveByToken($identifier, #[SensitiveParameter] $token) + public function retrieveByToken($identifier, #[\SensitiveParameter] $token) { $model = $this->createModel(); @@ -91,7 +90,7 @@ public function retrieveByToken($identifier, #[SensitiveParameter] $token) * @param string $token * @return void */ - public function updateRememberToken(UserContract $user, #[SensitiveParameter] $token) + public function updateRememberToken(UserContract $user, #[\SensitiveParameter] $token) { $user->setRememberToken($token); @@ -110,7 +109,7 @@ public function updateRememberToken(UserContract $user, #[SensitiveParameter] $t * @param array $credentials * @return \Illuminate\Contracts\Auth\Authenticatable|null */ - public function retrieveByCredentials(#[SensitiveParameter] array $credentials) + public function retrieveByCredentials(#[\SensitiveParameter] array $credentials) { $credentials = array_filter( $credentials, @@ -147,7 +146,7 @@ public function retrieveByCredentials(#[SensitiveParameter] array $credentials) * @param array $credentials * @return bool */ - public function validateCredentials(UserContract $user, #[SensitiveParameter] array $credentials) + public function validateCredentials(UserContract $user, #[\SensitiveParameter] array $credentials) { if (is_null($plain = $credentials['password'])) { return false; @@ -164,7 +163,7 @@ public function validateCredentials(UserContract $user, #[SensitiveParameter] ar * @param bool $force * @return void */ - public function rehashPasswordIfRequired(UserContract $user, #[SensitiveParameter] array $credentials, bool $force = false) + public function rehashPasswordIfRequired(UserContract $user, #[\SensitiveParameter] array $credentials, bool $force = false) { if (! $this->hasher->needsRehash($user->getAuthPassword()) && ! $force) { return; diff --git a/src/Illuminate/Auth/Events/Attempting.php b/src/Illuminate/Auth/Events/Attempting.php index 8e177fe52980..e4500e33b735 100644 --- a/src/Illuminate/Auth/Events/Attempting.php +++ b/src/Illuminate/Auth/Events/Attempting.php @@ -2,8 +2,6 @@ namespace Illuminate\Auth\Events; -use SensitiveParameter; - class Attempting { /** @@ -35,7 +33,7 @@ class Attempting * @param bool $remember * @return void */ - public function __construct($guard, #[SensitiveParameter] $credentials, $remember) + public function __construct($guard, #[\SensitiveParameter] $credentials, $remember) { $this->guard = $guard; $this->remember = $remember; diff --git a/src/Illuminate/Auth/Events/Failed.php b/src/Illuminate/Auth/Events/Failed.php index ee8c4470cb92..b29940e3ae5f 100644 --- a/src/Illuminate/Auth/Events/Failed.php +++ b/src/Illuminate/Auth/Events/Failed.php @@ -2,8 +2,6 @@ namespace Illuminate\Auth\Events; -use SensitiveParameter; - class Failed { /** @@ -35,7 +33,7 @@ class Failed * @param array $credentials * @return void */ - public function __construct($guard, $user, #[SensitiveParameter] $credentials) + public function __construct($guard, $user, #[\SensitiveParameter] $credentials) { $this->user = $user; $this->guard = $guard; diff --git a/src/Illuminate/Auth/Notifications/ResetPassword.php b/src/Illuminate/Auth/Notifications/ResetPassword.php index ad32d5df12a6..d31ae210c943 100644 --- a/src/Illuminate/Auth/Notifications/ResetPassword.php +++ b/src/Illuminate/Auth/Notifications/ResetPassword.php @@ -5,7 +5,6 @@ use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Notification; use Illuminate\Support\Facades\Lang; -use SensitiveParameter; class ResetPassword extends Notification { @@ -36,7 +35,7 @@ class ResetPassword extends Notification * @param string $token * @return void */ - public function __construct(#[SensitiveParameter] $token) + public function __construct(#[\SensitiveParameter] $token) { $this->token = $token; } diff --git a/src/Illuminate/Auth/Passwords/CanResetPassword.php b/src/Illuminate/Auth/Passwords/CanResetPassword.php index cea20304a4aa..aff9c5bca940 100644 --- a/src/Illuminate/Auth/Passwords/CanResetPassword.php +++ b/src/Illuminate/Auth/Passwords/CanResetPassword.php @@ -3,7 +3,6 @@ namespace Illuminate\Auth\Passwords; use Illuminate\Auth\Notifications\ResetPassword as ResetPasswordNotification; -use SensitiveParameter; trait CanResetPassword { @@ -23,7 +22,7 @@ public function getEmailForPasswordReset() * @param string $token * @return void */ - public function sendPasswordResetNotification(#[SensitiveParameter] $token) + public function sendPasswordResetNotification(#[\SensitiveParameter] $token) { $this->notify(new ResetPasswordNotification($token)); } diff --git a/src/Illuminate/Auth/Passwords/DatabaseTokenRepository.php b/src/Illuminate/Auth/Passwords/DatabaseTokenRepository.php index b4d7eef45715..5449603fbc6b 100755 --- a/src/Illuminate/Auth/Passwords/DatabaseTokenRepository.php +++ b/src/Illuminate/Auth/Passwords/DatabaseTokenRepository.php @@ -7,7 +7,6 @@ use Illuminate\Database\ConnectionInterface; use Illuminate\Support\Carbon; use Illuminate\Support\Str; -use SensitiveParameter; class DatabaseTokenRepository implements TokenRepositoryInterface { @@ -116,7 +115,7 @@ protected function deleteExisting(CanResetPasswordContract $user) * @param string $token * @return array */ - protected function getPayload($email, #[SensitiveParameter] $token) + protected function getPayload($email, #[\SensitiveParameter] $token) { return ['email' => $email, 'token' => $this->hasher->make($token), 'created_at' => new Carbon]; } @@ -128,7 +127,7 @@ protected function getPayload($email, #[SensitiveParameter] $token) * @param string $token * @return bool */ - public function exists(CanResetPasswordContract $user, #[SensitiveParameter] $token) + public function exists(CanResetPasswordContract $user, #[\SensitiveParameter] $token) { $record = (array) $this->getTable()->where( 'email', $user->getEmailForPasswordReset() diff --git a/src/Illuminate/Auth/Passwords/PasswordBroker.php b/src/Illuminate/Auth/Passwords/PasswordBroker.php index 7c99ce36403d..ad39d0df20f0 100755 --- a/src/Illuminate/Auth/Passwords/PasswordBroker.php +++ b/src/Illuminate/Auth/Passwords/PasswordBroker.php @@ -9,7 +9,6 @@ use Illuminate\Contracts\Auth\UserProvider; use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Support\Arr; -use SensitiveParameter; use UnexpectedValueException; class PasswordBroker implements PasswordBrokerContract @@ -43,7 +42,7 @@ class PasswordBroker implements PasswordBrokerContract * @param \Illuminate\Contracts\Events\Dispatcher $users * @return void */ - public function __construct(#[SensitiveParameter] TokenRepositoryInterface $tokens, UserProvider $users, ?Dispatcher $dispatcher = null) + public function __construct(#[\SensitiveParameter] TokenRepositoryInterface $tokens, UserProvider $users, ?Dispatcher $dispatcher = null) { $this->users = $users; $this->tokens = $tokens; @@ -57,7 +56,7 @@ public function __construct(#[SensitiveParameter] TokenRepositoryInterface $toke * @param \Closure|null $callback * @return string */ - public function sendResetLink(#[SensitiveParameter] array $credentials, ?Closure $callback = null) + public function sendResetLink(#[\SensitiveParameter] array $credentials, ?Closure $callback = null) { // First we will check to see if we found a user at the given credentials and // if we did not we will redirect back to this current URI with a piece of @@ -97,7 +96,7 @@ public function sendResetLink(#[SensitiveParameter] array $credentials, ?Closure * @param \Closure $callback * @return mixed */ - public function reset(#[SensitiveParameter] array $credentials, Closure $callback) + public function reset(#[\SensitiveParameter] array $credentials, Closure $callback) { $user = $this->validateReset($credentials); @@ -126,7 +125,7 @@ public function reset(#[SensitiveParameter] array $credentials, Closure $callbac * @param array $credentials * @return \Illuminate\Contracts\Auth\CanResetPassword|string */ - protected function validateReset(#[SensitiveParameter] array $credentials) + protected function validateReset(#[\SensitiveParameter] array $credentials) { if (is_null($user = $this->getUser($credentials))) { return static::INVALID_USER; @@ -147,7 +146,7 @@ protected function validateReset(#[SensitiveParameter] array $credentials) * * @throws \UnexpectedValueException */ - public function getUser(#[SensitiveParameter] array $credentials) + public function getUser(#[\SensitiveParameter] array $credentials) { $credentials = Arr::except($credentials, ['token']); @@ -189,7 +188,7 @@ public function deleteToken(CanResetPasswordContract $user) * @param string $token * @return bool */ - public function tokenExists(CanResetPasswordContract $user, #[SensitiveParameter] $token) + public function tokenExists(CanResetPasswordContract $user, #[\SensitiveParameter] $token) { return $this->tokens->exists($user, $token); } diff --git a/src/Illuminate/Auth/Passwords/TokenRepositoryInterface.php b/src/Illuminate/Auth/Passwords/TokenRepositoryInterface.php index 34cc2fe389e3..db8d63da64fa 100755 --- a/src/Illuminate/Auth/Passwords/TokenRepositoryInterface.php +++ b/src/Illuminate/Auth/Passwords/TokenRepositoryInterface.php @@ -3,7 +3,6 @@ namespace Illuminate\Auth\Passwords; use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract; -use SensitiveParameter; interface TokenRepositoryInterface { @@ -22,7 +21,7 @@ public function create(CanResetPasswordContract $user); * @param string $token * @return bool */ - public function exists(CanResetPasswordContract $user, #[SensitiveParameter] $token); + public function exists(CanResetPasswordContract $user, #[\SensitiveParameter] $token); /** * Determine if the given user recently created a password reset token. diff --git a/src/Illuminate/Auth/RequestGuard.php b/src/Illuminate/Auth/RequestGuard.php index e95ffd98edb5..9b8fd10a36b6 100644 --- a/src/Illuminate/Auth/RequestGuard.php +++ b/src/Illuminate/Auth/RequestGuard.php @@ -6,7 +6,6 @@ use Illuminate\Contracts\Auth\UserProvider; use Illuminate\Http\Request; use Illuminate\Support\Traits\Macroable; -use SensitiveParameter; class RequestGuard implements Guard { @@ -66,7 +65,7 @@ public function user() * @param array $credentials * @return bool */ - public function validate(#[SensitiveParameter] array $credentials = []) + public function validate(#[\SensitiveParameter] array $credentials = []) { return ! is_null((new static( $this->callback, $credentials['request'], $this->getProvider() diff --git a/src/Illuminate/Auth/SessionGuard.php b/src/Illuminate/Auth/SessionGuard.php index dae6e0b66612..1740396d9597 100644 --- a/src/Illuminate/Auth/SessionGuard.php +++ b/src/Illuminate/Auth/SessionGuard.php @@ -24,7 +24,6 @@ use Illuminate\Support\Traits\Macroable; use InvalidArgumentException; use RuntimeException; -use SensitiveParameter; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException; @@ -489,7 +488,7 @@ protected function shouldLogin($callbacks, AuthenticatableContract $user) * @param array $credentials * @return void */ - protected function rehashPasswordIfRequired(AuthenticatableContract $user, #[SensitiveParameter] array $credentials) + protected function rehashPasswordIfRequired(AuthenticatableContract $user, #[\SensitiveParameter] array $credentials) { if ($this->rehashOnLogin) { $this->provider->rehashPasswordIfRequired($user, $credentials); diff --git a/src/Illuminate/Contracts/Auth/UserProvider.php b/src/Illuminate/Contracts/Auth/UserProvider.php index 5e2b8e77ae9c..dd9bb419440c 100644 --- a/src/Illuminate/Contracts/Auth/UserProvider.php +++ b/src/Illuminate/Contracts/Auth/UserProvider.php @@ -2,8 +2,6 @@ namespace Illuminate\Contracts\Auth; -use SensitiveParameter; - interface UserProvider { /** @@ -21,7 +19,7 @@ public function retrieveById($identifier); * @param string $token * @return \Illuminate\Contracts\Auth\Authenticatable|null */ - public function retrieveByToken($identifier, #[SensitiveParameter] $token); + public function retrieveByToken($identifier, #[\SensitiveParameter] $token); /** * Update the "remember me" token for the given user in storage. @@ -30,7 +28,7 @@ public function retrieveByToken($identifier, #[SensitiveParameter] $token); * @param string $token * @return void */ - public function updateRememberToken(Authenticatable $user, #[SensitiveParameter] $token); + public function updateRememberToken(Authenticatable $user, #[\SensitiveParameter] $token); /** * Retrieve a user by the given credentials. @@ -38,7 +36,7 @@ public function updateRememberToken(Authenticatable $user, #[SensitiveParameter] * @param array $credentials * @return \Illuminate\Contracts\Auth\Authenticatable|null */ - public function retrieveByCredentials(#[SensitiveParameter] array $credentials); + public function retrieveByCredentials(#[\SensitiveParameter] array $credentials); /** * Validate a user against the given credentials. @@ -47,7 +45,7 @@ public function retrieveByCredentials(#[SensitiveParameter] array $credentials); * @param array $credentials * @return bool */ - public function validateCredentials(Authenticatable $user, #[SensitiveParameter] array $credentials); + public function validateCredentials(Authenticatable $user, #[\SensitiveParameter] array $credentials); /** * Rehash the user's password if required and supported. @@ -57,5 +55,5 @@ public function validateCredentials(Authenticatable $user, #[SensitiveParameter] * @param bool $force * @return void */ - public function rehashPasswordIfRequired(Authenticatable $user, #[SensitiveParameter] array $credentials, bool $force = false); + public function rehashPasswordIfRequired(Authenticatable $user, #[\SensitiveParameter] array $credentials, bool $force = false); } diff --git a/src/Illuminate/Contracts/Encryption/Encrypter.php b/src/Illuminate/Contracts/Encryption/Encrypter.php index 587c4c97099f..fd29d6c64655 100644 --- a/src/Illuminate/Contracts/Encryption/Encrypter.php +++ b/src/Illuminate/Contracts/Encryption/Encrypter.php @@ -2,8 +2,6 @@ namespace Illuminate\Contracts\Encryption; -use SensitiveParameter; - interface Encrypter { /** @@ -15,7 +13,7 @@ interface Encrypter * * @throws \Illuminate\Contracts\Encryption\EncryptException */ - public function encrypt(#[SensitiveParameter] $value, $serialize = true); + public function encrypt(#[\SensitiveParameter] $value, $serialize = true); /** * Decrypt the given value. diff --git a/src/Illuminate/Contracts/Encryption/StringEncrypter.php b/src/Illuminate/Contracts/Encryption/StringEncrypter.php index 134af6c407c9..399d653fad6f 100644 --- a/src/Illuminate/Contracts/Encryption/StringEncrypter.php +++ b/src/Illuminate/Contracts/Encryption/StringEncrypter.php @@ -2,8 +2,6 @@ namespace Illuminate\Contracts\Encryption; -use SensitiveParameter; - interface StringEncrypter { /** @@ -14,7 +12,7 @@ interface StringEncrypter * * @throws \Illuminate\Contracts\Encryption\EncryptException */ - public function encryptString(#[SensitiveParameter] $value); + public function encryptString(#[\SensitiveParameter] $value); /** * Decrypt the given string without unserialization. diff --git a/src/Illuminate/Contracts/Hashing/Hasher.php b/src/Illuminate/Contracts/Hashing/Hasher.php index ed9850ca464f..d88cf1669a66 100644 --- a/src/Illuminate/Contracts/Hashing/Hasher.php +++ b/src/Illuminate/Contracts/Hashing/Hasher.php @@ -2,8 +2,6 @@ namespace Illuminate\Contracts\Hashing; -use SensitiveParameter; - interface Hasher { /** @@ -21,7 +19,7 @@ public function info($hashedValue); * @param array $options * @return string */ - public function make(#[SensitiveParameter] $value, array $options = []); + public function make(#[\SensitiveParameter] $value, array $options = []); /** * Check the given plain value against a hash. @@ -31,7 +29,7 @@ public function make(#[SensitiveParameter] $value, array $options = []); * @param array $options * @return bool */ - public function check(#[SensitiveParameter] $value, $hashedValue, array $options = []); + public function check(#[\SensitiveParameter] $value, $hashedValue, array $options = []); /** * Check if the given hash has been hashed using the given options. diff --git a/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php b/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php index 419bbcd57d76..2305100adb7d 100644 --- a/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php +++ b/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php @@ -40,7 +40,6 @@ use ReflectionMethod; use ReflectionNamedType; use RuntimeException; -use SensitiveParameter; use ValueError; trait HasAttributes @@ -1354,7 +1353,7 @@ public function fromEncryptedString($value) * @param mixed $value * @return string */ - protected function castAttributeAsEncryptedString($key, #[SensitiveParameter] $value) + protected function castAttributeAsEncryptedString($key, #[\SensitiveParameter] $value) { return static::currentEncrypter()->encrypt($value, false); } @@ -1387,7 +1386,7 @@ protected static function currentEncrypter() * @param mixed $value * @return string */ - protected function castAttributeAsHashedString($key, #[SensitiveParameter] $value) + protected function castAttributeAsHashedString($key, #[\SensitiveParameter] $value) { if ($value === null) { return null; diff --git a/src/Illuminate/Encryption/Encrypter.php b/src/Illuminate/Encryption/Encrypter.php index eb5c44d777a4..0990b0a209c2 100755 --- a/src/Illuminate/Encryption/Encrypter.php +++ b/src/Illuminate/Encryption/Encrypter.php @@ -7,7 +7,6 @@ use Illuminate\Contracts\Encryption\EncryptException; use Illuminate\Contracts\Encryption\StringEncrypter; use RuntimeException; -use SensitiveParameter; class Encrypter implements EncrypterContract, StringEncrypter { @@ -103,7 +102,7 @@ public static function generateKey($cipher) * * @throws \Illuminate\Contracts\Encryption\EncryptException */ - public function encrypt(#[SensitiveParameter] $value, $serialize = true) + public function encrypt(#[\SensitiveParameter] $value, $serialize = true) { $iv = random_bytes(openssl_cipher_iv_length(strtolower($this->cipher))); @@ -140,7 +139,7 @@ public function encrypt(#[SensitiveParameter] $value, $serialize = true) * * @throws \Illuminate\Contracts\Encryption\EncryptException */ - public function encryptString(#[SensitiveParameter] $value) + public function encryptString(#[\SensitiveParameter] $value) { return $this->encrypt($value, false); } @@ -218,7 +217,7 @@ public function decryptString($payload) * @param string $key * @return string */ - protected function hash(#[SensitiveParameter] $iv, #[SensitiveParameter] $value, #[SensitiveParameter] $key) + protected function hash(#[\SensitiveParameter] $iv, #[\SensitiveParameter] $value, #[\SensitiveParameter] $key) { return hash_hmac('sha256', $iv.$value, $key); } @@ -292,7 +291,7 @@ protected function validMac(array $payload) * @param string $key * @return bool */ - protected function validMacForKey(#[SensitiveParameter] $payload, $key) + protected function validMacForKey(#[\SensitiveParameter] $payload, $key) { return hash_equals( $this->hash($payload['iv'], $payload['value'], $key), $payload['mac'] diff --git a/src/Illuminate/Hashing/AbstractHasher.php b/src/Illuminate/Hashing/AbstractHasher.php index 13dcb4cbe6a3..c3916a2599b7 100644 --- a/src/Illuminate/Hashing/AbstractHasher.php +++ b/src/Illuminate/Hashing/AbstractHasher.php @@ -2,8 +2,6 @@ namespace Illuminate\Hashing; -use SensitiveParameter; - abstract class AbstractHasher { /** @@ -25,7 +23,7 @@ public function info($hashedValue) * @param array $options * @return bool */ - public function check(#[SensitiveParameter] $value, $hashedValue, array $options = []) + public function check(#[\SensitiveParameter] $value, $hashedValue, array $options = []) { if (is_null($hashedValue) || strlen($hashedValue) === 0) { return false; diff --git a/src/Illuminate/Hashing/Argon2IdHasher.php b/src/Illuminate/Hashing/Argon2IdHasher.php index 19f97d0597f6..8e6878ed650f 100644 --- a/src/Illuminate/Hashing/Argon2IdHasher.php +++ b/src/Illuminate/Hashing/Argon2IdHasher.php @@ -3,7 +3,6 @@ namespace Illuminate\Hashing; use RuntimeException; -use SensitiveParameter; class Argon2IdHasher extends ArgonHasher { @@ -17,7 +16,7 @@ class Argon2IdHasher extends ArgonHasher * * @throws \RuntimeException */ - public function check(#[SensitiveParameter] $value, $hashedValue, array $options = []) + public function check(#[\SensitiveParameter] $value, $hashedValue, array $options = []) { if ($this->verifyAlgorithm && ! $this->isUsingCorrectAlgorithm($hashedValue)) { throw new RuntimeException('This password does not use the Argon2id algorithm.'); diff --git a/src/Illuminate/Hashing/ArgonHasher.php b/src/Illuminate/Hashing/ArgonHasher.php index 4d4429b72b11..3ec659670c93 100644 --- a/src/Illuminate/Hashing/ArgonHasher.php +++ b/src/Illuminate/Hashing/ArgonHasher.php @@ -4,7 +4,6 @@ use Illuminate\Contracts\Hashing\Hasher as HasherContract; use RuntimeException; -use SensitiveParameter; class ArgonHasher extends AbstractHasher implements HasherContract { @@ -59,7 +58,7 @@ public function __construct(array $options = []) * * @throws \RuntimeException */ - public function make(#[SensitiveParameter] $value, array $options = []) + public function make(#[\SensitiveParameter] $value, array $options = []) { $hash = @password_hash($value, $this->algorithm(), [ 'memory_cost' => $this->memory($options), @@ -94,7 +93,7 @@ protected function algorithm() * * @throws \RuntimeException */ - public function check(#[SensitiveParameter] $value, $hashedValue, array $options = []) + public function check(#[\SensitiveParameter] $value, $hashedValue, array $options = []) { if ($this->verifyAlgorithm && ! $this->isUsingCorrectAlgorithm($hashedValue)) { throw new RuntimeException('This password does not use the Argon2i algorithm.'); diff --git a/src/Illuminate/Hashing/BcryptHasher.php b/src/Illuminate/Hashing/BcryptHasher.php index c034e9bea887..b53eaccb3a52 100755 --- a/src/Illuminate/Hashing/BcryptHasher.php +++ b/src/Illuminate/Hashing/BcryptHasher.php @@ -4,7 +4,6 @@ use Illuminate\Contracts\Hashing\Hasher as HasherContract; use RuntimeException; -use SensitiveParameter; class BcryptHasher extends AbstractHasher implements HasherContract { @@ -43,7 +42,7 @@ public function __construct(array $options = []) * * @throws \RuntimeException */ - public function make(#[SensitiveParameter] $value, array $options = []) + public function make(#[\SensitiveParameter] $value, array $options = []) { $hash = password_hash($value, PASSWORD_BCRYPT, [ 'cost' => $this->cost($options), @@ -66,7 +65,7 @@ public function make(#[SensitiveParameter] $value, array $options = []) * * @throws \RuntimeException */ - public function check(#[SensitiveParameter] $value, $hashedValue, array $options = []) + public function check(#[\SensitiveParameter] $value, $hashedValue, array $options = []) { if ($this->verifyAlgorithm && ! $this->isUsingCorrectAlgorithm($hashedValue)) { throw new RuntimeException('This password does not use the Bcrypt algorithm.'); diff --git a/src/Illuminate/Hashing/HashManager.php b/src/Illuminate/Hashing/HashManager.php index af71814b8f15..ef456b105baa 100644 --- a/src/Illuminate/Hashing/HashManager.php +++ b/src/Illuminate/Hashing/HashManager.php @@ -4,7 +4,6 @@ use Illuminate\Contracts\Hashing\Hasher; use Illuminate\Support\Manager; -use SensitiveParameter; /** * @mixin \Illuminate\Contracts\Hashing\Hasher @@ -59,7 +58,7 @@ public function info($hashedValue) * @param array $options * @return string */ - public function make(#[SensitiveParameter] $value, array $options = []) + public function make(#[\SensitiveParameter] $value, array $options = []) { return $this->driver()->make($value, $options); } @@ -72,7 +71,7 @@ public function make(#[SensitiveParameter] $value, array $options = []) * @param array $options * @return bool */ - public function check(#[SensitiveParameter] $value, $hashedValue, array $options = []) + public function check(#[\SensitiveParameter] $value, $hashedValue, array $options = []) { return $this->driver()->check($value, $hashedValue, $options); } @@ -95,7 +94,7 @@ public function needsRehash($hashedValue, array $options = []) * @param string $value * @return bool */ - public function isHashed(#[SensitiveParameter] $value) + public function isHashed(#[\SensitiveParameter] $value) { return $this->driver()->info($value)['algo'] !== null; } diff --git a/src/Illuminate/Log/Context/Repository.php b/src/Illuminate/Log/Context/Repository.php index 921e4823884c..1533dc6a9cfb 100644 --- a/src/Illuminate/Log/Context/Repository.php +++ b/src/Illuminate/Log/Context/Repository.php @@ -11,7 +11,6 @@ use Illuminate\Support\Traits\Conditionable; use Illuminate\Support\Traits\Macroable; use RuntimeException; -use SensitiveParameter; use Throwable; class Repository @@ -194,7 +193,7 @@ public function add($key, $value = null) * @param mixed $value * @return $this */ - public function addHidden($key, #[SensitiveParameter] $value = null) + public function addHidden($key, #[\SensitiveParameter] $value = null) { $this->hidden = array_merge( $this->hidden, @@ -257,7 +256,7 @@ public function addIf($key, $value) * @param mixed $value * @return $this */ - public function addHiddenIf($key, #[SensitiveParameter] $value) + public function addHiddenIf($key, #[\SensitiveParameter] $value) { if (! $this->hasHidden($key)) { $this->addHidden($key, $value);