security: comprehensive security hardening for API keys, TLS, and data privacy#1121
Open
Littleyd wants to merge 23 commits intotisfeng:mainfrom
Open
security: comprehensive security hardening for API keys, TLS, and data privacy#1121Littleyd wants to merge 23 commits intotisfeng:mainfrom
Littleyd wants to merge 23 commits intotisfeng:mainfrom
Conversation
- add native MiniMax service via OpenAI-compatible endpoint - register MiniMax in QueryServiceFactory and ObjC ServiceType bridge - add localization key and service icon - update supported models to MiniMax Text OpenAI API official list
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit moves the "enable_remove_books_excerpt_info" toggle to a different position in the advanced settings section. The setting now appears after "auto_select_all_text_field" instead of its previous placement. This reordering improves the logical grouping and flow of settings in the text selection and replacement section.
This commit fixes the regular expression for removing book copyright notices from Chinese text. The pattern was updated from "摘自" to "摘" to better match different variations of the copyright notice format. The change expands the regex to capture more cases of Chinese copyright notices, ensuring the text extraction feature works more reliably for different book formats.
This refactoring improves the code structure and performance for the book copyright removal feature: - Swift extension: Added guard clause to return early if feature is disabled - Simplified regex pattern construction and made regex compilation more efficient - Removed redundant conditional logic and streamlined text extraction flow - Improved code organization by separating concerns more clearly The changes make the feature more efficient and easier to maintain while preserving all existing functionality.
This commit fixes an inconsistency where book copyright removal was only applied to keyboard shortcut queries but not mouse selection queries. Previously, the copyright text removal logic was only executed in the keyboard shortcut handling path. Now both keyboard and mouse selection queries will have their text processed through the same copyright removal pipeline, ensuring consistent behavior regardless of how the user initiates a query.
The Vision framework import was being used in MenuItemView but was not actually required by the code. Removing this unused import improves code cleanliness and reduces unnecessary dependencies.
Update the contribution guidelines in both English and Chinese documentation files. This clarifies the branch naming conventions (feat/xxx, fix/xxx) and prohibits direct commits to or branches, emphasizing the need for feature branches and pull requests.
This commit removes the redundant `NSWindowDidResizeNotification` observation in `EZBaseQueryWindow.m`. The window resizing logic is now primarily managed within `EZBaseQueryViewController.m`, making the direct observation of `NSWindowDidResizeNotification` in the window unnecessary. This change aims to centralize window resize handling and improve stability.
Avoid recalculating window height while the frame is being updated internally, and skip frame changes when the target only differs by minor floating-point drift. This keeps query window resizing stable and reduces redundant reload and frame update cycles.
Replace the Claude-specific commit command doc with a symlink to the shared git-commit skill and update AGENTS references to the relocated rule files. Also add an MCP server note for OpenAI developer documentation workflows.
Document the `/git-commit` workflow in both English and Chinese READMEs for contributors using Codex or Claude. Clarify that contributors should stage changes first, review the generated message preview, and explicitly approve before the commit is created.
Update the command line build examples to use `~/Library/Developer/Xcode/DerivedData` instead of the repo-local DerivedData path. Add a note explaining the home-path assumption and document `xcbeautify` installation with Homebrew.
Remove the duplicate Build Commands section from AGENTS.md and replace the stale root-relative link with `.claude/rules/build.md`. This keeps agent guidance aligned with the single source of truth for command line build and test commands.
…a privacy - Store API keys in macOS Keychain instead of UserDefaults (with auto-migration) - Remove WebView trust-all-certificates bypass (EZURLSchemeHandler) - Tighten App Transport Security: NSAllowsLocalNetworking only (was NSAllowsArbitraryLoads) - Remove hardcoded Baidu session cookies (BDUSS) - Add user confirmation dialog for URL Scheme API key read/write operations - Change Bing endpoint from HTTP to HTTPS - Default analytics (Firebase) and crash logging (Sentry) to opt-in (was opt-out) - Truncate OCR text in logs to prevent sensitive data leakage - Filter API keys/tokens from backup export to Downloads folder Made-with: Cursor
Easydict connects to many translation services over HTTP (Ollama on localhost, Bing China, etc.). NSAllowsLocalNetworking alone is too restrictive and breaks Ollama. Restore NSAllowsArbitraryLoads while keeping NSAllowsLocalNetworking as explicit documentation. Made-with: Cursor
Owner
|
Please use dev branch as base branch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR addresses multiple security vulnerabilities identified during a comprehensive security audit of the Easydict codebase. The changes focus on protecting user data and API credentials.
High-Priority Fixes
API Keys migrated to macOS Keychain — All translation service API keys/secrets (DeepL, Baidu, Ali, Tencent, Volcano, NiuTrans, Caiyun, and OpenAI-compatible stream services) are now stored in Keychain instead of UserDefaults. A transparent migration runs on first launch.
WebView TLS certificate validation restored — Removed
allowsAnyHTTPSCertificateForHost:YESand the blanket trust indidReceiveAuthenticationChallenge:. WebView now properly validates server certificates.App Transport Security tightened — Replaced
NSAllowsArbitraryLoads = YESwithNSAllowsLocalNetworking = YESin both Info.plist and Info-debug.plist, restricting plaintext HTTP to localhost only.Hardcoded Baidu session cookie removed — Removed embedded
BDUSS/BDUSS_BFESSvalues fromEZWebViewTranslator.m.URL Scheme key read/write gated by user confirmation —
easydict://writeKeyValueandeasydict://readValueOfKeynow show an NSAlert requiring explicit user approval before executing.Medium-Priority Fixes
Analytics & crash reporting default to opt-in —
allowCrashLogandallowAnalyticsnow default tofalse.OCR text truncated in logs — Full OCR results are no longer written to system logs.
Sensitive keys filtered from backup export — API keys, secrets, and tokens are excluded from the user data export file.
Bing endpoint upgraded to HTTPS — Changed
http://tohttps://for the Bing China host.New Files
Easydict/Swift/Utility/KeychainHelper.swift— Keychain CRUD helper + migration logic from UserDefaults to Keychain.Test Plan
easydict://writeKeyValue?EZTest=abcshows confirmation dialogeasydict://readValueOfKey?EZTestshows confirmation dialogMade with Cursor