Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 40 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,53 @@ jobs:
- name: Generate Paraglide output
run: npx paraglide-js compile --project ./project.inlang --outdir ./src/renderer/src/paraglide

- name: Setup macOS code signing
if: matrix.platform == 'macos'
shell: bash
env:
APPLE_CERTIFICATE_BASE64: ${{ secrets.APPLE_CERTIFICATE_BASE64 }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD || github.run_id }}
run: |
# Create temporary keychain
KEYCHAIN_PATH=$RUNNER_TEMP/build.keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
security set-keychain-settings -lut 21600 "$KEYCHAIN_PATH"
security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"

# Import certificate
CERTIFICATE_PATH=$RUNNER_TEMP/certificate.p12
echo "$APPLE_CERTIFICATE_BASE64" | base64 --decode > "$CERTIFICATE_PATH"
security import "$CERTIFICATE_PATH" -k "$KEYCHAIN_PATH" -P "$APPLE_CERTIFICATE_PASSWORD" -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"

# Set as default keychain
security list-keychain -d user -s "$KEYCHAIN_PATH"

# Clean up certificate file
rm "$CERTIFICATE_PATH"

- name: Build
run: npm run build

- name: Package
run: npx electron-builder ${{ matrix.dist-flag }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
APPLE_TEAM_ID: ${{ matrix.platform == 'macos' && secrets.APPLE_TEAM_ID || '' }}
APPLE_ID: ${{ matrix.platform == 'macos' && secrets.APPLE_ID || '' }}
APPLE_APP_PASSWORD: ${{ matrix.platform == 'macos' && secrets.APPLE_APP_SPECIFIC_PASSWORD || '' }}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated

This comment was marked as outdated.


- name: Cleanup macOS keychain
if: matrix.platform == 'macos' && always()
shell: bash
env:
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD || github.run_id }}
run: |
KEYCHAIN_PATH=$RUNNER_TEMP/build.keychain
if [ -f "$KEYCHAIN_PATH" ]; then
security delete-keychain "$KEYCHAIN_PATH"
fi

- name: Upload artifacts
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -176,7 +216,3 @@ jobs:
### Prerequisites

[birda](https://github.com/tphakala/birda) CLI must be installed and available on your PATH.

### macOS Users

This app is not yet code-signed. After downloading, right-click the app and select **Open** to bypass Gatekeeper.
14 changes: 14 additions & 0 deletions build/entitlements.mac.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?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.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-medium medium

The entitlements com.apple.security.cs.allow-dyld-environment-variables and com.apple.security.cs.disable-library-validation are enabled.

  • com.apple.security.cs.allow-dyld-environment-variables (lines 9-10) allows the application to be influenced by DYLD_* environment variables, which can be used to inject malicious libraries into the application's process. This is rarely required for production applications and significantly weakens the Hardened Runtime protections.
  • com.apple.security.cs.disable-library-validation (lines 11-12) allows the application to load any signed library, even if not signed by the same developer or Apple. This should only be enabled if the application must load third-party native modules that cannot be signed with your own certificate.

Unless these are strictly required for the application to function in production, they should be removed to maintain a stronger security posture and adhere to the Principle of Least Privilege.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partially correct.

allow-dyld-environment-variables: Agree - removing this (not needed, security risk).

disable-library-validation: Required for this app. We use better-sqlite3, a native Node.js addon that requires this entitlement to load properly. Without it, macOS will reject the native module during hardened runtime. This is standard practice for Electron apps with native dependencies (electron-builder #4616, LM Studio #1494).

Keeping allow-jit, allow-unsigned-executable-memory, and disable-library-validation. Removing only allow-dyld-environment-variables.

</dict>
</plist>
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,14 @@
"target": [
"dmg"
],
"category": "public.app-category.utilities"
"category": "public.app-category.utilities",
"hardenedRuntime": true,
"gatekeeperAssess": false,
"entitlements": "build/entitlements.mac.plist",
"entitlementsInherit": "build/entitlements.mac.plist",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The entitlementsInherit property is redundant here. According to the electron-builder documentation, entitlementsInherit defaults to the value of entitlements if not specified. Since you are setting it to the same value, you can remove this line to simplify the configuration.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not redundant - these serve different purposes:

  • entitlements: Applied to the main app binary
  • entitlementsInherit: Applied to child processes, frameworks, and bundles

Using the same file for both is intentional (we want consistent permissions across all processes). The default is build/entitlements.mac.inherit.plist, not the value of entitlements (electron-builder docs).

"notarize": {
"teamId": "${APPLE_TEAM_ID}"
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
},
"nsis": {
"oneClick": false,
Expand Down
Loading