Here is my parent.plist file contents:
```
Here is my child.plist file
My signing command:
electron-osx-sign "XXXX-mas-x64/XXXX.app" --verbose --identity="**" --entitlements=./entitlements/parent.plist --entitlements-inherit=./entitlements/child.plist --platform=mas --version=1.0.2 --provisioning-profile=./XXXXX.provisionprofile --type=development
```
Error that I am getting:
deny file-write-create App doesn't have permission to write file.
The file is being saved from a user dialog, they select location and file if written to that location.
Hi @trigun539, thanks for reporting the issue. Quick check, are you using this dialog when prompting the user to save the file?
Amend: electron-osx-sign should be able to discover com.apple.security.application-groups by itself so it's fine to skip this item in the entitlements file.
yes, I am using dialog.showSaveDialog. I removed the com.apple.security.application-groups portion but if I did that, I would just get a blank page when app is opened (not responding).
@trigun539 Mhm that's very weird. (Probably the codesign wasn't done correctly.) Would you mind running the codesign again with export DEBUG=electron-osx-sign* (with the asterisk) and posting the debug log here afterwards?
Also, a little issue I see from your choice of Electron version... I would recommend using Electron >= v1.1.1 since earlier versions may experience graphics issues after sandboxing 馃槷 & make sure to use the Mac Developer identity for local testing/development and the latest electron-osx-sign for codesigning.
@sethlu Here is the output of the command. Also, I was able to write the file to pictures folder if I gave it the following entitlement: com.apple.security.assets.pictures.read-write. However, I need the com.apple.security.files.user-selected.read-write
electron-osx-sign "Croppr-mas-x64/Croppr.app" --verbose --identity="3rd Party Mac Developer Application: Edwin Perez (XXXXX)" --entitlements=./entitlements/parent.plist --entitlements-inherit=./entitlements/child.plist --platform=mas --version=1.0.2 --provisioning-profile=./Croppr_Development_Profile.provisionprofile --type=development
[32;1melectron-osx-sign [0m`identity` passed in arguments. [32m+0ms[0m
[32;1melectron-osx-sign [0mExecuting... security find-identity -v [32m+3ms[0m
[32;1melectron-osx-sign [0mIdentity:
> Name: 3rd Party Mac Developer Application: Edwin Perez (XXXXXXX)
> Hash: FCA58879658BFAE58ED4A6889C5045BA4B442B9F [32m+180ms[0m
[32;1melectron-osx-sign [0mFound 1 identity. [32m+1ms[0m
[32;1melectron-osx-sign [0mPre-sign operation enabled for provisioning profile:
* Disable by setting `pre-embed-previsioning-profile` to `false`. [32m+0ms[0m
[32;1melectron-osx-sign [0mPre-sign operation enabled for entitlements automation with versions >= `1.1.1`:
* Disable by setting `pre-auto-entitlements` to `false`. [32m+0ms[0m
[32;1melectron-osx-sign [0m`provisioning-profile` passed in arguments. [32m+1ms[0m
[32;1melectron-osx-sign [0mExecuting... security cms -D -i ./Croppr_Development_Profile.provisionprofile [32m+0ms[0m
[32;1melectron-osx-sign [0mProvisioning profile:
> Name: Croppr Development Profile
> Platforms: [ 'darwin', 'mas' ]
> Type: development
> Path: ./Croppr_Development_Profile.provisionprofile
> Message: { AppIDName: 'croppr',
ApplicationIdentifierPrefix: [ 'XXXXXXX' ],
CreationDate: 2017-06-08T09:26:41.000Z,
Platform: [ 'OSX' ],
DeveloperCertificates: [ <Buffer 30 82 05 83 30 82 04 6b a0 03 02 01 02 02 08 10 e2 f9 d7 53 54 b7 6b 30 0d 06 09 2a 86 48 86 f7 0d 01 01 05 05 00 30 81 96 31 0b 30 09 06 03 55 04 06 ... > ],
Entitlements:
{ 'keychain-access-groups': [ 'XXXXXXX.*' ],
'com.apple.application-identifier': 'XXXXXXXX.io.eperez.croppr',
'com.apple.developer.team-identifier': 'XXXXXXX' },
ExpirationDate: 2018-06-08T09:26:41.000Z,
Name: 'Croppr Development Profile',
ProvisionedDevices: [ 'F82047D1-AC3B-5BC3-BC99-BC7BD685716E' ],
TeamIdentifier: [ 'XXXXXXX' ],
TeamName: 'Edwin Perez',
TimeToLive: 365,
UUID: '521bbfbf-bdfe-439d-8402-27c90a7beb36',
Version: 1 } [32m+51ms[0m
[32;1melectron-osx-sign [0mLooking for existing provisioning profile... [32m+3ms[0m
[32;1melectron-osx-sign [0mFound embedded provisioning profile:
* Please manually remove the existing file if not wanted.
* Current file at: Croppr-mas-x64/Croppr.app/Contents/embedded.provisionprofile [32m+1ms[0m
[32;1melectron-osx-sign [0mSigning application...
> Application: Croppr-mas-x64/Croppr.app
> Platform: mas
> Entitlements: ./entitlements/parent.plist
> Child entitlements: ./entitlements/child.plist
> Additional binaries: []
> Identity: { name: '3rd Party Mac Developer Application: Edwin Perez (XXXXXXX)',
hash: 'FCA58879658BFAE58ED4A6889C5045BA4B442B9F' } [32m+0ms[0m
[32;1melectron-osx-sign [0mWalking... Croppr-mas-x64/Croppr.app/Contents [32m+0ms[0m
[32;1melectron-osx-sign [0mSigning... Croppr-mas-x64/Croppr.app/Contents/Frameworks/Croppr Helper EH.app/Contents/MacOS/Croppr Helper EH [32m+25ms[0m
[32;1melectron-osx-sign [0mExecuting... codesign --sign FCA58879658BFAE58ED4A6889C5045BA4B442B9F --force --entitlements ./entitlements/child.plist Croppr-mas-x64/Croppr.app/Contents/Frameworks/Croppr Helper EH.app/Contents/MacOS/Croppr Helper EH [32m+0ms[0m
[32;1melectron-osx-sign [0mSigning... Croppr-mas-x64/Croppr.app/Contents/Frameworks/Croppr Helper EH.app [32m+101ms[0m
[32;1melectron-osx-sign [0mExecuting... codesign --sign FCA58879658BFAE58ED4A6889C5045BA4B442B9F --force --entitlements ./entitlements/child.plist Croppr-mas-x64/Croppr.app/Contents/Frameworks/Croppr Helper EH.app [32m+0ms[0m
[32;1melectron-osx-sign [0mSigning... Croppr-mas-x64/Croppr.app/Contents/Frameworks/Croppr Helper NP.app/Contents/MacOS/Croppr Helper NP [32m+93ms[0m
[32;1melectron-osx-sign [0mExecuting... codesign --sign FCA58879658BFAE58ED4A6889C5045BA4B442B9F --force --entitlements ./entitlements/child.plist Croppr-mas-x64/Croppr.app/Contents/Frameworks/Croppr Helper NP.app/Contents/MacOS/Croppr Helper NP [32m+0ms[0m
[32;1melectron-osx-sign [0mSigning... Croppr-mas-x64/Croppr.app/Contents/Frameworks/Croppr Helper NP.app [32m+91ms[0m
[32;1melectron-osx-sign [0mExecuting... codesign --sign FCA58879658BFAE58ED4A6889C5045BA4B442B9F --force --entitlements ./entitlements/child.plist Croppr-mas-x64/Croppr.app/Contents/Frameworks/Croppr Helper NP.app [32m+0ms[0m
[32;1melectron-osx-sign [0mSigning... Croppr-mas-x64/Croppr.app/Contents/Frameworks/Croppr Helper.app/Contents/MacOS/Croppr Helper [32m+94ms[0m
[32;1melectron-osx-sign [0mExecuting... codesign --sign FCA58879658BFAE58ED4A6889C5045BA4B442B9F --force --entitlements ./entitlements/child.plist Croppr-mas-x64/Croppr.app/Contents/Frameworks/Croppr Helper.app/Contents/MacOS/Croppr Helper [32m+0ms[0m
[32;1melectron-osx-sign [0mSigning... Croppr-mas-x64/Croppr.app/Contents/Frameworks/Croppr Helper.app [32m+95ms[0m
[32;1melectron-osx-sign [0mExecuting... codesign --sign FCA58879658BFAE58ED4A6889C5045BA4B442B9F --force --entitlements ./entitlements/child.plist Croppr-mas-x64/Croppr.app/Contents/Frameworks/Croppr Helper.app [32m+0ms[0m
[32;1melectron-osx-sign [0mSigning... Croppr-mas-x64/Croppr.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework [32m+91ms[0m
[32;1melectron-osx-sign [0mExecuting... codesign --sign FCA58879658BFAE58ED4A6889C5045BA4B442B9F --force --entitlements ./entitlements/child.plist Croppr-mas-x64/Croppr.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework [32m+0ms[0m
[32;1melectron-osx-sign [0mSigning... Croppr-mas-x64/Croppr.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libffmpeg.dylib [32m+977ms[0m
[32;1melectron-osx-sign [0mExecuting... codesign --sign FCA58879658BFAE58ED4A6889C5045BA4B442B9F --force --entitlements ./entitlements/child.plist Croppr-mas-x64/Croppr.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libffmpeg.dylib [32m+0ms[0m
[32;1melectron-osx-sign [0mSigning... Croppr-mas-x64/Croppr.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libnode.dylib [32m+126ms[0m
[32;1melectron-osx-sign [0mExecuting... codesign --sign FCA58879658BFAE58ED4A6889C5045BA4B442B9F --force --entitlements ./entitlements/child.plist Croppr-mas-x64/Croppr.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libnode.dylib [32m+0ms[0m
[32;1melectron-osx-sign [0mSigning... Croppr-mas-x64/Croppr.app/Contents/Frameworks/Electron Framework.framework [32m+268ms[0m
[32;1melectron-osx-sign [0mExecuting... codesign --sign FCA58879658BFAE58ED4A6889C5045BA4B442B9F --force --entitlements ./entitlements/child.plist Croppr-mas-x64/Croppr.app/Contents/Frameworks/Electron Framework.framework [32m+0ms[0m
[32;1melectron-osx-sign [0mSigning... Croppr-mas-x64/Croppr.app/Contents/MacOS/Croppr [32m+969ms[0m
[32;1melectron-osx-sign [0mExecuting... codesign --sign FCA58879658BFAE58ED4A6889C5045BA4B442B9F --force --entitlements ./entitlements/child.plist Croppr-mas-x64/Croppr.app/Contents/MacOS/Croppr [32m+0ms[0m
[32;1melectron-osx-sign [0mSigning... Croppr-mas-x64/Croppr.app [32m+1s[0m
[32;1melectron-osx-sign [0mExecuting... codesign --sign FCA58879658BFAE58ED4A6889C5045BA4B442B9F --force --entitlements ./entitlements/p*** Croppr-mas-x64/Croppr.app [32m+1ms[0m
[32;1melectron-osx-sign [0mVerifying... [32m+1s[0m
[32;1melectron-osx-sign [0mVerifying application bundle with codesign... [32m+1ms[0m
[32;1melectron-osx-sign [0mExecuting... codesign --verify --deep --verbose=2 --strict Croppr-mas-x64/Croppr.app [32m+0ms[0m
[32;1melectron-osx-sign [0mVerified. [32m+1s[0m
[32;1melectron-osx-sign [0mDisplaying entitlements... [32m+1ms[0m
[32;1melectron-osx-sign [0mExecuting... codesign --display --entitlements :- Croppr-mas-x64/Croppr.app [32m+0ms[0m
[32;1melectron-osx-sign [0mEntitlements:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.application-groups</key>
<string>XXXXXXX.io.eperez.croppr</string>
<key>com.apple.security.files.user-selected.read-write</key>
<true/>
</dict>
</plist>
[32m+31ms[0m
[32;1melectron-osx-sign [0mApplication signed. [32m+0ms[0m
[32;1melectron-osx-sign [0mApplication signed: Croppr-mas-x64/Croppr.app [32m+0ms[0m
Application signed: Croppr-mas-x64/Croppr.app
@trigun539 The signing identity should be Mac Developer instead of 3rd Party Mac Developer Application for development signing.
On the issue regarding to deny file-write-create... I'm wondering if com.apple.security.files.user-selected.read-write only allows reading/overwriting an existing file but not creating something new. 馃槙 Where are you trying to write a new file to... for example?
@sethlu The user would be creating a new file on a location they select. So, for example:
@trigun539 so the user selects the directory and enters the file name in the modal created with dialog.showSaveDialog()?
@sethlu yes
@trigun539 I may need to recreate the issue for some further experiments before knowing the cause for the issue. However, the codesigning process should've been set up correctly, since you can write to the Pictures folder with the corresponding entitlement key.
@sethlu I am in the process of re-creating and isolating the issue. Will let you know if I run into the issue again.
@trigun539 Cool! Looking forward to hearing from you soon 馃樅
It turned out to that I was adding the file extension to the filename given by the user. So, it would fail since I didn't have permissions to the path-to-file[ext]. I do get the right permissions to path-to-file piece. Sorry about the trouble. Thanks @sethlu
@trigun539 no worries 馃樃 glad you found the cause to this issue.
@trigun539 I think I have the same issue but I don't really understand how you've fixed it. I need the permissions to let the user create .md files. It would be great if you could help me 馃槃
My .entitlements files are looking like your files in the initial comment.
@chryb the problem is that you depend on the user to "add" the extension themselves. If they don't add it while in the save popup, then you only have access to "sample" not "sample.md". I kept trying to add the extension programatically and failed because I didn't have access.
@trigun539 I don't add the file extension by myself, it's added with filters: [ { name: 'Markdown', extensions: ['md'] } ] in the dialog options. Do you think that this could produce the error?
@chryb I would take that out and see if it worked without it. If it does, then something may need to be updated with electron to ensure the extension is taken into account when user selects something so the app gets permission to the file.
@trigun539 I have found the problem. It has nothing to do with electron-osx-sign, however, it's caused through jetpack-fs. Jetpack has an atomic mode to save files securely, but this creates a new temporary file. The sandbox doesn't allow to create this file. I will add an issue to the jetpack repo.
Most helpful comment
@trigun539 I have found the problem. It has nothing to do with electron-osx-sign, however, it's caused through jetpack-fs. Jetpack has an atomic mode to save files securely, but this creates a new temporary file. The sandbox doesn't allow to create this file. I will add an issue to the jetpack repo.