diff --git a/en/host/mongodb-workbench-plugin-design.md b/en/host/mongodb-workbench-plugin-design.md index eac25e9..dbba4c5 100644 --- a/en/host/mongodb-workbench-plugin-design.md +++ b/en/host/mongodb-workbench-plugin-design.md @@ -46,16 +46,16 @@ connection entry inside the workbench — is retired with it. | --- | --- | | Entry | "MongoDB: Open MongoDB workbench" in the command palette; if the panel is already open it is brought forward. The leftmost toolbar button "Connect" and the "+" in the object-tree header create a connection; double-clicking a connection row connects it, and its context menu has connect / disconnect / edit / duplicate / delete | | Saved connections | Plugin storage (`IPluginStorage`, key `connections`); settings are stored under the string keys in `MongoSettings`, the same ones parsing uses. The tree root lists every connection (grey dot: not connected, green: connected, red: failed); grouped ones sit under a collapsible group row; recently used ones come first | -| Password | The host's encrypted key store (`ISecretsApi`, keyed by connection id); never in the connection string and never in plugin storage. Leaving the password box empty while editing keeps it; switching to anonymous deletes it | +| Password | The host's encrypted key store (`ISecretsApi`, keyed by connection id); never in the connection string and never in plugin storage. Leaving the password box empty while editing keeps it; switching to anonymous deletes it. In the URI form, a username / password written into the URI is split out on save: the username fills the Username field, the password goes to the key store, and plugin storage keeps only the URI without credentials (older connections migrate on their next save) | | Several connections at once | Each connected connection gets a session object, and that object is what its tabs receive — the same collection in two connections is two tabs; the toolbar, the read-only switch, the server badge and the status strip follow the connection of the active tab | -| SSH jump host | Pick one of the SSH connections saved in the host (`ISessionsApi.ListSavedAsync`). On connect the plugin asks the host to open it (`OpenAsync`; the reason is shown to the user verbatim), starts a forwarding port on the local loopback, and every driver connection is paired with a stream opened on the jump host through `IRemoteTunnelApi.OpenTcpAsync`. Connections through the same jump host share one session, which closes when the last one leaves — and only if the plugin opened it (the host refuses to close the user's own terminal sessions). The plugin never sees the jump host's credentials | +| SSH jump host | Pick one of the SSH connections saved in the host (`ISessionsApi.ListSavedAsync`). On connect the plugin asks the host to open it (`OpenAsync`; the reason is shown to the user verbatim), starts a forwarding port on the local loopback, and every driver connection is paired with a stream opened on the jump host through `IRemoteTunnelApi.OpenTcpAsync`. Connections through the same jump host share one session, which closes when the last one leaves — and only if the plugin opened it (the host refuses to close the user's own terminal sessions). The plugin never sees the jump host's credentials. Both the host-list and the URI form can go through a jump host (the URI is parsed as written and only its server is replaced by the local endpoint); a `mongodb+srv://` URI, like the SRV form, cannot, and is rejected with an error rather than connecting directly around the jump host. When the shared session dies (jump host restart, network blip), the next stream open notices the session is gone, reopens it once and retries; when two connections open the same jump host at the same time, the extra session the later one opened is closed right away. TLS through a jump host: the driver connects to 127.0.0.1, so the certificate's host name is checked against the real target host instead (SAN / CN); every other certificate error is still reported | | Certificate trust | When a self-signed certificate blocks the connection, the failure card lists the certificate (subject, issuer, expiry, SHA-1) and offers "Trust this certificate and reconnect", which pins that one thumbprint | | Board 10 | Implementation | | --- | --- | | Name / group / environment | The "Basic" row; the group can be an existing one or a new one; the environment is three chips with tone dots, and picking production turns on read-only and write confirmation (unless the policy was changed by hand) | | Host list / SRV record / connection string URI | A segmented control; the host list has one host per row (the first is the connection's host) and "+ Add host"; SRV is a single domain field and turns TLS on by default; the URI form is the whole string | -| Replica set, default database, readPreference | One row split into thirds (hidden for the URI form, where the string decides) | +| Replica set, default database, readPreference | One row split into thirds (hidden for the URI form, where the string decides: readPreference, appName, timeouts and compressors written in the URI are overridden only by settings explicitly set under "Advanced") | | Mechanism / authSource / username / password | The mechanism defaults to negotiating SCRAM-SHA-256, with SCRAM-SHA-1, X.509 and PLAIN/LDAP as alternatives; the "Key store" tag next to the password box says where it is kept | | "Secure channel": SSH jump / TLS cards | The jump card's switch is disabled, with the reason written underneath, when no SSH connection is saved or SRV is selected (one already on can still be turned off); TLS, once on, adds CA and client-certificate fields | | Side panel: connection string | Built by string work only and redacted (the password is always `****`), coloured by segment role, copyable; a half-typed URI is shown as typed, redacted | @@ -83,17 +83,17 @@ Two easy mistakes: | Board | Implementation | | --- | --- | -| 01 grid · 02 JSON view · 13 tree view | Collection workbench: typed column headers, BSON colouring, inline editing, inspector (fields / JSON / collection info, per-field type menu), staging and paging; tree view with its context menu; inline JSON-card editing with value-distribution suggestions | -| 03 query editor · 14 explain | A Navicat-style two-row toolbar (the lower row is "Connection ▾ Database ▾" plus Run, deciding where statements run); parsing and running a mongosh subset, context-aware completion (including the fields a preceding `$group` outputs), diagnostics with quick fixes, code lenses, several result tabs; explain output flattened into a stage flow with candidate plans, ESR advice and hint comparison | +| 01 grid · 02 JSON view · 13 tree view | Collection workbench: typed column headers, BSON colouring, inline editing (wide tables only realize the columns in the viewport), inspector (fields / JSON / collection info, per-field type menu), staging and paging; tree view with its context menu; inline JSON-card editing with value-distribution suggestions | +| 03 query editor · 14 explain | A Navicat-style two-row toolbar (the lower row is "Connection ▾ Database ▾" plus Run, deciding where statements run); parsing and running a mongosh subset, context-aware completion (including the fields a preceding `$group` outputs), diagnostics with quick fixes, code lenses, several result tabs; explain output flattened into a stage flow with candidate plans, ESR advice and hint comparison. When the server pushes stages down to the SBE engine (`explainVersion: "2"`, common for `$group` and friends since 7.0), the stage flow is built from `winningPlan.queryPlan`, totals come from the top level of the execution stats, and per-stage numbers are matched back by `planNodeId` where possible — the tree under `executionStages` is SBE's slot tree, whose stage names are not `IXSCAN` and the like | | 04 aggregation pipeline | Stage cards (enable/disable, drag to reorder, per-stage output preview), two-way text mode, code export in five languages, create view, `$out` / `$merge` | | 05 document editor | Form / JSON / diff modes, minimal `$set` / `$unset`, client-side `$jsonSchema` pre-check, "redo on the latest version" after an optimistic-concurrency conflict | -| 06 GridFS | Virtual directories, revisions of the same file name (restore, download; old revisions can be deleted one at a time, a ticked few at once, or all but the latest — the latest is never among them), streaming upload and download, drag and drop or clicking the drop zone to choose files / a folder, orphan-chunk check, metadata editing | -| 07 indexes · 07b new index · 08 schema · 16 validation | `$indexStats` usage and build progress, ESR suggestions from slow queries in `system.profile`, a full-width new-index editor (see below); `$sample`-based analysis and a generated `$jsonSchema`; server-side rule pre-check (`$nor`), trial documents, version history | +| 06 GridFS | Virtual directories, revisions of the same file name (restore, download; old revisions can be deleted one at a time, a ticked few at once, or all but the latest — the latest is never among them), streaming upload and download, drag and drop or clicking the drop zone to choose files / a folder, orphan-chunk check, metadata editing. Downloads to a folder are written to `.part` and then renamed; same-named files (already on disk, or from different virtual directories in one batch) get a number instead of being overwritten | +| 07 indexes · 07b new index · 08 schema · 16 validation | `$indexStats` usage and build progress, ESR suggestions from slow queries in `system.profile`, a full-width new-index editor (see below); `$sample`-based analysis and a generated `$jsonSchema`; server-side rule pre-check (`$nor`), trial documents, version history. Index advice never suggests dropping `_id`, TTL, unique or shard-key-supporting indexes, and an index with a different collation is not called redundant; applying a validation rule says "N of 1,000 sampled don't match", words the consequence by level / action, and is unavailable until the pre-check has finished | | 10 new connection | See section 2 (the plugin's own dialog) | -| 11 server monitor · 15 slow queries | Delta sampling of `serverStatus` / `replSetGetStatus`, stacked bar charts, member cards, storage top list, inferred events; `$currentOp` with killOp, profiler level, slow queries grouped by query shape | +| 11 server monitor · 15 slow queries | Delta sampling of `serverStatus` / `replSetGetStatus`, stacked bar charts, member cards, storage top list, inferred events; `$currentOp` with killOp, profiler level, slow queries grouped by query shape. Nothing is sampled while the tab is hidden; the first sample after it comes back only sets a baseline, and periods with no samples are drawn as gaps rather than zeros. Storage top, profiler levels and the slow-query check run as separate background work so they don't stretch the sampling interval. When slow-query polling fails, a banner says so and the current-operations list is cleared (so nobody kills a stale opid) | | 12 object list · 17 new collection | Navicat-style object page (stats, DDL, privileges); five collection kinds with a live command preview | -| 18 users and roles | Built-in role matrix, custom roles, authentication restrictions, effective-privilege preview; saving issues incremental grant / revoke commands | -| 19 export · 20 import · 21 data transfer | JSON / CSV / XLSX / BSON dump (mongodump compatible) / shell script; import dry-run with validator-aware issues; copying collections, buckets, indexes and rules across sessions | +| 18 users and roles | Built-in role matrix, custom roles, authentication restrictions, effective-privilege preview; saving issues incremental grant / revoke commands. A new user's password is typed twice; changing the password of the connection's own user asks for extra confirmation and, on success, updates the copy saved in the key store | +| 19 export · 20 import · 21 data transfer | JSON / CSV / XLSX / BSON dump (mongodump compatible) / shell script; import dry-run with validator-aware issues; copying collections, buckets, indexes and rules across sessions. Export defaults are lossless (Decimal128 at full precision, ISO dates with milliseconds and zone; in XLSX, Int64 / Decimal128 values a double can't hold are written as text); import strips commas only in valid thousands grouping (`1,5` is an error, not 15), "stop on error" still writes the rows read before the bad one, and a stopped or failed import reports the server-confirmed counts plus the error-report and backup file locations | | 22 states, feedback and confirmations | Connecting / connection-failed placeholder cards (see section 2), empty / no results / long-running query (killOp), read-only banner, undo toast, delete confirmation by typed name, edit-conflict dialog | Interactions the boards do not draw but daily use depends on (following Navicat's habits): @@ -157,8 +157,14 @@ Interactions the boards do not draw but daily use depends on (following Navicat' - **Undo**: pre-images are kept before committing; the toast's "Undo (10)" rolls back with them. - **Read-only**: every write path calls `EnsureWritable(db)` first; in read-only mode it shows a notice with "Unlock writes" (which asks for confirmation on production). Real read-only belongs in server-side privileges; this layer stops the classic accident of bulk-editing in a tab you thought was a test database. + "Unlock writes" lasts 15 minutes and its timer belongs to the connection — closing the tab that unlocked it still relocks on time. +- **`runCommand` in the query editor** recognizes read-only commands by an **allowlist** (`find`, `aggregate` without `$out` / `$merge`, the `*Stats` / + `list*` / `hello` family …); everything else counts as a write. `dropDatabase` / `drop` / `dropIndexes` sent through `runCommand` go through the same + confirmation and disable switch as the matching shell methods, and database-level `db.aggregate` is checked for `$out` / `$merge` too. + `.readPref()` / `.readConcern()` report "not supported" instead of being silently ignored. - **Destructive actions** always use a red outline button and state the consequence; on production (or when what is deleted holds data) the name must be typed; - `dropDatabase` can be disabled altogether. + `dropDatabase` can be disabled altogether. Emptying a collection (`deleteMany({})`) follows the same rule as dropping it: typing the name is required when it holds data. +- **Rows per page** are capped at 10,000 (skip can still go to 1,000,000): beyond that, column statistics and rendering freeze the UI. ## 5. Colour: the board palette mapped to host tokens @@ -173,6 +179,8 @@ The plugin hands the password of each MongoDB connection to the host's encrypted without the password. The plugin still cannot read the host's session store: the SSH jump host is opened by asking the host for a saved connection by id, and not one byte of the jump host's credentials passes through the plugin. The "target connection" of a data transfer is **another connection this plugin currently has open**, or a connection string the user types in (which the user hands over themselves). +Query history is redacted before it is stored: values of `pwd` / `password` / `passwordDigest`, the password arguments of `changeUserPassword` / `db.auth` and +passwords inside connection strings are masked, and each entry is truncated to 8 KB. ## 7. Testing diff --git "a/zh/host/MongoDB\345\267\245\344\275\234\345\217\260\346\217\222\344\273\266\350\256\276\350\256\241.md" "b/zh/host/MongoDB\345\267\245\344\275\234\345\217\260\346\217\222\344\273\266\350\256\276\350\256\241.md" index 95fe96f..aac1941 100644 --- "a/zh/host/MongoDB\345\267\245\344\275\234\345\217\260\346\217\222\344\273\266\350\256\276\350\256\241.md" +++ "b/zh/host/MongoDB\345\267\245\344\275\234\345\217\260\346\217\222\344\273\266\350\256\276\350\256\241.md" @@ -42,16 +42,16 @@ | --- | --- | | 入口 | 命令面板里的「MongoDB: 打开 MongoDB 工作台」;面板已开着就把它带到眼前。工具栏最左「连接」与对象树表头「+」新建连接;对象树里双击连接行连上,右键里有连接 / 断开 / 编辑 / 复制 / 删除 | | 已保存的连接 | 插件存储(`IPluginStorage`,键 `connections`);设置按 `MongoSettings` 的字符串键存,与解析是同一份。对象树根上列全部连接(灰点没连、绿点连着、红点没连上),分了组的挂在可收起的组名节下;常用的(最近连过的)在上面 | -| 口令 | 宿主的加密密钥库(`ISecretsApi`,按连接 id);不写进连接串、不写进插件存储。编辑时口令框留空表示不改;改成匿名就删掉存着的 | +| 口令 | 宿主的加密密钥库(`ISecretsApi`,按连接 id);不写进连接串、不写进插件存储。编辑时口令框留空表示不改;改成匿名就删掉存着的。连接字符串形态里写进 URI 的用户名 / 口令在保存时拆出来:用户名回填用户名栏,口令进密钥库,插件存储里只留去掉凭据的串(旧连接下次保存时迁移) | | 几条连接同时开着 | 每条连着的连接一个会话对象,标签页拿到的就是它 —— 同名集合在两条连接里是两个标签;工具栏、只读开关、服务器徽章与状态条跟着活动标签所在的那条连接走 | -| SSH 跳板 | 选宿主里已保存的一条 SSH 连接(`ISessionsApi.ListSavedAsync`)。连的时候请宿主打开它(`OpenAsync`,理由原样给用户看),在本机回环上起一个转发端口,驱动每开一条连接就经 `IRemoteTunnelApi.OpenTcpAsync` 在跳板机上开一条流对接。几条连接走同一台跳板时共用一条会话,最后一个走了才关,而且只关本插件开的那条(用户自己开着的终端会话宿主不让关)。插件碰不到跳板机的凭据 | +| SSH 跳板 | 选宿主里已保存的一条 SSH 连接(`ISessionsApi.ListSavedAsync`)。连的时候请宿主打开它(`OpenAsync`,理由原样给用户看),在本机回环上起一个转发端口,驱动每开一条连接就经 `IRemoteTunnelApi.OpenTcpAsync` 在跳板机上开一条流对接。几条连接走同一台跳板时共用一条会话,最后一个走了才关,而且只关本插件开的那条(用户自己开着的终端会话宿主不让关)。插件碰不到跳板机的凭据。主机列表与连接字符串两种形态都能走跳板(连接字符串按原串解析,只把服务器换成本地端点);`mongodb+srv://` 串与 SRV 形态一样不能走跳板,直接报错,而不是绕过跳板直连。共用的会话断了(跳板重启、网络抖动),下一次开流发现会话已不在就重开一次再试;两条连接同时去开同一台跳板时,后到者多开的那条会话随即关掉。经跳板的 TLS:驱动连的是 127.0.0.1,证书主机名改按真实目标主机核对(SAN / CN),其余证书错误照常报 | | 证书信任 | 自签证书连不上时,失败卡片列出证书(主题、签发者、到期、SHA-1)并给「信任此证书并重连」,只记这一张的指纹 | | 设计稿 10 | 落点 | | --- | --- | | 连接名 / 分组 / 环境标记 | 「基本」一行;分组可选已有的也可新写;环境标记是三颗带语气色圆点的小标签,选成生产时(安全策略没被手动改过)只读与写前确认随之打开 | | 主机列表 / SRV 记录 / 连接字符串 URI | 分段按钮;主机列表一行一台(第一台就是连接的主机),「+ 添加主机」;SRV 一栏域名、默认开 TLS;连接字符串一栏整串 | -| 副本集名、默认库、readPreference | 三等分一行(连接字符串形态不显示,以串为准) | +| 副本集名、默认库、readPreference | 三等分一行(连接字符串形态不显示,以串为准:串里写了 readPreference、appName、超时、压缩的,只有「高级」里明确设过的项才覆盖它) | | 认证机制 / authSource / 用户名 / 密码 | 机制默认协商 SCRAM-SHA-256,另有 SCRAM-SHA-1、X.509、PLAIN/LDAP;口令框旁「钥匙串」表示存在宿主密钥库 | | 「安全通道」:SSH 跳板 / TLS 两张卡片 | 跳板卡片的开关在一条已保存的 SSH 连接都没有、或选了 SRV 时禁用并写明原因(已开着的仍能关);TLS 打开后给 CA 与客户端证书两栏 | | 右栏:连接字符串 | 纯字符串拼出脱敏连接串(口令永远是 `****`),按片段角色着色,可复制;连接字符串形态填了一半时原样脱敏摆出来 | @@ -77,17 +77,17 @@ | 画板 | 实现 | | --- | --- | -| 01 网格 · 02 JSON 视图 · 13 树视图 | 集合工作台:类型化列头、BSON 着色、内联编辑、检查器(字段 / JSON / 集合信息,逐字段类型下拉)、暂存区与分页;树视图右键菜单;JSON 卡片内联编辑与值分布建议 | -| 03 查询编辑器 · 14 执行计划 | Navicat 式两行工具行(下行是「连接 ▾ 数据库 ▾」+ 运行,决定语句在哪跑)、mongosh 子集的解析与执行、上下文补全(含上游 `$group` 输出字段)、诊断与一键修复、code lens、多结果页;执行计划线性化成阶段流,候选计划、ESR 建议、hint 对比 | +| 01 网格 · 02 JSON 视图 · 13 树视图 | 集合工作台:类型化列头、BSON 着色、内联编辑(宽表只实现视口内的列)、检查器(字段 / JSON / 集合信息,逐字段类型下拉)、暂存区与分页;树视图右键菜单;JSON 卡片内联编辑与值分布建议 | +| 03 查询编辑器 · 14 执行计划 | Navicat 式两行工具行(下行是「连接 ▾ 数据库 ▾」+ 运行,决定语句在哪跑)、mongosh 子集的解析与执行、上下文补全(含上游 `$group` 输出字段)、诊断与一键修复、code lens、多结果页;执行计划线性化成阶段流,候选计划、ESR 建议、hint 对比。服务器把阶段下推到 SBE 引擎时(`explainVersion: "2"`,7.0 起 `$group` 等很常见)按 `winningPlan.queryPlan` 建阶段流,总数取执行统计的顶层,逐阶段数字尽力按 `planNodeId` 对回 —— `executionStages` 里那棵是 SBE 的槽位树,阶段名不是 `IXSCAN` 一类 | | 04 聚合管道 | 阶段卡片(启停、拖动重排、逐阶段输出预览)、文本模式双向同步、导出为五种语言代码、创建视图、`$out`/`$merge` | | 05 文档编辑器 | 表单 / JSON / 对比三模式,最小 `$set`/`$unset`,客户端 `$jsonSchema` 预检,乐观并发冲突后"基于最新版本重做" | -| 06 GridFS | 虚拟目录、同名多版本(恢复、下载;旧版本可单独删、勾选几个一起删或「只保留最新版本」,最新那份不在其列)、流式上传下载、拖放或点拖放区选文件 / 文件夹、孤儿块检查、metadata 编辑 | -| 07 索引 · 07b 新建索引 · 08 Schema · 16 验证规则 | `$indexStats` 使用量与构建进度、按 `system.profile` 慢查询给 ESR 建议、整宽的新建索引编辑器(见下);`$sample` 抽样分析与生成 `$jsonSchema`;规则预检(服务器端 `$nor`)、试写文档、历史版本 | +| 06 GridFS | 虚拟目录、同名多版本(恢复、下载;旧版本可单独删、勾选几个一起删或「只保留最新版本」,最新那份不在其列)、流式上传下载、拖放或点拖放区选文件 / 文件夹、孤儿块检查、metadata 编辑。下载到文件夹时先写 `.part` 再改名,同名文件(已存在的、或批次里来自不同虚拟目录的)加序号,不覆盖 | +| 07 索引 · 07b 新建索引 · 08 Schema · 16 验证规则 | `$indexStats` 使用量与构建进度、按 `system.profile` 慢查询给 ESR 建议、整宽的新建索引编辑器(见下);`$sample` 抽样分析与生成 `$jsonSchema`;规则预检(服务器端 `$nor`)、试写文档、历史版本。索引建议从不建议删 `_id`、TTL、唯一索引与分片键的支撑索引,排序规则不同的不算冗余;应用验证规则时确认框写「抽样 1,000 份中 N 份不符合」,后果按 level / action 区分,预检没跑完不让应用 | | 10 新建连接 | 见第二节(插件自己的对话框) | -| 11 服务器监控 · 15 慢查询 | `serverStatus` / `replSetGetStatus` 差分采样、堆叠柱图、成员卡、存储 Top、推断事件;`$currentOp` + killOp、profiler 级别、按查询形状聚合慢查询 | +| 11 服务器监控 · 15 慢查询 | `serverStatus` / `replSetGetStatus` 差分采样、堆叠柱图、成员卡、存储 Top、推断事件;`$currentOp` + killOp、profiler 级别、按查询形状聚合慢查询。标签页隐藏期间不采样,恢复后第一次只建基线不出率值,没采到样的时段画成空位而不是 0;存储 Top、profiler 级别、慢查询检查等低频项在后台单独跑,不拖采样间隔。慢查询页轮询失败时顶部横条报错、当前操作列表清空(免得对着过期的 opid killOp) | | 12 对象列表 · 17 新建集合 | Navicat 对象页(统计、DDL、权限);五种集合形态与实时命令预览 | -| 18 用户与角色 | 内置角色矩阵、自定义角色、登录限制、有效权限预览,保存走增量 grant / revoke | -| 19 导出 · 20 导入 · 21 数据传输 | JSON / CSV / XLSX / BSON 转储(mongodump 兼容)/ Shell 脚本;导入 dry-run 按 validator 归纳问题;跨会话复制集合、桶、索引与规则 | +| 18 用户与角色 | 内置角色矩阵、自定义角色、登录限制、有效权限预览,保存走增量 grant / revoke。新建用户口令要输两遍;改的是当前连接自己的口令时额外确认,成功后同步更新密钥库里存的那份 | +| 19 导出 · 20 导入 · 21 数据传输 | JSON / CSV / XLSX / BSON 转储(mongodump 兼容)/ Shell 脚本;导入 dry-run 按 validator 归纳问题;跨会话复制集合、桶、索引与规则。导出默认无损(Decimal128 全精度,日期 ISO 带毫秒与时区;XLSX 里 double 装不下的 Int64 / Decimal128 写成文本);导入只在合法的千分位上剥逗号(`1,5` 报错而不是变成 15),「遇错停止」时错误行之前已读入的行照常写入,中途停止或出错也给出服务器确认过的计数、错误报告与备份文件位置 | | 22 状态、反馈与确认 | 连接中 / 连接失败的占位卡片(见第二节)、空态 / 无结果 / 长查询(killOp)、只读横幅、撤销提示、删除确认(手打名称)、编辑冲突对话框 | 设计稿没画、但用起来离不开的几条交互(照 Navicat 的习惯): @@ -139,7 +139,13 @@ - **撤销**:提交前保存原像,提示里的「撤销 (10)」用原像回滚。 - **只读**:每一条写路径先调 `EnsureWritable(db)`;只读时弹提示并给「解锁写入」(生产连接要确认)。 真正的只读应落在服务器端权限上;这一层拦的是"在一个以为是测试库的标签页里批量改了数据"那类事故。 + 「解锁写入」限时 15 分钟,计时挂在连接上 —— 关掉发起解锁的那个标签也会按时锁回。 +- **查询编辑器的 `runCommand`** 按**白名单**认只读命令(`find`、不带 `$out` / `$merge` 的 `aggregate`、各类 `*Stats` / `list*` / `hello` …), + 名单外一律当写;`runCommand` 发出的 `dropDatabase` / `drop` / `dropIndexes` 与对应的 shell 方法走同一道确认与禁用开关, + 库级 `db.aggregate` 同样检查 `$out` / `$merge`。`.readPref()` / `.readConcern()` 明确报不支持,而不是悄悄忽略。 - **危险操作**一律红色描边按钮 + 明确后果;生产连接(或删除的东西里有数据)要手打名称;`dropDatabase` 可整体禁用。 + 清空集合(`deleteMany({})`)与删除同一口径:有数据就要手打名称。 +- **每页行数**上限 10,000(跳过数仍可到 1,000,000):再大,列统计与渲染会把界面卡住。 ## 五、配色:设计稿色板 → 宿主令牌 @@ -153,6 +159,7 @@ infoDim` 在宿主里没有对应令牌,插件按宿主的派生规则(种子色 MongoDB 连接的口令由插件交给宿主的加密密钥库保管(`ISecretsApi`),插件存储里只有不含口令的设置。 插件仍然读不到宿主的会话库:SSH 跳板只按已保存连接的 id 请宿主打开,跳板机的凭据一个字节都不经过插件。 数据传输的"目标连接"是**本插件此刻开着的另一条连接**,或用户手填的一条连接串(那是用户主动交出来的)。 +查询历史落盘前脱敏:`pwd` / `password` / `passwordDigest` 的值、`changeUserPassword` / `db.auth` 的口令参数与连接串里的口令打码,单条截到 8 KB。 ## 七、测试