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

fix: migrate storage to instanceName-apiKey to isolate by instance #114

Conversation

justin-fiedler
Copy link
Contributor

@justin-fiedler justin-fiedler commented Feb 6, 2024

Summary

  • Storage prefix now includes both apiKey and instanceName to prevent unintended data sharing
  • Added migration to migrate legacy storage to new format
  • Only migrate events in sandboxed apps to prevent data pollution across orgs
  • Always migrate UserDefaults (deviceId, userId, etc) - these seem to be always sandboxed
  • Added STORAGE_VERSION to UserDefaults to prevent duplicate migrations
  • Added tests

Checklist

  • Does your PR title have the correct title format?
  • Does your PR have a breaking change?: No

@justin-fiedler justin-fiedler marked this pull request as ready for review February 9, 2024 21:08
Copy link
Collaborator

@Mercy811 Mercy811 left a comment

Choose a reason for hiding this comment

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

Thanks Justin for fixing this. This is huge on security.

Sources/Amplitude/Types.swift Outdated Show resolved Hide resolved
Tests/AmplitudeTests/AmplitudeTests.swift Outdated Show resolved Hide resolved
@justin-fiedler justin-fiedler merged commit 7128e62 into main Feb 12, 2024
4 checks passed
@justin-fiedler justin-fiedler deleted the AMP-93122-isolate-storage-based-on-unique-identifier-in-all-platforms branch February 12, 2024 19:41
github-actions bot pushed a commit that referenced this pull request Feb 12, 2024
## [1.3.1](v1.3.0...v1.3.1) (2024-02-12)

### Bug Fixes

* migrate storage to instanceName-apiKey to isolate by instance ([#114](#114)) ([7128e62](7128e62))
Copy link

🎉 This PR is included in version 1.3.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants