-
Notifications
You must be signed in to change notification settings - Fork 3
Security
This page records security practices for Leaf Reader development and release work.
- Never commit API keys, tokens, private keys, signing keys,
.envfiles, or local credentials. - AI provider keys should be entered through the app settings UI and stored in macOS Keychain.
- Reader startup, document opening, text selection, and automatic background embedding must not read Keychain. Credential access is deferred until an explicit AI, settings, diagnostics, or connection-test action.
- User-data backups exclude Keychain items and filter both
apiKey.*and legacyencryptedApiKey.*preference fields. Restore preserves credentials already present on the current Mac. - Do not hard-code provider keys in Swift, JavaScript, HTML, shell scripts, docs, app bundles, or tests.
- If a key appears in GitHub Secret Scanning, treat it as exposed even if it was removed from the current branch.
When GitHub reports a leaked secret:
- Revoke or delete the exposed key in the provider console.
- Generate a new key only after the old one is revoked.
- Confirm the key is not present in the current working tree.
- Check Git history to identify where it appeared.
- Mark the GitHub Secret Scanning alert as resolved only after revocation.
- Do not reuse the exposed key.
Useful local checks:
rg -n "sk-[A-Za-z0-9_-]+" .
git log --all -S"secret-prefix" --oneline
git grep -l "secret-prefix" <commit>Use a short prefix for investigation and avoid printing full secrets in logs or chat.
Early history may contain generated app bundle files or old credentials. If a secret was ever public, revocation is required even if history is later rewritten.
History rewriting should be avoided unless there is a clear reason, because it changes commit hashes, tags, release references, and local clones. Prefer revoking leaked keys and preventing new leaks.
Do not commit generated app bundles or local release outputs unless there is a deliberate release reason.
Generated outputs include:
Leaf Reader.apprelease/- temporary package roots
- local signing or notarization artifacts
Security docs live in docs/wiki/security.md and should be synced to GitHub Wiki with:
./scripts/sync_github_wiki.sh --pushdocs/wiki/security.mdscripts/sync_github_wiki.shscripts/update_wiki.sh.gitignore
Related: Home · Feature Map · Development Tasks · Code Map · Type Index
Maintained by ./scripts/update_wiki.sh.