Skip to content

Commit

Permalink
version
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Mar 15, 2022
2 parents 31e6062 + 33b1b98 commit 2748457
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
25 changes: 20 additions & 5 deletions src/Illuminate/Encryption/Encrypter.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,9 @@ public function decrypt($payload, $unserialize = true)

$iv = base64_decode($payload['iv']);

$tag = empty($payload['tag']) ? null : base64_decode($payload['tag']);

if (self::$supportedCiphers[strtolower($this->cipher)]['aead'] && strlen($tag) !== 16) {
throw new DecryptException('Could not decrypt the data.');
}
$this->ensureTagIsValid(
$tag = empty($payload['tag']) ? null : base64_decode($payload['tag'])
);

// Here we will decrypt the value. If we are able to successfully decrypt it
// we will then unserialize it and return it out to the caller. If we are
Expand Down Expand Up @@ -248,6 +246,23 @@ protected function validMac(array $payload)
);
}

/**
* Ensure the given tag is a valid tag given the selected cipher.
*
* @param string $tag
* @return void
*/
protected function ensureTagIsValid($tag)
{
if (self::$supportedCiphers[strtolower($this->cipher)]['aead'] && strlen($tag) !== 16) {
throw new DecryptException('Could not decrypt the data.');
}

if (! self::$supportedCiphers[strtolower($this->cipher)]['aead'] && is_string($tag)) {
throw new DecryptException('Unable to use tag because the cipher algorithm does not support AEAD.');
}
}

/**
* Get the encryption key that the encrypter is currently using.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Application extends Container implements ApplicationContract, CachesConfig
*
* @var string
*/
const VERSION = '9.4.1';
const VERSION = '9.5.0';

/**
* The base path for the Laravel installation.
Expand Down
10 changes: 5 additions & 5 deletions src/Illuminate/Http/Client/PendingRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1041,11 +1041,11 @@ protected function sinkStubHandler($sink)
public function runBeforeSendingCallbacks($request, array $options)
{
return tap($request, function ($request) use ($options) {
$this->beforeSendingCallbacks->each->__invoke(
(new Request($request))->withData($options['laravel_data']),
$options,
$this
);
$this->beforeSendingCallbacks->each(function ($callback) use ($request, $options) {
call_user_func(
$callback, (new Request($request))->withData($options['laravel_data']), $options, $this
);
});
});
}

Expand Down

0 comments on commit 2748457

Please sign in to comment.