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

Disable data protection when opening the Rmq2PersistentStore #2963

merged 1 commit into from May 20, 2019


Copy link

@ened ened commented May 8, 2019


Other issue that have touched this is #401.

The error shown in my logs is:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not create RMQ database at path /var/mobile/Containers/Data/Application/F0DD20A3-DA44-4033-8736-A371A2725EC1/Library/Application Support/Google/FirebaseMessaging/rmq2.sqlite, error: 23 - authorization denied'
*** First throw call stack:
(0x1e1a03758 0x1e0c0bd00 0x1e1919434 0x1e23f3754 0x102e05da8 0x102e04460 0x102e0968c 0x102ddd594 0x102ddce84 0x102ddc364 0x1e14158f4 0x1e1417788 0x102ddc2d0 0x102dba238 0x102dba0f0 0x102db9be8 0x102db99cc 0x102da0d94 0x102d9f3f4 0x102d9ef50 0x102d9ee7c 0x1032b66cc 0x1032b6510 0x102cb22d8 0x102cbb9cc 0x102cbdbc8 0x20e8db0c8 0x20e8dc890 0x20e8e22b0 0x20e175e20 0x20e17e7e8 0x20e175a88 0x20e1763a4 0x20e1745ec 0x20e1742b0 0x20e178fd0 0x20e179e1c 0x20e178e84 0x20e17de68 0x20e8e07ec 0x20e4c3648 0x1e43c13a8 0x1e43cb6e4 0x1e43cae34 0x1e14158f4 0x1e1418ecc 0x1e43fe218 0x1e43fde94 0x1e43fe490 0x1e1993954 0x1e19938d0 0x1e199318c 0x1e198de60 0x1e198d764 0x1e3bc9dd4 0x20e8e400c 0x102cbe<…>

The reproduction of this issue is interesting and requires quite a few steps. The gist is that the Rmq2 persistent store can not be opened when the phone has a passcode AND is locked AND the App is woken up AND it somehow touches the firebase messaging code.

In our case this was reproduced this way:

  • We have a Flutter App, which uses a plugin architecture. The firebase_messaging plugin will be instantiated when the App is started. By nature, all project plugins will be instantiated in ALL Isolates, therefore the FB messaging plugin will be started as well.
  • The App connects to a MFi certified device, which means: When the App is dead and the screen is locked, then the App will be woken up, but starts in background, when the MFi device is connected.
  • Once the App has been woken up, the plugin as above will be instantiated and tries to create access to the sqlite database, which fails with error code 23.

The folks over at FMDB have seen this before:

And the Apple Mailing lists have this Gem:

Once I patched my local firebase messaging plugin with this PR, the errors went away.

This PR changes the Rmq database protection to not-protected. As all App data is sandboxed anyway, I think this may not have negative security implications.

Copy link

@paulb777 paulb777 commented May 8, 2019

@ened Thanks tracking down the issue and the PR! We'll try to review in the next few days.

Copy link

@chliangGoogle chliangGoogle commented May 10, 2019

Thanks for adding the fix.
Have you tried to see if it's backward compatible? Seems like it's changing the way we encrypt the data on the disk. So say your user is running an old version of your app with original settings of database, which uses encryption to save the data and later update with the new settings, will they be able to open the database without error?

Copy link

@chliangGoogle chliangGoogle commented May 20, 2019

I'm able to test it and it is backward compatible.

@paulb777 paulb777 merged commit 4089b33 into firebase:master May 20, 2019
2 checks passed
Copy link
Contributor Author

@ened ened commented May 20, 2019

Thank you for merging - could you please inform when this change could make its way into a release? Thx!

@paulb777 paulb777 added this to the M49 milestone May 20, 2019
Copy link

@paulb777 paulb777 commented May 20, 2019

@ened Thanks for the PR! It's tagged for M49 which should be released in 2-3 weeks.

@firebase firebase locked and limited conversation to collaborators Oct 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants