Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Neutrolino.storage functions break macOS bundles #1252

Open
jeffwtm opened this issue May 9, 2024 · 0 comments
Open

Neutrolino.storage functions break macOS bundles #1252

jeffwtm opened this issue May 9, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@jeffwtm
Copy link

jeffwtm commented May 9, 2024

Describe the bug
Because the Neutralino.storage functions write to the application directory, using them in a macOS app bundle causes the bundle contents to be modified. This breaks code signing and notarization, preventing the app from running.

A previous workaround referenced in this issue no longer works: #1131

It seems that the Resources folder inside a bundle used to be considered writable, but current code-signing requires the entire bundle to be read-only: https://developer.apple.com/library/archive/documentation/Security/Conceptual/CodeSigningGuide/Procedures/Procedures.html

Making changes after you sign invalidates the signature. Consider a signed application bundle as a read-only entity.

The recommended way to handle this is to use ~/Library/Application Support/<bundle id> as described here: https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/MacOSXDirectories/MacOSXDirectories.html#//apple_ref/doc/uid/TP40010672-CH10-SW1

To Reproduce
Steps to reproduce the behavior:

  1. Create a Neutralino project and use the storage apis to store some data.
  2. Build and bundle the project for macOS (using these build scripts simplifies this: https://github.com/hschneider/neutralino-build-scripts)
  3. Sign and notarize the bundle (these scripts help: https://github.com/hschneider/macos-sign-notarize)
  4. Run the app so that the storage functions are executed.
  5. Close the app and attempt to run it a second time.
  6. The app fails to run with a "app is damaged and cannot be opened" error because the bundle has been modified.

Expected behavior
The app bundle should not be modified. Either the storage functions could internally use the appropriate ~/Library/Application Support/<bundle id> path on macOS, or they could provide a way to configure the directory they write to and leave it to the app developer to correctly set the folder.

Specifications

  • OS: macOS
  • Neutralinojs version: 5.1.0
  • Neutralinojs client library version: 5.1.0
  • Neutralinojs CLI version: 11.0.1
@jeffwtm jeffwtm added the bug Something isn't working label May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant