dsh-remote-rea 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +156 -2
- package/THIRD_PARTY_LICENSES/dsh-dolphin-security-MIT.txt +21 -0
- package/THIRD_PARTY_LICENSES/dsh-web-Apache-2.0.txt +202 -0
- package/THIRD_PARTY_NOTICES.md +92 -0
- package/cordis.patch.yml +7 -0
- package/index.js +273 -0
- package/package.json +58 -4
- package/rea-controller.js +492 -0
- package/rea-finding-extractor.js +254 -0
- package/rea-output-parser.js +141 -0
- package/rea-provider-router.js +482 -0
- package/rea-remote-deploy.js +176 -0
- package/rea-remote-probe.js +468 -0
- package/rea-summary.js +96 -0
- package/remote-shell-utils.js +142 -0
- package/remote-ssh-core.js +1265 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ccr-wer
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,157 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-remote-rea
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
DSH(DeepSeek Harness)生态插件:**远程连接 + 逆向分析** —— 连上远程主机,定位/拉取目标文件,
|
|
4
|
+
调用 REA(及其背后的 Ghidra / Hopper / IDA)做静态分析并回收结构化结果。
|
|
5
|
+
|
|
6
|
+
**只分析、不利用**:本插件不执行目标、不注入、不改写工件、不做任何利用动作。所有远端命令都先过
|
|
7
|
+
提权闸门(见「安全边界」)。
|
|
8
|
+
|
|
9
|
+
## 三个工具
|
|
10
|
+
|
|
11
|
+
| 工具 | 作用 | 关键入参 |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| `remote_hosts` | 主机库 CRUD:登记别名、认证方式、连通性 `test`、从 `~/.ssh/config` 导入 | `action` + `alias` … |
|
|
14
|
+
| `remote_fetch_binary` | 预检(存在 / 大小 / 类型 / sha256)→ 拉取 → 本地复算 sha 比对 → 写 JSON 报告 | `alias`、`remotePath`(绝对路径) |
|
|
15
|
+
| `remote_rea_analyze` | 拉取之后探测能力面、选 provider/operation、下发分析子命令、Evidence 落盘并出摘要 | `alias`、`remotePath`、可选 `provider` |
|
|
16
|
+
|
|
17
|
+
用之前必须先在 `remote_hosts` 里有别名 —— 主机库是这两个分析工具的前置条件,本插件不读任何外部口令。
|
|
18
|
+
|
|
19
|
+
`remote_rea_analyze` 不指定 `provider` 时自动路由,选路范围是
|
|
20
|
+
「REA 广告面 ∩ 已用 `--help` 核对过绑定的子命令」,两者取交集,缺一个就不下发。
|
|
21
|
+
|
|
22
|
+
## 支持范围
|
|
23
|
+
|
|
24
|
+
| 层面 | 支持 | 不支持时的行为 |
|
|
25
|
+
|---|---|---|
|
|
26
|
+
| 宿主 OS | Windows / macOS / Linux | 不可能不支持(`ssh2` 是纯 JS 实现,原生加速模块可选) |
|
|
27
|
+
| 宿主 Node | `>=18`(建议 20+) | 由 `package.json` 的 `engines.node` 声明;安装器告警,本插件自身不做版本检查 |
|
|
28
|
+
| 远程 OS | POSIX shell(Linux / macOS) | 运行时探测 `uname -s`,命中 `MINGW*`/`MSYS*`/`CYGWIN*`/`Windows*` 直接拒:`不支持的目标平台:Windows 远端,请使用 POSIX shell 目标` |
|
|
29
|
+
| 远程 Node | 22.19+ / 24.11+ / 26+(不支持 23 和 25) | 走 npx 前先探 `node --version`,不达标报一句话:`远端 <版本>;REA 要求 Node 22.19+ / 24.11+ / 26+(不支持 23 和 25)`,且**不下发任何 rea 命令** |
|
|
30
|
+
| 远程工具 | GNU coreutils,或可降级的子集 | 见下面「预检的降级路径」,每条都有兜底而不是直接失败 |
|
|
31
|
+
|
|
32
|
+
> 宿主 Node 的 `>=18` 是声明值,未在 18 上实测:本项目的开发/回归环境只有 Windows 侧 node 24.x
|
|
33
|
+
> 与 WSL 侧 node 22.22.1。用到的语法(ESM、可选链、空值合并、`node:` 前缀内置模块)都在 18 以内。
|
|
34
|
+
|
|
35
|
+
### 预检的降级路径
|
|
36
|
+
|
|
37
|
+
- `stat -c %s` 拿不到大小(BSD/macOS 的 `stat` 不认 `%s`)→ 退回 `wc -c <`;两条都失败 → `sizeBytes=null`。
|
|
38
|
+
- `file -b` 失败 → `fileType=null`,路由降级为「按扩展名猜类别」,note 里写明「未经格式头证实」;
|
|
39
|
+
扩展名也认不出来就报 `未知类型:file -b 没有输出、扩展名也认不出来;深度分析需指定 provider`。
|
|
40
|
+
- 远端既没有全局 `rea` 也没有 `npx` → `远端无 npx,请安装 Node.js 22.19+ 或全局安装 rea`。
|
|
41
|
+
- 符号链接:`file -b` 回的是 `symbolic link to …`,而 `stat -c %s` 给的是链接字符串长度、
|
|
42
|
+
`sha256sum`/SFTP 跟随目标 —— 所以链接目标的 `sizeMatches=null` + `sizeSkippedForSymlink=true`,**sha 才是权威**。
|
|
43
|
+
|
|
44
|
+
## 已知限制
|
|
45
|
+
|
|
46
|
+
- **Ghidra 路径已接,未实装验证。** 绑定表见 `rea-provider-router.js` 的 `GHIDRA_BINDINGS`(5 条,
|
|
47
|
+
只有 `--help` 证据、没有任何一次真机跑通),因此**不参与自动选路**,只在调用方显式
|
|
48
|
+
`provider:"ghidra"` 且 REA readiness 判它可用时才走。要实装需自备 **Ghidra 12.1.x** 解包目录并把
|
|
49
|
+
`GHIDRA_INSTALL_DIR` 指过去,外加 **JDK 21**(便携 JDK 也行,只要 PATH 上有 `java`)。
|
|
50
|
+
- **`analyze-javascript-application` 不在 capabilities 广告面**(providers / capabilities / doctor 三处都没有它),
|
|
51
|
+
作为带标记的**手工例外**接入:`surface='manual-exception'`、`marker='manual-exception:not-advertised'`。
|
|
52
|
+
它的 effects 是空的 —— 也就是「读文件还是写文件系统」REA 自己没说,本项目也不替它猜。
|
|
53
|
+
- **`rea-artifact-graph` 只做 inventory,`findings=0` 是结构性的**,不是「这个二进制很干净」:它的 Evidence
|
|
54
|
+
方言里没有 `semantic_graph`,摘要层的 `dialect` 计数会把 `unexplored_branches` / `next_probes` 原样透传,
|
|
55
|
+
深度要靠 Ghidra 那一条路。
|
|
56
|
+
- **冷缓存预热可能 50s 到 10 分钟不等**,取决于网络。实测区间 50–83s,但同一条路出现过 120s、420s,
|
|
57
|
+
以及 2026-10-17 在 WSL 上实测的 **534s**(清缓存后用默认预算跑通整链)。`npxTimeoutMs` 因此定为 600000,
|
|
58
|
+
可按调用覆盖。
|
|
59
|
+
- **`doctor` 原文不是字节稳定的**:`identity.installations.paths[0]` 会随 npx 缓存位置变化,所以本项目
|
|
60
|
+
不对 doctor 原文做逐字节断言,只按 evidence_id / 字段取用。
|
|
61
|
+
- **`@latest` 可能漂移**:`npx --yes rea-agents@latest` 每次解析到的版本可能不同。遇到缓存或行为对不上,
|
|
62
|
+
可把远端命令手动锁成 `rea-agents@<版本>`。
|
|
63
|
+
- **`pnpm peers check` 的 missing peer 是静态误报**:DSH profile 的 `pnpm-workspace.yaml` 设了
|
|
64
|
+
`autoInstallPeers: false`,pnpm 只看 profile 自己的 `package.json`,看不到上层
|
|
65
|
+
`profiles/node_modules/@deepseek-ai/`,于是报 `@deepseek-ai/dsh-tools` / `@deepseek-ai/cordis` 缺失。
|
|
66
|
+
实测:那两个 peer 由 DSH 运行时自带 —— `profiles/node_modules/@deepseek-ai/{cordis,dsh-tools}`
|
|
67
|
+
是指向全局 `@deepseek-ai/dsh` 内嵌依赖的符号链接(本机解析到 cordis 4.0.2、dsh-tools 0.1.5-rc.2)。
|
|
68
|
+
插件是从 tarball 解出来的**真实目录**,从它内部 `import.meta.resolve()` 向上走就能命中;
|
|
69
|
+
已装的 dsh-dolphin-security 报的是同一类误报。**只要实际版本落在 peer 范围内,这条警告可以忽略。**
|
|
70
|
+
|
|
71
|
+
## 跨平台说明
|
|
72
|
+
|
|
73
|
+
- 开发环境用 **WSL 做真机测试**:Windows → WSL2 的 2222 portproxy 需要管理员权限才能修,本机没修,
|
|
74
|
+
所以 Windows 侧只跑离线套件(逻辑层 + 假 engine),真机套件在 WSL 内部跑。
|
|
75
|
+
- `cpu-features` 构建失败**不影响功能**:`ssh2` 把它列为可选加速模块,装不上就退回纯 JS 实现,只是性能略降。
|
|
76
|
+
(这条是 ssh2 上游行为 + 本项目 `loadSsh2`/`isSsh2Available` 的容错设计;我们没有专门实测过构建失败的安装。)
|
|
77
|
+
- `REVERSE_HOME` 用**当前 OS 的路径风格**:Windows 上是 `D:\...`,POSIX 上是 `/...`,本项目不做路径翻译。
|
|
78
|
+
|
|
79
|
+
## 安全边界
|
|
80
|
+
|
|
81
|
+
- **只分析、不利用**:没有执行目标、注入、patch、改写工件的任何入口。
|
|
82
|
+
- **提权硬闸门**:每条远端命令下发前过 `assertNoPrivilegeEscalation`,命中 `sudo` 或
|
|
83
|
+
`--break-system-packages` 直接抛错、不下发(`remote-shell-utils.js`)。探测类命令 `attempts` 固定为 1,
|
|
84
|
+
不做重放 —— 下发前无法确认幂等。
|
|
85
|
+
- **`mutates_artifact` 的操作不会被选中**,机制要说准:REA 广告面里确实有带它的组
|
|
86
|
+
(`annotate_native_function`、`set_address_name(s)`、`set_bookmark` / `set_comment` / `set_inline_comment` /
|
|
87
|
+
`unset_bookmark`),但选路的必要条件是「该操作有已核对的 CLI 绑定」,而绑定表里一条写类操作都没有。
|
|
88
|
+
也就是说这是**靠白名单实现的,不是运行期按 effects 拦截**;`effects` 只如实透传进 `route.reason` 给你看。
|
|
89
|
+
- **口令不进工具参数**:`authKind=password` 只接受一个环境变量名 `passwordEnv`,口令本体留在宿主进程环境里 ——
|
|
90
|
+
作为参数传会进会话记录。列表/详情回的是脱敏投影(`auth.kind`),不回显口令或私钥内容。
|
|
91
|
+
|
|
92
|
+
## A 路(Ghidra 深分析)绑定表
|
|
93
|
+
|
|
94
|
+
| operation | 子命令(`--help` 原文形状) | address |
|
|
95
|
+
|---|---|---|
|
|
96
|
+
| `analyze_function` | `rea function <path> [address] [options]` | 可选 |
|
|
97
|
+
| `procedure_pseudo_code` | `rea decompile <path> [address] [options]` | 可选 |
|
|
98
|
+
| `procedure_assembly` | `rea instructions <path> [address] [options]` | 可选 |
|
|
99
|
+
| `xrefs` | `rea xrefs <path> [address] [options]` | 可选 |
|
|
100
|
+
| `read_bytes` | `rea read-bytes <path> <address> [options]` | **必填 → 只登记不下发** |
|
|
101
|
+
|
|
102
|
+
Ghidra 不可用时,错误信息用的是 REA 自己的原文(`Set GHIDRA_INSTALL_DIR to an extracted Ghidra 12.1.x
|
|
103
|
+
release directory.` + `install_dir / analyze_headless_path / java_command / java_home` 的诊断原值),
|
|
104
|
+
本项目不自己编修法。深分析 provider 的 session 是 ephemeral(导入的 Program 与临时工程在 close 时删除),
|
|
105
|
+
所以 Evidence 一解析出来就当场落盘。
|
|
106
|
+
|
|
107
|
+
## 落盘位置
|
|
108
|
+
|
|
109
|
+
数据根 = `$REVERSE_HOME`(回退 `$DSH_HOME`,再回退 `~/.reverse`):
|
|
110
|
+
|
|
111
|
+
- 报告:`<数据根>/reports/fetch-<alias>-<ts>.json`、`analyze-<alias>-<ts>.json`
|
|
112
|
+
- 拉取的目标:`<数据根>/targets/<文件名>`
|
|
113
|
+
- Evidence:按 `evidence_id` 落盘(`<数据根>/evidence/<evidence_id>.json`),路径写在报告的
|
|
114
|
+
`analysis.evidencePath`;落的是 stdout 里那一行**原始字节**,不重新格式化。
|
|
115
|
+
|
|
116
|
+
工具返回体里不放远端原始 stdout,也不放全量 Evidence(真机 5.6KB ~ 75KB),只放摘要与路径。
|
|
117
|
+
|
|
118
|
+
## 安装与挂载
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
cd <DSH home> && DSH_HOME=<DSH home> dsh plugin --profile web add dsh-remote-rea
|
|
122
|
+
cd <项目根> && DSH_HOME=<DSH home> dsh --profile web --host 127.0.0.1 --no-open
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
`ssh2` / `cpu-features` 需要构建许可:pnpm 11 的门禁会拦依赖的构建脚本
|
|
126
|
+
(`ERR_PNPM_IGNORED_BUILDS`,退出码 1),要在 profile 的 `pnpm-workspace.yaml` 里加上
|
|
127
|
+
|
|
128
|
+
```yaml
|
|
129
|
+
allowBuilds:
|
|
130
|
+
cpu-features: true
|
|
131
|
+
ssh2: true
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
装完要重启 `dsh web` 并强制刷新浏览器。桌面端(`desktop` profile)由 Electron 独占管理,
|
|
135
|
+
命令行装插件会被拒(`profile "desktop" is managed exclusively by the Electron application`),
|
|
136
|
+
入口是应用内的插件管理器。
|
|
137
|
+
|
|
138
|
+
## 测试
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
node test/run-tests.mjs # 3a 本地解析层
|
|
142
|
+
node test/run-probe-tests.mjs # 3b 远端能力面探测(--offline 只跑逻辑层)
|
|
143
|
+
node test/run-deploy-tests.mjs # 第 4 步 部署链
|
|
144
|
+
node test/run-controller-tests.mjs # 第 5 步 runFetch
|
|
145
|
+
node test/run-analyze-tests.mjs # 第 6 步 runAnalyze(--cold 额外跑破坏性冷缓存)
|
|
146
|
+
node test/run-plugin-tests.mjs # 第 7 步 插件契约 + 跨平台补丁 + A 路
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
需要真机的套件走 `--alias=<别名> --store=<主机库路径>`,别名先用 `remote_hosts` 或主机库脚本登记。
|
|
150
|
+
|
|
151
|
+
## 许可与第三方声明
|
|
152
|
+
|
|
153
|
+
本项目以 MIT 发布(`LICENSE`)。`remote-ssh-core.js` 派生自 dsh-web 的 `dsh-ssh`(Apache-2.0),
|
|
154
|
+
`remote-shell-utils.js` 派生自 dsh-dolphin-security(MIT,同作者)—— 逐函数的来源位置、修改内容与
|
|
155
|
+
许可证原文见 `THIRD_PARTY_NOTICES.md` 与 `THIRD_PARTY_LICENSES/`。
|
|
156
|
+
|
|
157
|
+
技术债与已知限制的单子在同目录 `TECH_DEBT.md`。
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Dolphin Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Third-Party Notices
|
|
2
|
+
|
|
3
|
+
`dsh-remote-rea` 包含或派生自以下开源项目。依据各自许可证的要求,其原始版权声明与
|
|
4
|
+
许可条款在此保留。完整许可证原文见 `THIRD_PARTY_LICENSES/` 目录。
|
|
5
|
+
|
|
6
|
+
本项目自身代码以 MIT 许可证发布,完整条款见同目录 `LICENSE`(标准 MIT 模板,21 行)。
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 1. dsh-web / dsh-ssh(经 dsh-dolphin-security 中转)
|
|
11
|
+
|
|
12
|
+
- **本项目文件**:`remote-ssh-core.js`
|
|
13
|
+
- **上游来源**:https://github.com/zhu1090093659/dsh-web 的 `packages/dsh-ssh/src`
|
|
14
|
+
(npm 包 `@linxin666/dsh-ssh`)
|
|
15
|
+
- **许可证**:Apache License 2.0
|
|
16
|
+
- **版权**:Copyright (c) dsh-web contributors
|
|
17
|
+
- **完整原文**:`THIRD_PARTY_LICENSES/dsh-web-Apache-2.0.txt`
|
|
18
|
+
- **派生链**:`dsh-ssh`(Apache-2.0, TypeScript 多文件)
|
|
19
|
+
→ `dsh-dolphin-security/dolphin-ssh-core.js`(MIT, 裁剪为单文件 ESM)
|
|
20
|
+
→ `dsh-remote-rea/remote-ssh-core.js`(本文件)
|
|
21
|
+
两个上游均以宽松许可证发布,本项目的再分发满足 Apache-2.0 §4 的要求。
|
|
22
|
+
- **保留的上游模块**:`engine.ts`、`engine/connection-pool.ts`、`engine/sftp.ts`、
|
|
23
|
+
`engine/cluster.ts`、`store.ts`、`protocol.ts`(类型契约以 JSDoc 形式保留)
|
|
24
|
+
- **上游适配(由 dsh-dolphin-security 完成,本项目继承)**:移除 cordis、
|
|
25
|
+
`@deepseek-ai/dsh-settings`、`@deepseek-ai/dsh-tools`、`schemastery` 等宿主专属上下文,
|
|
26
|
+
移除面向 Web 界面的 `client/` 半区(含 dsh-market 遥测心跳)、`engine/pty.ts`、
|
|
27
|
+
`engine/tunnel.ts`、`routes.ts`、`loopback.ts`;运行时唯一三方依赖为 `ssh2`(MIT)。
|
|
28
|
+
|
|
29
|
+
### 本项目相对 `dolphin-ssh-core.js` 的修改痕迹
|
|
30
|
+
|
|
31
|
+
Apache-2.0 §4(b) 要求注明修改。本项目**只做了标识符与文案的机械改名,逻辑改动为 0 行**
|
|
32
|
+
(连接池、建连参数、exec 语义、SFTP、cluster、HostStore、自检断言一律未变):
|
|
33
|
+
|
|
34
|
+
| 原标识符 | 新标识符 | 类型 | 位置 |
|
|
35
|
+
|---|---|---|---|
|
|
36
|
+
| `DOLPHIN_HOME` | `REVERSE_HOME` | 环境变量 | `resolveReverseHome()` 读取处 |
|
|
37
|
+
| `DOLPHIN_SSH2_MODULE` | `REVERSE_SSH2_MODULE` | 环境变量 | `loadSsh2()` 覆盖项与错误提示 |
|
|
38
|
+
| `resolveDolphinHome` | `resolveReverseHome` | 导出函数名 | 定义处、`storePath()` 调用处 |
|
|
39
|
+
| `dolphin-ssh-hosts.json` | `remote-ssh-hosts.json` | 主机库文件名 | `storePath()`、`HostStore` 文档注释 |
|
|
40
|
+
| `~/.dolphin` | `~/.reverse` | 数据根回退路径 | `resolveReverseHome()` 返回值、文档注释 |
|
|
41
|
+
| `dolphin-ssh-selftest-*` | `remote-ssh-selftest-*` | 自检临时文件名 | `selfTest()` |
|
|
42
|
+
| `dolphin-ssh-core.js` / `Project Dolphin` 等文案 | `remote-ssh-core.js` / 中性表述 | 注释与自检横幅 | 文件头、各节标题、`selfTest()` |
|
|
43
|
+
|
|
44
|
+
未改名的中性标识符(保持原样):`isSsh2Available`、`loadSsh2`、`expandHome`、`storePath`、
|
|
45
|
+
`sshConfigPath`、`validateAlias`、`validateHostPayload`、`normalizeAgentPath`、`HostStore`、
|
|
46
|
+
`createHostStore`、`DEFAULTS`、`buildConnectConfig`、`resolveAgentPath`、`connectClient`、
|
|
47
|
+
`appendOutput`、`connectChain`、`acquire`、`disposeRecord`、`endRecordChain`、`sweepPool`、
|
|
48
|
+
`withClient`、`execCommand`、`walkLocalDir`、`upload`、`download`、`ls`、`cluster`、
|
|
49
|
+
`SshEngine`、`createSshEngine`。
|
|
50
|
+
|
|
51
|
+
数据根解析优先级 `$REVERSE_HOME > $DSH_HOME > ~/.reverse` 中的 `DSH_HOME` 是 DSH 生态的
|
|
52
|
+
统一数据根变量,非上游项目私有标识,原样保留。
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 2. dsh-dolphin-security(`remote-shell-utils.js`)
|
|
57
|
+
|
|
58
|
+
- **本项目文件**:`remote-shell-utils.js`
|
|
59
|
+
- **上游来源**:https://github.com/ccr-wer/dsh-dolphin-security
|
|
60
|
+
- **许可证**:MIT
|
|
61
|
+
- **版权**:Copyright (c) 2026 Dolphin Contributors
|
|
62
|
+
- **完整原文**:`THIRD_PARTY_LICENSES/dsh-dolphin-security-MIT.txt`
|
|
63
|
+
- **派生自(逐函数搬运,行为零改动)**:
|
|
64
|
+
`dolphin-patrol.js:69` `shellQuote`、`dolphin-patrol.js:79` `writeJsonReport`、
|
|
65
|
+
`dolphin-patrol.js:186` `assertNoPrivilegeEscalation`、`dolphin-patrol.js:211`
|
|
66
|
+
`assessDeploymentPlan`、`dolphin-core.js:220-224` `timestamp`
|
|
67
|
+
(本项目第 2 步的搬运编号为 A12–A16,指的就是上面这五个函数。)
|
|
68
|
+
- **修改**:注释中性化(去掉 semgrep 专属的业务示例与理由文案)、超时常量参数化
|
|
69
|
+
(`PROBE_TIMEOUT` → `PROBE_TIMEOUT_MS`,调用方可覆盖)、`writeJsonReport` 的
|
|
70
|
+
`reportsDir` 改为参数传入且不在 import 期求值、`assessDeploymentPlan` 的策略名与
|
|
71
|
+
rationale 文案改写到本项目场景。新增导出 `defaultReportsDir`(本项目自写,非派生)。
|
|
72
|
+
- 两个上游(dsh-web Apache-2.0、dsh-dolphin-security MIT)均为宽松许可证;本文件与
|
|
73
|
+
`THIRD_PARTY_LICENSES/` 满足各自的归属与原文随附要求。
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## 3. ssh2
|
|
78
|
+
|
|
79
|
+
- **来源**:https://github.com/mscdex/ssh2
|
|
80
|
+
- **许可证**:MIT
|
|
81
|
+
- **用途**:底层 SSH/SFTP 协议实现(本项目唯一的运行时三方依赖,不随源码派生)
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Apache-2.0 合规说明
|
|
86
|
+
|
|
87
|
+
对于上述以 Apache License 2.0 授权的部分,本项目:
|
|
88
|
+
|
|
89
|
+
- 保留原始版权、专利、商标与归属声明(见 `THIRD_PARTY_LICENSES/` 内各文件与本文件);
|
|
90
|
+
- 在 `THIRD_PARTY_LICENSES/` 中随附完整许可证原文;
|
|
91
|
+
- 未使用上游商标,未以原作者名义背书;
|
|
92
|
+
- 对上表所列的修改已在「修改痕迹」小节中逐条记录变更内容。
|
package/cordis.patch.yml
ADDED