dsh-apk-vm 0.0.0-stage → 0.3.13
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/CHANGELOG.md +345 -0
- package/CODE_OF_CONDUCT.md +130 -0
- package/CONTRIBUTING.md +177 -0
- package/DEMO.md +85 -0
- package/DESIGN.md +335 -0
- package/LICENSE +204 -0
- package/NOTICE +74 -0
- package/README.md +920 -2
- package/SECURITY.md +108 -0
- package/client.js +3780 -0
- package/cordis.patch.yml +56 -0
- package/docs/PRIVACY.md +36 -0
- package/docs/README.md +16 -0
- package/docs/RELEASING.md +104 -0
- package/docs/SUBMISSION.md +75 -0
- package/docs/screenshot-panel.png +0 -0
- package/docs/screenshot-sidebar.png +0 -0
- package/icon.svg +8 -0
- package/index.js +2532 -0
- package/lib/android.js +2502 -0
- package/lib/instances.js +559 -0
- package/lib/scrcpy.js +2370 -0
- package/lib/setup.js +1624 -0
- package/lib/vendor/scrcpy-server-v5.0.1.jar +0 -0
- package/lib/video-stream.js +329 -0
- package/lib/ws.js +198 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +79 -4
- package/scripts/privacy-scan.mjs +94 -0
package/SECURITY.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported versions
|
|
4
|
+
|
|
5
|
+
| Version | Supported |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| 0.3.x (current) | Yes |
|
|
8
|
+
| < 0.3 | No |
|
|
9
|
+
|
|
10
|
+
The plugin is a local development tool. It is not designed or hardened as a multi-tenant or
|
|
11
|
+
network-exposed service.
|
|
12
|
+
|
|
13
|
+
## Reporting a vulnerability
|
|
14
|
+
|
|
15
|
+
**Please do not open a public issue for security problems.**
|
|
16
|
+
|
|
17
|
+
Preferred: use the repository's GitHub **Security** tab → **Report a vulnerability**
|
|
18
|
+
(private security advisory). Include:
|
|
19
|
+
|
|
20
|
+
- affected version and platform (OS, DSH profile, Android SDK/emulator versions);
|
|
21
|
+
- a minimal reproduction (routes/config involved, request payloads, expected vs. actual);
|
|
22
|
+
- impact assessment — what an attacker gains (guest root shell, host command execution, data
|
|
23
|
+
exposure, denial of service, …);
|
|
24
|
+
- any logs/screenshots with secrets, tokens and personal paths removed.
|
|
25
|
+
|
|
26
|
+
If you cannot use private advisories, contact the maintainers through the repository's listed
|
|
27
|
+
contact channel and ask for a private reporting route.
|
|
28
|
+
|
|
29
|
+
**Do not** test against systems you do not own, do not access other users' data, and do not
|
|
30
|
+
publish details before a fix is available. Good-faith research within these bounds is welcome.
|
|
31
|
+
|
|
32
|
+
### What to expect
|
|
33
|
+
|
|
34
|
+
This is a small open-source project maintained on a best-effort basis:
|
|
35
|
+
|
|
36
|
+
1. Acknowledgement of the report, aiming for within 7 days.
|
|
37
|
+
2. Triage and an initial impact assessment.
|
|
38
|
+
3. A private fix and a coordinated disclosure date (normally once a release with the fix is
|
|
39
|
+
available); the advisory credits the reporter unless anonymity is requested.
|
|
40
|
+
|
|
41
|
+
## Scope
|
|
42
|
+
|
|
43
|
+
In scope:
|
|
44
|
+
|
|
45
|
+
- this repository's code: [index.js](index.js), [client.js](client.js), [lib/](lib),
|
|
46
|
+
[lib/ws.js](lib/ws.js), the route surface under `/apk-vm/*`;
|
|
47
|
+
- the vendored scrcpy server JAR provenance/redistribution
|
|
48
|
+
([NOTICE](NOTICE)) — e.g. a mismatch between the shipped artifact and upstream v5.0.1;
|
|
49
|
+
- documentation that would cause a user to expose the plugin unsafely.
|
|
50
|
+
|
|
51
|
+
Out of scope (report upstream):
|
|
52
|
+
|
|
53
|
+
- **DeepSeek Harness** itself (auth, Web server, plugin runtime) — report to the DSH project;
|
|
54
|
+
- the **Android Emulator, adb and AOSP system images** — report to the Android/AOSP projects;
|
|
55
|
+
- the **scrcpy** project — report to [Genymobile/scrcpy](https://github.com/Genymobile/scrcpy)
|
|
56
|
+
(the JAR in this repository is upstream's unmodified v5.0.1 server build);
|
|
57
|
+
- **dsh-better-sidebar** — a separate community plugin.
|
|
58
|
+
|
|
59
|
+
## Threat model and known security-relevant behavior
|
|
60
|
+
|
|
61
|
+
The following behavior is intentional; it is documented here so it is not mistaken for a
|
|
62
|
+
vulnerability. Reports that rely on it being intentional will be closed as informational unless
|
|
63
|
+
they demonstrate a way to exceed the stated boundaries.
|
|
64
|
+
|
|
65
|
+
1. **A rooted, debuggable Android guest is started on the user's machine.** The image is
|
|
66
|
+
`userdebug`; `adb root` is applied after boot, `ro.debuggable=1` and `ro.adb.secure=0`. Any APK
|
|
67
|
+
installed in the VM runs inside that guest; the guest is not a security boundary against the
|
|
68
|
+
host beyond the emulator's own isolation. Do not store sensitive data in the AVD.
|
|
69
|
+
2. **`/apk-vm/debug/shell` executes arbitrary commands inside the guest** (as root), and
|
|
70
|
+
`/apk-vm/debug/action` can force-stop, clear data or uninstall packages. This is the product
|
|
71
|
+
feature. Commands run in the Android guest, not on the host.
|
|
72
|
+
3. **`/apk-vm/debug/push` and `/pull` move files** between the host and the guest, constrained to
|
|
73
|
+
`/data/local/tmp`, `/sdcard`, `/storage/emulated/0` on the guest and to allowed local roots/temp
|
|
74
|
+
on the host.
|
|
75
|
+
4. **The `apk_vm` Agent tool is registered for all agents in the DSH profile** and exposes the
|
|
76
|
+
same surface to them. Treat agent access to this plugin as equivalent to giving the agent a
|
|
77
|
+
rooted Android device (and the ability to install APKs and run guest commands).
|
|
78
|
+
5. **All routes are same-origin only, and are loopback-only by default.** The HTTP routes reject
|
|
79
|
+
cross-origin requests; additionally, every `/apk-vm/*` request and the WebSocket upgrade
|
|
80
|
+
rejects non-loopback TCP peers unless `allowRemote: true` is explicitly set. Anything that can
|
|
81
|
+
make same-origin requests to the DSH Web server — including a compromised page in the same
|
|
82
|
+
origin, a malicious browser extension, or a reverse proxy that adds authentication but
|
|
83
|
+
forwards `/apk-vm/*` — inherits this capability. **Do not expose the DSH Web port to
|
|
84
|
+
untrusted networks.** If you must, add authentication at a trusted proxy and set
|
|
85
|
+
`allowRemote: true` deliberately; keep the DSH auth token secret.
|
|
86
|
+
6. **Host commands are never built as shell strings.** `adb`, `emulator`, `sdkmanager` and
|
|
87
|
+
`avdmanager` are spawned with `argv` arrays; paths and payload sizes are validated/bounded
|
|
88
|
+
(JSON bodies ≤ 64 KiB, APK uploads ≤ 500 MiB with ZIP/APK magic validation, bounded
|
|
89
|
+
stdout/stderr, APK paths must exist and end in `.apk`, push/pull targets restricted as above).
|
|
90
|
+
Bypassing these bounds is in scope if demonstrated.
|
|
91
|
+
7. **Upload and environment setup are privileged local actions.** `/apk-vm/upload` writes the
|
|
92
|
+
uploaded APK to the OS temp directory and installs it into the guest; `/apk-vm/setup`
|
|
93
|
+
`create-avd` writes an AVD under the user's AVD home. `/apk-vm/setup` `install-image` runs
|
|
94
|
+
`sdkmanager --install` only when `allowSetupDownloads: true` is configured (default `false`),
|
|
95
|
+
because it is a large network download; it is never triggered automatically.
|
|
96
|
+
8. **The plugin does not send telemetry** or contact third-party services on its own; it talks to
|
|
97
|
+
the local adb/emulator and the same-origin DSH Web server. The only network activity comes
|
|
98
|
+
from the user's own `sdkmanager` when they explicitly run the opt-in `install-image` action.
|
|
99
|
+
|
|
100
|
+
## Hardening status
|
|
101
|
+
|
|
102
|
+
The released plugin applies same-origin and loopback checks to every `/apk-vm/*` HTTP route and
|
|
103
|
+
the `/apk-vm/ws` upgrade, bounded payloads for JSON and uploads, argument-array process spawning,
|
|
104
|
+
and a restricted push/pull path set. The multi-touch (`/touch`), clipboard (`/clipboard`) and
|
|
105
|
+
artifact-download routes are part of the same origin/loopback surface. There is no separate
|
|
106
|
+
authentication token of its own: it relies on the DSH Web server's session and on the operator
|
|
107
|
+
keeping that server local/trusted. Run this plugin only on a machine and local network you trust;
|
|
108
|
+
do not treat the rooted Android guest as a security boundary.
|