dsh-extra-paths 0.2.0 → 0.3.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.
Files changed (52) hide show
  1. package/README.md +192 -28
  2. package/README.zh.md +166 -21
  3. package/lib/argv.js +96 -24
  4. package/lib/argv.js.map +1 -1
  5. package/lib/client.js +1310 -450
  6. package/lib/config.js +140 -44
  7. package/lib/config.js.map +1 -1
  8. package/lib/context.js +48 -12
  9. package/lib/context.js.map +1 -1
  10. package/lib/denial.js +132 -0
  11. package/lib/denial.js.map +1 -0
  12. package/lib/index.js +40 -5
  13. package/lib/index.js.map +1 -1
  14. package/lib/name-rule.js +217 -0
  15. package/lib/name-rule.js.map +1 -0
  16. package/lib/paths.js +155 -27
  17. package/lib/paths.js.map +1 -1
  18. package/lib/pattern.js +128 -62
  19. package/lib/pattern.js.map +1 -1
  20. package/lib/platform.js +325 -0
  21. package/lib/platform.js.map +1 -0
  22. package/lib/preview.js +47 -20
  23. package/lib/preview.js.map +1 -1
  24. package/lib/resolve.js +345 -64
  25. package/lib/resolve.js.map +1 -1
  26. package/lib/schema.js +19 -6
  27. package/lib/schema.js.map +1 -1
  28. package/lib/shell-dialect.js +92 -0
  29. package/lib/shell-dialect.js.map +1 -0
  30. package/lib/tool-guard.js +214 -0
  31. package/lib/tool-guard.js.map +1 -0
  32. package/lib/types/argv.d.ts +50 -12
  33. package/lib/types/config.d.ts +29 -13
  34. package/lib/types/context.d.ts +6 -1
  35. package/lib/types/denial.d.ts +88 -0
  36. package/lib/types/index.d.ts +8 -4
  37. package/lib/types/name-rule.d.ts +112 -0
  38. package/lib/types/paths.d.ts +55 -10
  39. package/lib/types/pattern.d.ts +43 -5
  40. package/lib/types/platform.d.ts +148 -0
  41. package/lib/types/preview.d.ts +39 -3
  42. package/lib/types/resolve.d.ts +129 -23
  43. package/lib/types/schema.d.ts +24 -8
  44. package/lib/types/shell-dialect.d.ts +60 -0
  45. package/lib/types/tool-guard.d.ts +103 -0
  46. package/lib/types/wrap-fs.d.ts +86 -4
  47. package/lib/types/wrap-sandbox.d.ts +26 -6
  48. package/lib/wrap-fs.js +323 -47
  49. package/lib/wrap-fs.js.map +1 -1
  50. package/lib/wrap-sandbox.js +149 -12
  51. package/lib/wrap-sandbox.js.map +1 -1
  52. package/package.json +3 -1
@@ -1,8 +1,18 @@
1
1
  /**
2
2
  * The subprocess half of the plugin: a transparent Proxy over `ctx.sandbox`
3
- * that appends one write grant per configured root to the argv the base
4
- * provider already wrapped. An unrecognised runner dialect fails closed: the
5
- * argv is returned untouched (the write stays denied) and a warning is logged.
3
+ * that appends the configured shell-surface rules to the argv the base provider
4
+ * already wrapped — write grants AND the deny/read-only restrictions the runner
5
+ * dialect can express (see {@link widenArgv}).
6
+ *
7
+ * A sandbox profile can only name CONCRETE paths, so a BARE NAME rule
8
+ * (`.git`, `.env`, `node_modules`) is deliberately NOT enforced here: expanding
9
+ * a name into "the paths it currently matches" means walking the workspace plus
10
+ * every writable root before commands — costly, stale by up to the cache TTL,
11
+ * and silently partial when one root is deep or unreadable (the real host hit
12
+ * exactly that). Name rules therefore protect the fs tools only, where the
13
+ * match is lexical, exact and live on every call. A configured `shell` surface
14
+ * on a name rule gets an explicit one-time notice (see
15
+ * {@link warnNameRulesAreFsOnly}) instead of a stale or partial mask set.
6
16
  *
7
17
  * THE WRAPPER MIRRORS THE INNER PROVIDER'S SYNC-NESS, because that changed
8
18
  * between host generations and both must work:
@@ -19,13 +29,31 @@
19
29
  * widened in a continuation instead of being forced through `async` — the same
20
30
  * code satisfies a caller that awaits and one that does not.
21
31
  *
22
- * A dialect the wrapper does not recognise (`windows-acl`, a remote
23
- * `sandbox-ssh` runner) also fails closed, as does an unknown one.
32
+ * Every confinement also records the OBSERVED runner dialect (shell-dialect.ts),
33
+ * which drives the settings page's capability badges. A dialect that cannot
34
+ * express the rules must never be silently mis-claimed:
35
+ * - `danger-full-access` has no runner to inject into, so the record is returned
36
+ * untouched (the fs half still enforces the hard rules);
37
+ * - `landlock` can grant but cannot subtract, and `windows-acl` can do neither:
38
+ * both warn ONCE per dialect + rule signature and the command still runs.
39
+ * Warning only once is the fix for a real log-flood: a denied rule sits in the
40
+ * configuration and every single command would otherwise re-report it.
24
41
  * @module dsh-extra-paths/wrap-sandbox
25
42
  */
26
43
  import { widenArgv } from './argv.js';
27
44
  import { grantFor } from './grant.js';
28
45
  import { resolveRoots } from './resolve.js';
46
+ import { recordShellDialect } from './shell-dialect.js';
47
+ /**
48
+ * Capability warnings already logged, keyed by dialect + rule signature. Module
49
+ * scope on purpose: the host may re-read `ctx.sandbox` per call, so a per-wrapper
50
+ * set would warn again on every command — the exact log flood this prevents.
51
+ */
52
+ const warnedCapabilities = new Set();
53
+ /** Test-only: forget the capability warnings that have been logged. */
54
+ export function resetShellWarnings() {
55
+ warnedCapabilities.clear();
56
+ }
29
57
  /** Whether a provider answered with a thenable instead of the record itself. */
30
58
  function isThenable(value) {
31
59
  return typeof value.then === 'function';
@@ -42,25 +70,134 @@ function isThenable(value) {
42
70
  export function isConfiningSandbox(value) {
43
71
  return typeof value?.confine === 'function';
44
72
  }
73
+ /**
74
+ * The shell-surface rules one resolved report contributes: the literal roots
75
+ * plus every concrete path a name rule currently matches.
76
+ *
77
+ * The name matches follow the SAME access rules as literal entries — `deny`
78
+ * restricts both directions, `read` only writes, and the grant gate mirrors
79
+ * `grantFor` (`write` needs `workspace-write`, `always-write` survives
80
+ * `read-only`). Paths are deduplicated because a literal entry and a name rule
81
+ * can name the same root, and a duplicate `--mask`/`--bind` is pointless argv
82
+ * noise (bwrap keeps the LAST mount, so a duplicate grant after a denial could
83
+ * even re-widen it).
84
+ * @param report - the report resolved WITH `expandNameRules`.
85
+ * @param mode - the resolved per-call mode (never `danger-full-access` here).
86
+ * @returns the deduplicated rule set to append, in report order.
87
+ */
88
+ function shellRulesOf(report, mode) {
89
+ return {
90
+ grants: grantFor(mode, report.roots, 'shell').map(root => root.root),
91
+ readOnly: report.readOnly.filter(rule => rule.surfaces.includes('shell')).map(rule => rule.root),
92
+ denied: report.denied.filter(rule => rule.surfaces.includes('shell')).map(rule => rule.root),
93
+ };
94
+ }
95
+ /** A stable identity for one rule set, so identical rules warn only once. */
96
+ function signatureOf(rules) {
97
+ return JSON.stringify([rules.grants, rules.readOnly, rules.denied]);
98
+ }
99
+ /** The list of shell effects a dialect refused to express, in user terms. */
100
+ function lossesOf(dialect, rules) {
101
+ if (dialect === 'windows-acl')
102
+ return 'grant or deny extra paths';
103
+ const losses = [];
104
+ if (rules.denied.length > 0)
105
+ losses.push('deny shell reads or writes');
106
+ if (rules.readOnly.length > 0)
107
+ losses.push('keep shell writes out of read-only paths');
108
+ return losses.length > 0 ? losses.join(' or ') : 'express the configured restrictions';
109
+ }
110
+ /**
111
+ * The honest warning for a dialect that could not express part of the rules.
112
+ * @param dialect - the runner dialect that fell short.
113
+ * @param rules - the rules it was asked to append.
114
+ * @returns one user-facing line.
115
+ */
116
+ function unsupportedWarning(dialect, rules) {
117
+ if (dialect === 'windows-acl') {
118
+ return 'extra-paths: the windows-acl shell runner cannot grant or deny extra paths '
119
+ + '(it rejects arguments it does not know), so extra paths are NOT granted and the configured '
120
+ + 'restrictions are NOT enforced for shell commands; they still protect the fs tools';
121
+ }
122
+ return `extra-paths: the ${dialect} shell runner is an allow-list and cannot ${lossesOf(dialect, rules)}; `
123
+ + 'the configured restrictions only protect the fs tools for this host, not shell commands';
124
+ }
125
+ /**
126
+ * The fail-closed warning for an unrecognised runner shape.
127
+ * @param runner - the argv[0] the provider returned.
128
+ * @returns one user-facing line.
129
+ */
130
+ function unrecognisedWarning(runner) {
131
+ return `extra-paths: unrecognised sandbox runner dialect (${JSON.stringify(runner)}); `
132
+ + 'extra paths are NOT granted and configured restrictions are NOT enforced for this command';
133
+ }
134
+ /** Log one capability warning unless the same dialect+signature already logged it. */
135
+ function warnOnce(key, message, warn) {
136
+ if (warnedCapabilities.has(key))
137
+ return;
138
+ warnedCapabilities.add(key);
139
+ warn(message);
140
+ }
141
+ /**
142
+ * Tell the user ONCE that bare-name rules do not reach the shell.
143
+ *
144
+ * A user who writes `.git | deny | fs+shell` reasonably expects bash to be
145
+ * restricted too. It is not: the shell surface would need a concrete path list,
146
+ * and enumerating one per command was abandoned (cost + partial coverage). The
147
+ * notice is the honest replacement — silently ignoring the `shell` surface
148
+ * would leave a security expectation unmet with no trace.
149
+ * @param report - the un-expanded report (name rules only, no walk).
150
+ * @param warn - the plugin's warning sink.
151
+ */
152
+ function warnNameRulesAreFsOnly(report, warn) {
153
+ const shellNames = report.nameRules
154
+ .filter(rule => rule.surfaces.includes('shell'))
155
+ .map(rule => JSON.stringify(rule.raw));
156
+ if (shellNames.length === 0)
157
+ return;
158
+ warnOnce(`name-rule-fs-only\u0000${shellNames.join(',')}`, `extra-paths: name rule(s) ${shellNames.join(', ')} restrict the fs tools only; `
159
+ + 'the shell surface does not enumerate bare names, so bash is NOT restricted by them — '
160
+ + 'use a concrete path or a * pattern if the shell must be covered too', warn);
161
+ }
45
162
  /**
46
163
  * Wrap one sandbox provider.
47
164
  * @param inner - the provider read from the context.
48
165
  * @param deps - configuration source and warning sink.
49
- * @returns a transparent proxy that widens profiles for configured roots.
166
+ * @returns a transparent proxy that widens profiles for configured roots and
167
+ * appends the shell-surface restrictions the runner can express.
50
168
  */
51
169
  export function wrapSandbox(inner, deps) {
52
170
  const bound = new Map();
53
171
  const widen = (confined, wrappedLength, policy) => {
54
- const granted = grantFor(policy.mode, resolveRoots(deps.readConfig(), policy.workspaceRoot).roots, 'shell');
55
- if (granted.length === 0)
172
+ // Observation happens for EVERY confinement, before any early return, so the
173
+ // settings page's capability matrix reflects the real runner even when this
174
+ // call grants nothing.
175
+ recordShellDialect(confined.argv);
176
+ // No runner layer exists under danger-full-access: the hard rules are the fs
177
+ // half's job (deny/read-only still apply there), and there is no argv to edit.
178
+ if (policy.mode === 'danger-full-access')
56
179
  return confined;
57
- const widened = widenArgv(confined.argv, wrappedLength, granted.map(root => root.root));
180
+ // ONE resolution per confinement and NO directory walk: bare-name rules are
181
+ // not expanded for the shell at all (see the module comment).
182
+ const report = resolveRoots(deps.readConfig(), policy.workspaceRoot);
183
+ warnNameRulesAreFsOnly(report, deps.warn);
184
+ const rules = shellRulesOf(report, policy.mode);
185
+ if (rules.grants.length === 0 && rules.readOnly.length === 0 && rules.denied.length === 0)
186
+ return confined;
187
+ const signature = signatureOf(rules);
188
+ const widened = widenArgv(confined.argv, wrappedLength, rules);
58
189
  if (widened === undefined) {
59
- deps.warn(`extra-paths: unrecognised sandbox runner dialect (${JSON.stringify(confined.argv[0])}); `
60
- + 'extra paths are NOT granted for this command');
190
+ warnOnce(`unrecognised\u0000${confined.argv[0] ?? ''}\u0000${signature}`, unrecognisedWarning(confined.argv[0] ?? ''), deps.warn);
61
191
  return confined;
62
192
  }
63
- return { ...confined, argv: widened };
193
+ if (widened.unsupported !== undefined) {
194
+ warnOnce(`${widened.unsupported}\u0000${signature}`, unsupportedWarning(widened.unsupported, rules), deps.warn);
195
+ }
196
+ // Identity is significant to the pinned sync-mirroring tests: an untouched
197
+ // record must come back as the SAME object.
198
+ if (widened.argv === confined.argv)
199
+ return confined;
200
+ return { ...confined, argv: widened.argv };
64
201
  };
65
202
  // Deliberately NOT `async` (see the module comment): the caller reads `.argv`
66
203
  // synchronously off this call's result.
@@ -1 +1 @@
1
- {"version":3,"file":"wrap-sandbox.js","sourceRoot":"","sources":["../src/wrap-sandbox.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAErC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAyB3C,gFAAgF;AAChF,SAAS,UAAU,CAAC,KAAmD;IACrE,OAAO,OAAQ,KAA8B,CAAC,IAAI,KAAK,UAAU,CAAA;AACnE,CAAC;AAED;;;;;;;;GAQ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CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;QAC5F,OAAO,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC7C,CAAC,CAAA;IAED,OAAO,IAAI,KAAK,CAAC,KAAK,EAAE;QACtB,GAAG,CAAC,MAAM,EAAE,IAAI;YACd,IAAI,IAAI,KAAK,SAAS;gBAAE,OAAO,OAAO,CAAA;YACtC,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAA;YAC/C,IAAI,OAAO,KAAK,KAAK,UAAU,IAAI,IAAI,KAAK,aAAa;gBAAE,OAAO,KAAK,CAAA;YACvE,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;YAC9B,IAAI,MAAM,KAAK,SAAS;gBAAE,OAAO,MAAM,CAAA;YACvC,MAAM,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;YAC7B,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;YACnB,OAAO,EAAE,CAAA;QACX,CAAC;KACF,CAAC,CAAA;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-extra-paths",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "配置一组额外可写根:fs 工具与受限 shell 首次尝试即可写、无需审批,带 Web 设置页与按目录结构锚定的路径模式。 · DSH plugin: configured extra writable roots for the fs tools and the sandboxed shell, with a Web settings page and structure-anchored path patterns.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -27,6 +27,7 @@
27
27
  "client": {
28
28
  "platform": "web",
29
29
  "inject": [
30
+ "@deepseek-ai/dsh-client-locale",
30
31
  "@deepseek-ai/dsh-client-ui-settings",
31
32
  "@deepseek-ai/dsh-client-ui-plugin-manager"
32
33
  ]
@@ -34,6 +35,7 @@
34
35
  },
35
36
  "scripts": {
36
37
  "paths": "node scripts/dsh-paths.mjs",
38
+ "check:sanitized": "node scripts/check-sanitized.mjs",
37
39
  "prepare": "node scripts/dsh-paths.mjs --tolerant",
38
40
  "build": "pnpm run build:host && pnpm run build:client",
39
41
  "build:host": "node scripts/dsh-paths.mjs && tsc -p tsconfig.json",