Skip to content

A sample solution around obfuscating sensitive data in process memory.

Notifications You must be signed in to change notification settings

grigorye/GEObfuscationSample

Repository files navigation

GEObfuscationSample

A project built atop of task of implementing example of string obfuscation. Doesn't focus on the obfuscation details itself, rather on building a complete automated solution for verification of any obfuscation implementation.

Details

  1. To make things simple, obfuscated value is available as ObfuscatedString, a wrapper around String. The value is disposed from memory together with the wrapper.
  2. Unobfuscated value is available via .withUbfuscated(allowCopy: Bool, handler: (String) -> Void) throws. Using false for allowCopy enables detection of attempts to make a copy of unobfuscated value.
  3. The correctness of the implementation is basically confirmed through observation of (un)obfuscated value in memory while and only while it's allowed by API.
  4. For now NSString is used as backing storage for both unobfuscated and obfuscated values.
  5. (Unit) tests use real process memory scanning via stringdups(1). The whole thing is fully automated and includes simple but efficient solution for running external tool as part of verification, based on shell2http.
  6. SIP (System Integrity Protection) debugging restrictions should be disabled for stringdups to be able to dump the memory content/unit tests to work as expected.
  7. There's a generic workaround for pre-/post-action failures not aborting main action/not tracked in Xcode action logs.

Releases

No releases published

Packages

No packages published