Cannot set just read permission to mutable data for another user

I am creating new private mutable data and I want to give another user access to read it.
I am using NativeBindings.mdataSetUserPermissions(). It works perfectly for any other permission, i.e. insert/update/etc but if only ‘read’ is used the native lib crashes like this:

2019-06-04 13:18:07.065 4719-4719/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2019-06-04 13:18:07.065 4719-4719/? A/DEBUG: Build fingerprint: 'Android/sdk_phone_x86_64/generic_x86_64:9/PSR1.180720.012/4923214:userdebug/test-keys'
2019-06-04 13:18:07.065 4719-4719/? A/DEBUG: Revision: '0'
2019-06-04 13:18:07.065 4719-4719/? A/DEBUG: ABI: 'x86_64'
2019-06-04 13:18:07.065 4719-4719/? A/DEBUG: pid: 4674, tid: 4694, name: Thread-34  >>> tech.safenetwork.zignalz <<<
2019-06-04 13:18:07.065 4719-4719/? A/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
2019-06-04 13:18:07.065 4719-4719/? A/DEBUG:     rax 0000000000000000  rbx 0000000000001256  rcx 00007dcb98929b98  rdx 0000000000000006
2019-06-04 13:18:07.065 4719-4719/? A/DEBUG:     r8  00007dcafcde53bc  r9  00007dcafcde53bc  r10 00007dcafcde53bc  r11 0000000000000246
2019-06-04 13:18:07.065 4719-4719/? A/DEBUG:     r12 00007dcafcde53bf  r13 0000000000000003  r14 0000000000001242  r15 00007dcafc47ea18
2019-06-04 13:18:07.065 4719-4719/? A/DEBUG:     rdi 0000000000001242  rsi 0000000000001256
2019-06-04 13:18:07.065 4719-4719/? A/DEBUG:     rbp 00007dcafcde53bc  rsp 00007dcafc47ea08  rip 00007dcb98929b98
2019-06-04 13:18:07.066 4719-4719/? A/DEBUG: backtrace:
2019-06-04 13:18:07.066 4719-4719/? A/DEBUG:     #00 pc 0000000000026b98  /system/lib64/libc.so (syscall+24)
2019-06-04 13:18:07.066 4719-4719/? A/DEBUG:     #01 pc 0000000000029775  /system/lib64/libc.so (abort+101)
2019-06-04 13:18:07.066 4719-4719/? A/DEBUG:     #02 pc 00000000000b474e  /data/app/tech.safenetwork.zignalz-j1ObXF39rXy68LPRtF8Ptg==/lib/x86_64/libsafe_app_jni.so

Any idea why this is happening or how to avoid it?

3 Likes

Hey @ogrebgr!

In the existing implementation of MutableData, giving only read permission is not allowed as anyone is allowed to fetch a mutable data from the network (provided they know the XorName and tag_type)
The difference in private mutable data is that if the entries are encrypted, they cannot be decrypted without the keys - that are held in an MDataInfo object.

However, this is now changing. The read permissions will now be applicable since mutable data in now unpublished and can be fetched with an owned GET request.
If you haven’t seen these proposed changes here are links to the RFCs:

4 Likes

Thanks @lionel.faber!

I have suspected that this is the problem but frankly expected that when just “read” permission is given the method will just complete silently.
Thanks for the links, I did not knew that there are such changes proposed.

1 Like

IIRC I did this as well and got the crash. I would consider a crash from such an API request a bug since it should return some error or as you say handle it silently if appropriate.
I would prefer that minimum required components are created and changed for MVP 1, so that time to demonstration of the full running network is shorter, albeit without whistles and bells. And so even with no additional data types in MVP 1 I think that it is not terribly important to fix the bug. But on the other hand shouldn’t be difficult either.

2 Likes

We release regular updates on our community forum. You can follow all that we’re up to and share your thoughts in the RFC discussions too :slight_smile:
For instance these are the discussions for the the RFC I previously linked.

You can find more RFC discussion under the RFC topic


And yes, the crash is indeed a bug and should be gracefully handled. But with the incoming changes to the data types the read-only permission will be allowed so we will be removing that check.

4 Likes