firefly-iii / firefly-iii

Firefly III: a personal finances manager
https://firefly-iii.org/
GNU Affero General Public License v3.0
16.37k stars 1.49k forks source link

artisan firefly:use-encryption doesn't decrypt soft-deleted records #1807

Closed hamuz closed 6 years ago

hamuz commented 6 years ago

Bug description I am running Firefly III version 4.7.7

(please give a clear and concise description of what the bug is)

Steps to reproduce What do you need to do to trigger this bug?

  1. Create new account
  2. Delete account
  3. set USE_ENCRYPTION to false in your .env file
  4. php artisan firefly:use-encryption.
  5. Inspect DB and witness name is still encrypted

Expected behavior What do you expect to see after those steps? Even deleted records should be decrypted.

JC5 commented 6 years ago

Not sure what the point would be but it’s an easy change.

hamuz commented 6 years ago

It's part of your instructions in #1789 in changing keys. When setting the new key, it would be beneficial to encrypt also the deleted records, otherwise, they'll become inaccessible (if you don't backup old key). This would allow in the future option to "recover" or "un-delete" some stuff if the project goes that way.

JC5 commented 6 years ago

Like I said, it's an easy change :wink:

JC5 commented 6 years ago

... when you don't forget to push the change :grin:. See my commit above this reply.

hamuz commented 6 years ago

This isn't fixed, see stacktrace below (latestest develop + my PR):

ERROR: Call to undefined method Illuminate\Database\Eloquent\Builder::withDeleted() {"exception":"[object] (BadMethodCallException(code: 0): Call to undefined method Illuminate\\Database\\Eloquent\\Builder::withDeleted() at /app/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php:50)
[stacktrace]
#0 /app/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php(36): Illuminate\\Database\\Eloquent\\Builder::throwBadMethodCallException('withDeleted')
#1 /app/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1321): Illuminate\\Database\\Eloquent\\Builder->forwardCallTo(Object(Illuminate\\Database\\Query\\Builder), 'withDeleted', Array)
#2 /app/app/Console/Commands/UseEncryption.php(82): Illuminate\\Database\\Eloquent\\Builder->__call('withDeleted', Array)
#3 /app/app/Console/Commands/UseEncryption.php(59): FireflyIII\\Console\\Commands\\UseEncryption->handleObjects('Account', 'name', 'encrypted')
#4 [internal function]: FireflyIII\\Console\\Commands\\UseEncryption->handle()
JC5 commented 6 years ago

Fixed now.