Skip to content

Conversation

@hafezdivandari
Copy link
Contributor

Clients' secret are now always hashed.

Changes

  • Hash facade has been used to hash and check the values.
  • Passport::$hashesClientSecrets property has been removed.
  • Passport::hashClientSecrets() method has been removed.

@github-actions
Copy link

Thanks for submitting a PR!

Note that draft PR's are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface.

Pull requests that are abandoned in draft may be closed due to inactivity.

@hafezdivandari hafezdivandari marked this pull request as ready for review May 21, 2024 16:37
Copy link
Member

@driesvints driesvints left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think this will be a good one to have as a default and the upgrade path isn't too hard.

@taylorotwell taylorotwell merged commit 2e44a19 into laravel:13.x May 30, 2024
@hafezdivandari hafezdivandari deleted the 13.x-hash-client-secret branch May 30, 2024 15:06
hettiger added a commit to hettiger/passport that referenced this pull request Oct 10, 2025
…1745

```php
- if (Passport::$hashesClientSecrets) {
-     return ['plainSecret' => $client->plainSecret] + $client->toArray();
- }
+ $client->secret = $client->plainSecret;

return $client->makeVisible('secret');
```

This change obviously breaks usages that previously relied on the return type array with the additional 'plainSecret' data.
E.g., the old Vue components used the plainSecret to present that to the user so that he could save it, etc.
Since hashing is now mandatory, I restored the previous behavior without the now obsolete `Passport::$hashesClientSecrets` check:

```php
return ['plainSecret' => $client->plainSecret] + $client->toArray();
```

I also updated the tests. I know it looks a bit fishy but I had not much choice since it's a unit test … (didn't want to make too big of a change out of this … it's deprecated anyways …)
taylorotwell pushed a commit that referenced this pull request Oct 10, 2025
…al client via deprecated `ClientController::store` (#1861)

* Fix ClientController::store() breaking change introduced via #1745

```php
- if (Passport::$hashesClientSecrets) {
-     return ['plainSecret' => $client->plainSecret] + $client->toArray();
- }
+ $client->secret = $client->plainSecret;

return $client->makeVisible('secret');
```

This change obviously breaks usages that previously relied on the return type array with the additional 'plainSecret' data.
E.g., the old Vue components used the plainSecret to present that to the user so that he could save it, etc.
Since hashing is now mandatory, I restored the previous behavior without the now obsolete `Passport::$hashesClientSecrets` check:

```php
return ['plainSecret' => $client->plainSecret] + $client->toArray();
```

I also updated the tests. I know it looks a bit fishy but I had not much choice since it's a unit test … (didn't want to make too big of a change out of this … it's deprecated anyways …)

* append `plain_secret`

* use `append` instead of `mergeAppend` to support L11.x

---------

Co-authored-by: Martin Hettiger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants