Skip to content

Put LDAP troubleshooter's decrypt in a try/catch to avoid crashing if it cannot decrypt the password#17729

Merged
snipe merged 3 commits intodevelopfrom
exit-early-if-ldap-troubleshooter-cannot-decrypt-ldap-pw
Aug 27, 2025
Merged

Put LDAP troubleshooter's decrypt in a try/catch to avoid crashing if it cannot decrypt the password#17729
snipe merged 3 commits intodevelopfrom
exit-early-if-ldap-troubleshooter-cannot-decrypt-ldap-pw

Conversation

@snipe
Copy link
Copy Markdown
Member

@snipe snipe commented Aug 27, 2025

Instead of crashing if the LDAP troubleshooter cannot decrypt the password, this will now return:

✨snipe@chodeblossom✨ snipe-it  (develop) $ php artisan ldap:troubleshoot --ldap-search

 WARNING: This command will display your LDAP password on your terminal. Are you sure this is ok? (yes/no) [no]:
 > yes

Could not decrypt password. This usually means an LDAP password was not set or the APP_KEY was changed since the LDAP pasword was last saved.  Aborting.

Before it would crash with:

WARNING: This command will display your LDAP password on your terminal. Are you sure this is ok? (yes/no) [no]:
 > yes


   Illuminate\Contracts\Encryption\DecryptException

  The payload is invalid.

  at vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php:236
    232▕      */
    233▕     protected function getJsonPayload($payload)
    234▕     {
    235▕         if (! is_string($payload)) {
  ➜ 236▕             throw new DecryptException('The payload is invalid.');
    237▕         }
    238▕
    239▕         $payload = json_decode(base64_decode($payload), true);
    240▕

      +2 vendor frames

  3   app/Console/Commands/LdapTroubleshooter.php:165
      Illuminate\Support\Facades\Facade::__callStatic("Decrypt")
      +12 vendor frames

  16  artisan:33
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

Signed-off-by: snipe <snipe@snipe.net>
@snipe snipe requested a review from uberbrady August 27, 2025 14:36
@snipe snipe added this to the August 2025 Sprint milestone Aug 27, 2025
@snipe snipe changed the title Put decrypt in a try/catch Put LDAP troubleshooter's decrypt in a try/catch to avoid crashing if it cannot decrypt the password Aug 27, 2025
snipe added 2 commits August 27, 2025 15:41
Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
@snipe snipe merged commit 5822e4e into develop Aug 27, 2025
7 checks passed
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.

1 participant