Uploaded image for project: 'Realm .NET SDK'
  1. Realm .NET SDK
  2. RNET-1134

Realm Obfuscation (Unity + Local Database)

      Problem

      Hello!

      I've recently integrated obfuscation into an application and hit a number of issues, mostly regarding Realm objects (i.e., IRealmObject)

      The Realms are encrypted (no issues there) but I am also wanting to obfuscate Realm object & property names.

      Initially I tried to use the obfuscation tool to achieve this (so the obfuscator changed the woven Realm 'proxy' classes) but this resulted in the following issue...

      https://www.mongodb.com/docs/atlas/device-sdks/sdk/dotnet/troubleshooting/#resolve-a--no-properties-in-class--exception

      After much trial and error, the only way I can obfuscate the Realm aspect of the app is to...

      1) Use MapTo attributes on Realm objects & properties
      2) Tell the obfuscator to ignore all Realm objects

      But the limitation\issue with this approach is that...

      1) Mono builds (in Assembly-CSharp.dll) & IL2CPP builds (in global-metadata.dat) still contain the un-obfuscated names. I believe it's not too difficult (with the right knowledge\tools) to correlate the un-obfuscated & obfuscated names.
      2) Calculated properties (i.e., non-persisted) on the Realm objects are also not obfuscated.

      The obfuscation tool that I'm using obfuscates mostly by means of attributes. I had hoped these would carry across to their counterparts on the woven 'proxies' but this doesn't seem to be the case.

      So I'm wondering if there is a known workaround? If not, could this be considered for a feature request please?

      Solution

      Couldn't the woven 'proxies' be generated using the mapped names? They currently do, but only as attributes with literal strings. Class & property names still use their un-mapped names.

      Alternatives

      I'm considering a brute force approach of using explicit obfuscated names (for Realm objects & properties) but this means uncompiled code becomes far less readable and is really an absolute last resort.

      How important is this improvement for you?

      Would be a major improvement

      Feature would mainly be used with

      Local Database only

            Assignee:
            nikola.irinchev@mongodb.com Nikola Irinchev
            Reporter:
            unitosyncbot Unito Sync Bot
            AD SDK Team 2
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: