orta / cocoapods-keys

A key value store for storing per-developer environment and application keys
MIT License
1.55k stars 93 forks source link

Not working with bitcode_enabled NO flag #201

Closed muddsar closed 4 years ago

muddsar commented 4 years ago

i am currently playing with Cocoapods-keys & observed that it doesn't work if bitcode_enabled is NO. values are embeded as plain text in Keys.Framework/Keys file. Can you please confirm if this is the expected behaviour?

orta commented 4 years ago

They should be accessible at runtime as plain keys, but I'd be surprised that they show up as raw values in the binaries though, the code in your app looks like this:

https://github.com/orta/cocoapods-keys/blob/master/templates/Keys.m.erb#L36-L48

And never writes the raw values anywhere

muddsar commented 4 years ago

Here is the steps i am taking.

    • Go to XCode->Build Settings->Enable Bitcode, Set to NO
    • Archive the app & export for AppStore
    • Go to the exported folder, Unarchive the .ipa
    • Go to Payload folder
    • Select .app -> Right click->Show Package Contents->Frameworks->Keys.Frameworks->Keys
    • Open the Keys using any editor.
    • Search for the value of the Key. In my cases two values are "testClient", "testSecret"

image

In screenshot attached you can see you can see the values in plain text. Altough last part has been chopped in sample project, In real project few of the keys are exposed without chopping. Let me know if you needs further information. Thanks

orta commented 4 years ago

Interesting, yeah, apple must have improved their compiler since I built this 6 years back, maybe it is inlining the string accessors in C now.

I'm open to an alternative templates which don't have this issue 👍 - that could be as simple as ussing the NSString API instead of a c array or other alternatives

orta commented 4 years ago

OK, that's updated and shipped as 2.2.0 - great find @muddsar

muddsar commented 4 years ago

Great, Thanks again for the awesome fix guys :)

ashfurrow commented 4 years ago

@muddsar thank you for including such clear steps to reproduce! It made testing the fix really straightforward 👍

muddsar commented 4 years ago

@ashfurrow you are welcome. Looks like your PR was merged in but release commit failed the pipeline :( i hope it will be resolved soon. Keep up the good work :)

ashfurrow commented 4 years ago

@muddsar It looks like it's published here? I've been able to bundle update cocoapods-keys successfully, and re-running bundle exec pod install got me the fixed version: https://rubygems.org/gems/cocoapods-keys/versions/2.2.0

muddsar commented 4 years ago

@ashfurrow Thanks for the correction, i was looking at the releases & tags in the repository. i tried the instructions you provided & it works like a charm.