Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decryption issue with cached defaults #2

Closed
rawilk opened this issue Oct 9, 2020 · 0 comments
Closed

Decryption issue with cached defaults #2

rawilk opened this issue Oct 9, 2020 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@rawilk
Copy link
Owner

rawilk commented Oct 9, 2020

When caching is enabled and you get a setting while passing it a default value, the default value will be cached upon retrieval, even if the setting is not persisted. If encryption is enabled for the package, this can be problematic because the cached default value is not encrypted in the cache.

Example:

Settings::get('not_exists', 'some default');

When the not_exists setting is retrieved, the value some default will be cached, but not encrypted since the setting does not exist in the database. If that same code is called again, but a different default value is provided, a decryption error is going to be thrown since a "persisted" value was "found", but it differs from the default that was passed in the second time, so the package is going to try and decrypt it.

Settings::get('not_exists', 'some other default');
// decryption exception will be thrown here
  • Package version: 1.0.1
  • Laravel version: 8.9.0
@rawilk rawilk added the bug Something isn't working label Oct 9, 2020
@rawilk rawilk self-assigned this Oct 9, 2020
@rawilk rawilk closed this as completed in efb29ca Oct 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant