Skip to content

Commit

Permalink
Don't import SensitiveParameter global attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
onlime committed Jun 28, 2024
1 parent cb42050 commit d2501a7
Show file tree
Hide file tree
Showing 23 changed files with 51 additions and 81 deletions.
11 changes: 5 additions & 6 deletions src/Illuminate/Auth/DatabaseUserProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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)
Expand All @@ -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())
Expand All @@ -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,
Expand Down Expand Up @@ -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()
Expand All @@ -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;
Expand Down
11 changes: 5 additions & 6 deletions src/Illuminate/Auth/EloquentUserProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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();

Expand All @@ -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);

Expand All @@ -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,
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
4 changes: 1 addition & 3 deletions src/Illuminate/Auth/Events/Attempting.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

namespace Illuminate\Auth\Events;

use SensitiveParameter;

class Attempting
{
/**
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 1 addition & 3 deletions src/Illuminate/Auth/Events/Failed.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

namespace Illuminate\Auth\Events;

use SensitiveParameter;

class Failed
{
/**
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions src/Illuminate/Auth/Notifications/ResetPassword.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Illuminate\Support\Facades\Lang;
use SensitiveParameter;

class ResetPassword extends Notification
{
Expand Down Expand Up @@ -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;
}
Expand Down
3 changes: 1 addition & 2 deletions src/Illuminate/Auth/Passwords/CanResetPassword.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Illuminate\Auth\Passwords;

use Illuminate\Auth\Notifications\ResetPassword as ResetPasswordNotification;
use SensitiveParameter;

trait CanResetPassword
{
Expand All @@ -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));
}
Expand Down
5 changes: 2 additions & 3 deletions src/Illuminate/Auth/Passwords/DatabaseTokenRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Illuminate\Database\ConnectionInterface;
use Illuminate\Support\Carbon;
use Illuminate\Support\Str;
use SensitiveParameter;

class DatabaseTokenRepository implements TokenRepositoryInterface
{
Expand Down Expand Up @@ -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];
}
Expand All @@ -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()
Expand Down
13 changes: 6 additions & 7 deletions src/Illuminate/Auth/Passwords/PasswordBroker.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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;
Expand All @@ -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']);

Expand Down Expand Up @@ -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);
}
Expand Down
3 changes: 1 addition & 2 deletions src/Illuminate/Auth/Passwords/TokenRepositoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Illuminate\Auth\Passwords;

use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
use SensitiveParameter;

interface TokenRepositoryInterface
{
Expand All @@ -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.
Expand Down
3 changes: 1 addition & 2 deletions src/Illuminate/Auth/RequestGuard.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Illuminate\Contracts\Auth\UserProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Traits\Macroable;
use SensitiveParameter;

class RequestGuard implements Guard
{
Expand Down Expand Up @@ -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()
Expand Down
3 changes: 1 addition & 2 deletions src/Illuminate/Auth/SessionGuard.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down
12 changes: 5 additions & 7 deletions src/Illuminate/Contracts/Auth/UserProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

namespace Illuminate\Contracts\Auth;

use SensitiveParameter;

interface UserProvider
{
/**
Expand All @@ -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.
Expand All @@ -30,15 +28,15 @@ 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.
*
* @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.
Expand All @@ -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.
Expand All @@ -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);
}
4 changes: 1 addition & 3 deletions src/Illuminate/Contracts/Encryption/Encrypter.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

namespace Illuminate\Contracts\Encryption;

use SensitiveParameter;

interface Encrypter
{
/**
Expand All @@ -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.
Expand Down
Loading

0 comments on commit d2501a7

Please sign in to comment.