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

Encrypted features are not being restored from disk cache #98

Closed
midery opened this issue Apr 23, 2024 · 7 comments
Closed

Encrypted features are not being restored from disk cache #98

midery opened this issue Apr 23, 2024 · 7 comments

Comments

@midery
Copy link

midery commented Apr 23, 2024

Hello! We recently discovered an issue with GrowthBook Android SDK:

When we use encryption and save encrypted features to a disk cache, they're not being restored from it. This happens in FeaturesViewModel.fetchFeatures method: only dataModel.features is being restored, but dataModel.encryptedFeatures is being ignored.
Screenshot 2024-04-23 at 11 47 40
This results in incorrect state if we read some values right after app start, before we fetch the updated value from a remote.

Reproducible steps:

  1. Use encryptionKey when initializing GrowthbookSDK
  2. Run your application once to fetch the data and save this data on disk.
  3. Try to read feature value right after initialization

Expected behavior:
GrowthbookSDK.getFeatures() returns previously fetched features, feature's source is the source from last remote call.
Actual behavior:
GrowthbookSDK.getFeatures() returns empty map, feature's source is "unknownFeature"

Is this an intentional behavior? If it is not, can you please take a look into it? 🙏

@Bohdan-Kim
Copy link
Contributor

Hello @midery!
Thanks for reporting this. Could you please specify SDK version you found this issue on?

@midery
Copy link
Author

midery commented Apr 24, 2024

@Bohdan-Kim hello! Thanks for a swift reply!

We use version 1.1.43. But as far as I can see, it should persist even on latest 1.1.47, as the code snippet for restoring features from cache was not updated.

@Bohdan-Kim
Copy link
Contributor

The encrypted features are transferred over the network while you are always pointing us to the restoring features from cache. I would agree if it will be encrypted features from Backend but you are pointing to the features from cache.

@Bohdan-Kim
Copy link
Contributor

Could you please try to reproduce on 1.1.47 version? There should be Fix encrypted features preparation

@midery
Copy link
Author

midery commented Apr 24, 2024

The encrypted features are transferred over the network while you are always pointing us to the restoring features from cache. I would agree if it will be encrypted features from Backend but you are pointing to the features from cache.

Yeah, you're absolutely right!
The problem that we currently encryptedFeatures are being saved to the disk (reference is here), but not being restored from disk (reference is here: we only restore dataModel.features, while dataModel.encryptedFeatures are being ignored).

Because of that, even if users are loaded encryptedFeatures previously, they won't be able to take these from cache, and would need to wait until the backend response.

Could you please try to reproduce on 1.1.47 version? There should be #94

Thanks, I'll try this version and report here!

@Bohdan-Kim
Copy link
Contributor

We need to investigate it a little bit deeper

@Bohdan-Kim
Copy link
Contributor

The pull request was created according to this issue.

vazarkevych added a commit that referenced this issue Apr 29, 2024
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

No branches or pull requests

3 participants