rrroyal / Harbour

Docker/Portainer management app for iOS, iPadOS and macOS.
https://harbour.shameful.xyz
GNU Affero General Public License v3.0
521 stars 21 forks source link

Keychain errors when sideloading #50

Open Wamy-Dev opened 3 weeks ago

Wamy-Dev commented 3 weeks ago

Failed to load token: KeychainKit.Keychain.SecError(status: -34018)

The above is the error I am seeing in the logs. I can add the credentials just fine, but whenever I close the app and reopen it, the credentials go blank. Obviously we want to keep the credentials on the device so that the user can come back without having to add them often.

To Reproduce Steps to reproduce the behavior:

  1. Install latest version
  2. Add portainer instance using URL and ptr key.
  3. Close app, remove from history
  4. Open app

Expected behavior To be able to connect properly even when opening the app again.

rrroyal commented 3 weeks ago

Which method of distribution are you using? App Store, TestFlight, sideloaded (.ipa/.app) or self-built? SecError -34018 corresponds to errSecMissingEntitlement, so I'm not sure what could be the cause of it except for wrong codesigning :/

Wamy-Dev commented 3 weeks ago

Which method of distribution are you using?

Sideloaded through Altstore, with all extensions. I have a developer account.

rrroyal commented 3 weeks ago

Yeah, that could be the issue - I'm guessing the keychain-access-groups entitlement gets lost somewhere, which means that Harbour can't read/write to the Keychain.

Can you try sideloading with SideStore or Sideloadly?

Wamy-Dev commented 3 weeks ago

Ill try it with SideStore, but regardless, why can't we store this locally rather than on the keychain. I would prefer to use AltStore, since I already have all of my apps there.

Wamy-Dev commented 3 weeks ago

Same issue with SideStore. Seems like sideloading in general is broken. Testflight works fine though.

rrroyal commented 3 weeks ago

Harbour is using the Keychain as it's the preferred method of storing secrets on Apple devices + it syncs between platforms.

Every app has access to it's own container (or a group container, when it needs to share contents between various targets, for example app <-> widgets). Harbour is using the latter, which needs to specify the id of the container (Shared/Extensions/KeychainKit/Keychain+.swift) and have the appropriate entitlement - keychain-access-groups.

Can you check what's the application identifier of sideloaded Harbour and whether it has App Groups capability enabled? You can check it on the Apple Developer website.

Wamy-Dev commented 2 weeks ago

Sorry for the delay, it does have the App Groups capability.

rrroyal commented 2 weeks ago

can you replace the MainBundleIdentifier to your Bundle ID in both Info.plist files (Harbour/Info.plist, PlugIns/HarbourWidgets.appex/Info.plist) and see if that fixes things?

Wamy-Dev commented 2 weeks ago

Sorry, I don't actually know how to do that :/

rrroyal commented 2 weeks ago

Can you provide me Your Bundle ID then? I'll send you the (possibly) fixed build

Wamy-Dev commented 2 weeks ago

Can you provide me Your Bundle ID then? I'll send you the (possibly) fixed build

xyz.shameful.Harbour.3VTF3L32BZ (explicit)

Let's hope this works!

rrroyal commented 2 weeks ago

Replicated - unfortunately, just swapping the value in .plist files won't fix it. I'll see what I can do!

Wamy-Dev commented 2 weeks ago

I ended up buying the app to support the project, but I am still willing to test any fixes