dsh-permission-rules 0.5.4 → 0.5.6
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 +14 -0
- package/README.es.md +7 -2
- package/README.hi.md +7 -2
- package/README.md +7 -2
- package/README.pt.md +7 -2
- package/README.zh.md +7 -2
- package/docs/rules-format.en.md +28 -1
- package/docs/rules-format.md +28 -1
- package/docs/rules-format.schema.json +32 -0
- package/lib/index.js +11 -7
- package/lib/types/runtime.d.ts +9 -5
- package/lib/types/runtime.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/runtime.ts +11 -7
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to dsh-permission-rules are recorded here, newest first.
|
|
4
4
|
|
|
5
|
+
## v0.5.6 — 2026-08-25
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- `isUnmarkedHostVersion` only matched the `0.1.0-rc` line, so hosts on the `0.1.1-rc` line passed the pre-check and wrote the first `permissionRules/decision` event unmarked — that polluted event makes the session unresumable on stricter harness builds. The gate now covers `0.1.1-rc.1`–`rc.7` as known-unmarked (verified on `0.1.1-rc.2`, where the harness still drops the `ignorable` marker); over-refusal is opt-out via `allowUnmarkedAudit: true`. Reported by [@cuohua](https://github.com/PerryLink/dsh-permission-rules/issues/11).
|
|
10
|
+
|
|
11
|
+
## v0.5.5 — 2026-08-23
|
|
12
|
+
|
|
13
|
+
### Docs
|
|
14
|
+
|
|
15
|
+
- Document the `network` match dimension in the rule-format references: `docs/rules-format.en.md` and `docs/rules-format.md` now list `network` among the allowed `match` fields, add a `network` dimension row plus a dedicated section (domains / ips / ports / schemes semantics, tool scoping, the mode/boundary cross-reference), and `docs/rules-format.schema.json` gains the `network` property so editor completion covers it. This closes the v0.5.0 gap where the implementation shipped but the vocabulary docs still listed only six `match` fields.
|
|
16
|
+
- The injected network-policy system-prompt paragraph now opens with a short role sentence (Minimal persona style), as the engineering standard requires.
|
|
17
|
+
- Refresh the five-language README Development section test count to the current `236 tests, 20 files` (was `139 tests, 9 suites`).
|
|
18
|
+
|
|
5
19
|
## v0.5.4 — 2026-08-22
|
|
6
20
|
|
|
7
21
|
### DeepSeek Harness rc.2 compatibility
|
package/README.es.md
CHANGED
|
@@ -165,7 +165,7 @@ Todos los parámetros son campos Schemastery `Config` (modificables desde cordis
|
|
|
165
165
|
|
|
166
166
|
## Known limitations
|
|
167
167
|
|
|
168
|
-
- **Marcador de auditoría en hosts previos al marcador.** `permissionRules/decision` se anexa con `ignorable: true`; los hosts cuyo `Session.append` es anterior al marcador (
|
|
168
|
+
- **Marcador de auditoría en hosts previos al marcador.** `permissionRules/decision` se anexa con `ignorable: true`; los hosts cuyo `Session.append` es anterior al marcador (las líneas `0.1.0-rc.1`–`rc.7` y `0.1.1-rc.1`–`rc.7`) lo descartan silenciosamente, por lo que el runtime desactiva la auditoría de registro con una advertencia única. Pon `allowUnmarkedAudit: true` para reactivar; repara registros ya escritos con `scripts/repair-session-logs.mjs`.
|
|
169
169
|
- **Los candidatos de ruta son heurísticos.** Solo las claves de argumento documentadas alimentan el emparejamiento de rutas, y el emparejamiento relativo al workspace es insensible a mayúsculas ASCII solo con `caseInsensitivePaths` activado.
|
|
170
170
|
- **Los globs son un subconjunto conservador.** Sin expansión de llaves — escribe dos patrones, o usa modo regex.
|
|
171
171
|
- **La guardia de backtracking de regex es estructural, no exhaustiva.** Prefiere el modo glob para archivos no confiables.
|
|
@@ -193,7 +193,7 @@ node scripts/repair-session-logs.mjs repair [--home DIR] [--dry-run]
|
|
|
193
193
|
pnpm install # node ^22.19 || >=24
|
|
194
194
|
pnpm run typecheck # tsc, src + tests
|
|
195
195
|
pnpm run lint # eslint, src + tests + scripts
|
|
196
|
-
pnpm test # vitest:
|
|
196
|
+
pnpm test # vitest: 236 tests, 20 files
|
|
197
197
|
pnpm run test:coverage # coverage gate (90/80/90/90)
|
|
198
198
|
pnpm run build # tsc declarations + tsdown bundles (lib/)
|
|
199
199
|
pnpm run pack:check # build + pack (the published artifact)
|
|
@@ -210,6 +210,11 @@ Consulta [VERIFICATION.md](VERIFICATION.md) para el registro de verificación en
|
|
|
210
210
|
|
|
211
211
|
- [@PerryLink](https://github.com/PerryLink) — creador y mantenedor: vocabulario y evaluación de reglas, runtime, vigilancia HMR, auditoría de registro de sesión, política de red + proxy, y la documentación en cinco idiomas.
|
|
212
212
|
- [@22xuan](https://github.com/22xuan) — el informe detallado sobre hosts rc.6 que descartan silenciosamente el marcador `ignorable` del evento de auditoría ([#2](https://github.com/PerryLink/dsh-permission-rules/issues/2)) y la discusión del harness upstream; la detección de capacidad de host en runtime v0.4.1 y la corrección de documentación se derivaron directamente de ese análisis.
|
|
213
|
+
- [@sjh9714](https://github.com/sjh9714) — propuso el corpus compartido de vectores de prueba de sintaxis de reglas ([#4](https://github.com/PerryLink/dsh-permission-rules/issues/4), [#5](https://github.com/PerryLink/dsh-permission-rules/issues/5)), incluido en v0.5.1 como `docs/rule-test-vectors/`, y aportó los casos límite de descomposición AST en la [discusión de diseño](https://github.com/PerryLink/dsh-permission-rules/discussions/10).
|
|
214
|
+
- [@weipeng1999](https://github.com/weipeng1999) — la propuesta de descomposición de comandos basada en AST ([#8](https://github.com/PerryLink/dsh-permission-rules/issues/8)) detrás de la discusión de diseño.
|
|
215
|
+
- [@alexchenzl](https://github.com/alexchenzl) — la solicitud de inclusión en el DSH Directory ([#7](https://github.com/PerryLink/dsh-permission-rules/issues/7)).
|
|
216
|
+
- [@zl190](https://github.com/zl190) — informó y verificó la brecha de compatibilidad del harness `0.1.0-rc.7` ([PR #9](https://github.com/PerryLink/dsh-permission-rules/pulls/9)).
|
|
217
|
+
- [@cuohua](https://github.com/cuohua) — informó de que la línea `0.1.1-rc` sigue descartando el marcador `ignorable` aunque la compuerta de versión solo cubría `0.1.0` ([#11](https://github.com/PerryLink/dsh-permission-rules/issues/11)); la compuerta ampliada surgió directamente de ese análisis.
|
|
213
218
|
|
|
214
219
|
## PerryLink DSH Plugin Family
|
|
215
220
|
|
package/README.hi.md
CHANGED
|
@@ -165,7 +165,7 @@ dsh --profile web --dump-config | grep -A4 'id: permission-rules'
|
|
|
165
165
|
|
|
166
166
|
## Known limitations
|
|
167
167
|
|
|
168
|
-
- **पूर्व-मार्कर hosts पर ऑडिट मार्कर।** `permissionRules/decision` `ignorable: true` से जोड़ा जाता है; जिन hosts का `Session.append` मार्कर से पहले का है (`0.1.0-rc.
|
|
168
|
+
- **पूर्व-मार्कर hosts पर ऑडिट मार्कर।** `permissionRules/decision` `ignorable: true` से जोड़ा जाता है; जिन hosts का `Session.append` मार्कर से पहले का है (`0.1.0-rc.1`–`rc.7` और `0.1.1-rc.1`–`rc.7` पंक्तियाँ) वे इसे चुपचाप छोड़ देते हैं, इसलिए runtime एक बार की चेतावनी से सत्र-लॉग ऑडिट अक्षम कर देता है। पुनः सक्षम के लिए `allowUnmarkedAudit: true`; पहले से लिखे लॉग `scripts/repair-session-logs.mjs` से मरम्मत करें।
|
|
169
169
|
- **पथ उम्मीदवार अनुमानी हैं।** केवल दस्तावेज़ित तर्क कुंजियाँ पथ मिलान को खिलाती हैं, और कार्यक्षेत्र-सापेक्ष मिलान केवल `caseInsensitivePaths` चालू होने पर ASCII-केस-असंवेदी है।
|
|
170
170
|
- **globs एक रूढ़िवादी उपसमुच्चय हैं।** कोई ब्रेस विस्तार नहीं — दो पैटर्न लिखें, या regex मोड उपयोग करें।
|
|
171
171
|
- **regex बैकट्रैकिंग गार्ड संरचनात्मक है, संपूर्ण नहीं।** अविश्वसनीय फ़ाइलों के लिए glob मोड पसंद करें।
|
|
@@ -193,7 +193,7 @@ node scripts/repair-session-logs.mjs repair [--home DIR] [--dry-run]
|
|
|
193
193
|
pnpm install # node ^22.19 || >=24
|
|
194
194
|
pnpm run typecheck # tsc, src + tests
|
|
195
195
|
pnpm run lint # eslint, src + tests + scripts
|
|
196
|
-
pnpm test # vitest:
|
|
196
|
+
pnpm test # vitest: 236 tests, 20 files
|
|
197
197
|
pnpm run test:coverage # coverage gate (90/80/90/90)
|
|
198
198
|
pnpm run build # tsc declarations + tsdown bundles (lib/)
|
|
199
199
|
pnpm run pack:check # build + pack (the published artifact)
|
|
@@ -210,6 +210,11 @@ node scripts/check-readme-sync.mjs # five-language README sync gate (also in C
|
|
|
210
210
|
|
|
211
211
|
- [@PerryLink](https://github.com/PerryLink) — निर्माता और अनुरक्षक: नियम शब्दावली व मूल्यांकन, runtime, HMR निगरानी, सत्र-लॉग ऑडिट, नेटवर्क नीति + प्रॉक्सी, और पाँच-भाषा दस्तावेज़।
|
|
212
212
|
- [@22xuan](https://github.com/22xuan) — rc.6 hosts द्वारा ऑडिट घटना के `ignorable` मार्कर को चुपचाप छोड़ने की विस्तृत रिपोर्ट ([#2](https://github.com/PerryLink/dsh-permission-rules/issues/2)) और अपस्ट्रीम harness चर्चा; v0.4.1 runtime host-क्षमता पहचान और दस्तावेज़ सुधार सीधे उसी विश्लेषण से निकले।
|
|
213
|
+
- [@sjh9714](https://github.com/sjh9714) — साझा नियम-सिंटैक्स टेस्ट-वेक्टर कॉर्पस प्रस्तावित किया ([#4](https://github.com/PerryLink/dsh-permission-rules/issues/4), [#5](https://github.com/PerryLink/dsh-permission-rules/issues/5)), जो v0.5.1 में `docs/rule-test-vectors/` के रूप में शामिल हुआ, और [डिज़ाइन चर्चा](https://github.com/PerryLink/dsh-permission-rules/discussions/10) में AST-विघटन के सीमा-मामले दिए।
|
|
214
|
+
- [@weipeng1999](https://github.com/weipeng1999) — AST-आधारित कमांड-विघटन फ़ीचर प्रस्ताव ([#8](https://github.com/PerryLink/dsh-permission-rules/issues/8)), जिससे डिज़ाइन चर्चा शुरू हुई।
|
|
215
|
+
- [@alexchenzl](https://github.com/alexchenzl) — DSH Directory में सूचीबद्ध करने का अनुरोध ([#7](https://github.com/PerryLink/dsh-permission-rules/issues/7))।
|
|
216
|
+
- [@zl190](https://github.com/zl190) — `0.1.0-rc.7` harness संगतता अंतर की सूचना दी और उसे सत्यापित किया ([PR #9](https://github.com/PerryLink/dsh-permission-rules/pulls/9))।
|
|
217
|
+
- [@cuohua](https://github.com/cuohua) — बताया कि संस्करण-जाँच केवल `0.1.0` को कवर करने के बावजूद `0.1.1-rc` पंक्ति अब भी `ignorable` मार्कर को चुपचाप छोड़ देती है ([#11](https://github.com/PerryLink/dsh-permission-rules/issues/11)); विस्तारित जाँच सीधे उसी विश्लेषण से बनी।
|
|
213
218
|
|
|
214
219
|
## PerryLink DSH Plugin Family
|
|
215
220
|
|
package/README.md
CHANGED
|
@@ -166,7 +166,7 @@ All tunables are Schemastery `Config` fields (changeable from cordis.yml). An id
|
|
|
166
166
|
|
|
167
167
|
## Known limitations
|
|
168
168
|
|
|
169
|
-
- **Audit marker on pre-marker hosts.** `permissionRules/decision` is appended with `ignorable: true`; hosts whose `Session.append` predates the marker (the `0.1.0-rc.
|
|
169
|
+
- **Audit marker on pre-marker hosts.** `permissionRules/decision` is appended with `ignorable: true`; hosts whose `Session.append` predates the marker (the `0.1.0-rc.1`–`rc.7` and `0.1.1-rc.1`–`rc.7` lines) silently drop it, so the runtime disables session-log audit with a one-time warning. Set `allowUnmarkedAudit: true` to opt back in; repair already-written logs with `scripts/repair-session-logs.mjs`.
|
|
170
170
|
- **Path candidates are heuristic.** Only the documented argument keys feed path matching, and workspace-relative matching is ASCII-case-insensitive only when `caseInsensitivePaths` is on.
|
|
171
171
|
- **Globs are a conservative subset.** No brace expansion — write two patterns, or use regex mode.
|
|
172
172
|
- **The regex backtracking guard is structural, not exhaustive.** Prefer glob mode for untrusted files.
|
|
@@ -194,7 +194,7 @@ node scripts/repair-session-logs.mjs repair [--home DIR] [--dry-run]
|
|
|
194
194
|
pnpm install # node ^22.19 || >=24
|
|
195
195
|
pnpm run typecheck # tsc, src + tests
|
|
196
196
|
pnpm run lint # eslint, src + tests + scripts
|
|
197
|
-
pnpm test # vitest:
|
|
197
|
+
pnpm test # vitest: 236 tests, 20 files
|
|
198
198
|
pnpm run test:coverage # coverage gate (90/80/90/90)
|
|
199
199
|
pnpm run build # tsc declarations + tsdown bundles (lib/)
|
|
200
200
|
pnpm run pack:check # build + pack (the published artifact)
|
|
@@ -211,6 +211,11 @@ See [VERIFICATION.md](VERIFICATION.md) for the headless end-to-end verification
|
|
|
211
211
|
|
|
212
212
|
- [@PerryLink](https://github.com/PerryLink) — creator and maintainer: rule vocabulary and evaluation, runtime, HMR watch, session-log audit, network policy + proxy, and the five-language docs.
|
|
213
213
|
- [@22xuan](https://github.com/22xuan) — the detailed report on rc.6 hosts silently dropping the audit event's `ignorable` marker ([#2](https://github.com/PerryLink/dsh-permission-rules/issues/2)) and the upstream harness discussion; the v0.4.1 runtime host-capability detection and the documentation correction drew directly from that analysis.
|
|
214
|
+
- [@sjh9714](https://github.com/sjh9714) — proposed the shared rule-syntax test-vector corpus ([#4](https://github.com/PerryLink/dsh-permission-rules/issues/4), [#5](https://github.com/PerryLink/dsh-permission-rules/issues/5)), shipped in v0.5.1 as `docs/rule-test-vectors/`, and supplied the AST-decomposition boundary cases on the [design discussion](https://github.com/PerryLink/dsh-permission-rules/discussions/10).
|
|
215
|
+
- [@weipeng1999](https://github.com/weipeng1999) — the AST-based command-decomposition feature proposal ([#8](https://github.com/PerryLink/dsh-permission-rules/issues/8)) behind the design discussion.
|
|
216
|
+
- [@alexchenzl](https://github.com/alexchenzl) — the DSH Directory listing request ([#7](https://github.com/PerryLink/dsh-permission-rules/issues/7)).
|
|
217
|
+
- [@zl190](https://github.com/zl190) — reported and verified the `0.1.0-rc.7` harness compatibility gap ([PR #9](https://github.com/PerryLink/dsh-permission-rules/pulls/9)).
|
|
218
|
+
- [@cuohua](https://github.com/cuohua) — reported that the `0.1.1-rc` line still drops the `ignorable` marker even though the version gate covered only `0.1.0` ([#11](https://github.com/PerryLink/dsh-permission-rules/issues/11)); the widened gate drew directly from that analysis.
|
|
214
219
|
|
|
215
220
|
## PerryLink DSH Plugin Family
|
|
216
221
|
|
package/README.pt.md
CHANGED
|
@@ -165,7 +165,7 @@ Todos os parâmetros são campos Schemastery `Config` (alteráveis pelo cordis.y
|
|
|
165
165
|
|
|
166
166
|
## Known limitations
|
|
167
167
|
|
|
168
|
-
- **Marcador de auditoria em hosts anteriores ao marcador.** `permissionRules/decision` é anexado com `ignorable: true`; hosts cujo `Session.append` é anterior ao marcador (
|
|
168
|
+
- **Marcador de auditoria em hosts anteriores ao marcador.** `permissionRules/decision` é anexado com `ignorable: true`; hosts cujo `Session.append` é anterior ao marcador (as linhas `0.1.0-rc.1`–`rc.7` e `0.1.1-rc.1`–`rc.7`) o descartam silenciosamente, então o runtime desativa a auditoria de log com um aviso único. Ponha `allowUnmarkedAudit: true` para reativar; repare logs já escritos com `scripts/repair-session-logs.mjs`.
|
|
169
169
|
- **Candidatos de caminho são heurísticos.** Somente as chaves de argumento documentadas alimentam a correspondência de caminho, e a correspondência relativa ao workspace é insensível a maiúsculas ASCII apenas com `caseInsensitivePaths` ativado.
|
|
170
170
|
- **Globs são um subconjunto conservador.** Sem expansão de chaves — escreva dois padrões, ou use o modo regex.
|
|
171
171
|
- **A guarda de backtracking de regex é estrutural, não exaustiva.** Prefira o modo glob para arquivos não confiáveis.
|
|
@@ -193,7 +193,7 @@ node scripts/repair-session-logs.mjs repair [--home DIR] [--dry-run]
|
|
|
193
193
|
pnpm install # node ^22.19 || >=24
|
|
194
194
|
pnpm run typecheck # tsc, src + tests
|
|
195
195
|
pnpm run lint # eslint, src + tests + scripts
|
|
196
|
-
pnpm test # vitest:
|
|
196
|
+
pnpm test # vitest: 236 tests, 20 files
|
|
197
197
|
pnpm run test:coverage # coverage gate (90/80/90/90)
|
|
198
198
|
pnpm run build # tsc declarations + tsdown bundles (lib/)
|
|
199
199
|
pnpm run pack:check # build + pack (the published artifact)
|
|
@@ -210,6 +210,11 @@ Consulte [VERIFICATION.md](VERIFICATION.md) para o registro de verificação end
|
|
|
210
210
|
|
|
211
211
|
- [@PerryLink](https://github.com/PerryLink) — criador e mantenedor: vocabulário e avaliação de regras, runtime, vigilância HMR, auditoria de log de sessão, política de rede + proxy, e a documentação em cinco idiomas.
|
|
212
212
|
- [@22xuan](https://github.com/22xuan) — o relatório detalhado sobre hosts rc.6 descartando silenciosamente o marcador `ignorable` do evento de auditoria ([#2](https://github.com/PerryLink/dsh-permission-rules/issues/2)) e a discussão do harness upstream; a detecção de capacidade de host em runtime v0.4.1 e a correção de documentação se derivaram diretamente dessa análise.
|
|
213
|
+
- [@sjh9714](https://github.com/sjh9714) — propôs o corpus compartilhado de vetores de teste de sintaxe de regras ([#4](https://github.com/PerryLink/dsh-permission-rules/issues/4), [#5](https://github.com/PerryLink/dsh-permission-rules/issues/5)), incluído na v0.5.1 como `docs/rule-test-vectors/`, e contribuiu com os casos-limite de decomposição AST na [discussão de design](https://github.com/PerryLink/dsh-permission-rules/discussions/10).
|
|
214
|
+
- [@weipeng1999](https://github.com/weipeng1999) — a proposta de decomposição de comandos baseada em AST ([#8](https://github.com/PerryLink/dsh-permission-rules/issues/8)) por trás da discussão de design.
|
|
215
|
+
- [@alexchenzl](https://github.com/alexchenzl) — a solicitação de inclusão no DSH Directory ([#7](https://github.com/PerryLink/dsh-permission-rules/issues/7)).
|
|
216
|
+
- [@zl190](https://github.com/zl190) — relatou e verificou a lacuna de compatibilidade do harness `0.1.0-rc.7` ([PR #9](https://github.com/PerryLink/dsh-permission-rules/pulls/9)).
|
|
217
|
+
- [@cuohua](https://github.com/cuohua) — relatou que a linha `0.1.1-rc` ainda descarta o marcador `ignorable` embora a verificação de versão cobrisse apenas `0.1.0` ([#11](https://github.com/PerryLink/dsh-permission-rules/issues/11)); a verificação ampliada veio diretamente dessa análise.
|
|
213
218
|
|
|
214
219
|
## PerryLink DSH Plugin Family
|
|
215
220
|
|
package/README.zh.md
CHANGED
|
@@ -165,7 +165,7 @@ dsh --profile web --dump-config | grep -A4 'id: permission-rules'
|
|
|
165
165
|
|
|
166
166
|
## Known limitations
|
|
167
167
|
|
|
168
|
-
- **前标记宿主上的审计标记。** `permissionRules/decision` 以 `ignorable: true` 追加;`Session.append` 早于该标记的宿主(`0.1.0-rc.
|
|
168
|
+
- **前标记宿主上的审计标记。** `permissionRules/decision` 以 `ignorable: true` 追加;`Session.append` 早于该标记的宿主(`0.1.0-rc.1`–`rc.7` 与 `0.1.1-rc.1`–`rc.7` 线)静默丢弃它,因此运行时以一次性警告禁用会话日志审计。设 `allowUnmarkedAudit: true` 重新启用;用 `scripts/repair-session-logs.mjs` 修复已写日志。
|
|
169
169
|
- **路径候选是启发式的。** 只有文档化的参数键参与路径匹配,且工作区相对匹配仅在 `caseInsensitivePaths` 开启时忽略 ASCII 大小写。
|
|
170
170
|
- **glob 是保守子集。** 无花括号展开——写两个模式,或用正则模式。
|
|
171
171
|
- **正则回溯守卫是结构性的、非穷尽的。** 对不可信文件优先用 glob 模式。
|
|
@@ -193,7 +193,7 @@ node scripts/repair-session-logs.mjs repair [--home DIR] [--dry-run]
|
|
|
193
193
|
pnpm install # node ^22.19 || >=24
|
|
194
194
|
pnpm run typecheck # tsc, src + tests
|
|
195
195
|
pnpm run lint # eslint, src + tests + scripts
|
|
196
|
-
pnpm test # vitest:
|
|
196
|
+
pnpm test # vitest: 236 tests, 20 files
|
|
197
197
|
pnpm run test:coverage # coverage gate (90/80/90/90)
|
|
198
198
|
pnpm run build # tsc declarations + tsdown bundles (lib/)
|
|
199
199
|
pnpm run pack:check # build + pack (the published artifact)
|
|
@@ -210,6 +210,11 @@ node scripts/check-readme-sync.mjs # five-language README sync gate (also in C
|
|
|
210
210
|
|
|
211
211
|
- [@PerryLink](https://github.com/PerryLink) —— 创建者与维护者:规则词汇与求值、运行时、HMR 监听、会话日志审计、网络策略 + 代理,以及五语文档。
|
|
212
212
|
- [@22xuan](https://github.com/22xuan) —— 关于 rc.6 宿主静默丢弃审计事件 `ignorable` 标记的详细报告([#2](https://github.com/PerryLink/dsh-permission-rules/issues/2))与上游 harness 讨论;v0.4.1 的运行时宿主能力检测与文档更正直接源自该分析。
|
|
213
|
+
- [@sjh9714](https://github.com/sjh9714) —— 提出共享规则语法测试向量语料([#4](https://github.com/PerryLink/dsh-permission-rules/issues/4)、[#5](https://github.com/PerryLink/dsh-permission-rules/issues/5)),已于 v0.5.1 以 `docs/rule-test-vectors/` 落地,并在[方案讨论](https://github.com/PerryLink/dsh-permission-rules/discussions/10)中补充了 AST 分解的边界用例。
|
|
214
|
+
- [@weipeng1999](https://github.com/weipeng1999) —— 提出基于 AST 的命令分解功能([#8](https://github.com/PerryLink/dsh-permission-rules/issues/8)),促成该方案讨论。
|
|
215
|
+
- [@alexchenzl](https://github.com/alexchenzl) —— DSH 目录收录请求([#7](https://github.com/PerryLink/dsh-permission-rules/issues/7))。
|
|
216
|
+
- [@zl190](https://github.com/zl190) —— 报告并验证了 `0.1.0-rc.7` harness 兼容性缺口([PR #9](https://github.com/PerryLink/dsh-permission-rules/pulls/9))。
|
|
217
|
+
- [@cuohua](https://github.com/cuohua) —— 报告版本门仅覆盖 `0.1.0` 线后,`0.1.1-rc` 线仍静默丢弃 `ignorable` 标记([#11](https://github.com/PerryLink/dsh-permission-rules/issues/11));加宽后的版本门直接源自该分析。
|
|
213
218
|
|
|
214
219
|
## PerryLink DSH Plugin Family
|
|
215
220
|
|
package/docs/rules-format.en.md
CHANGED
|
@@ -17,7 +17,7 @@ rules: # rule list, evaluated in written order; may be omitted or empty
|
|
|
17
17
|
reason: ...
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
Only `rules` is allowed at the top level; each rule allows only `match`, `action`, `reason`, `enabled`, `description`, `tags`; each `match` allows only `tools`, `agents`, `params`, `paths`, `absent`, `when`. Any unknown field fails the load loudly — never silently ignored.
|
|
20
|
+
Only `rules` is allowed at the top level; each rule allows only `match`, `action`, `reason`, `enabled`, `description`, `tags`; each `match` allows only `tools`, `agents`, `params`, `paths`, `absent`, `when`, `network`. Any unknown field fails the load loudly — never silently ignored.
|
|
21
21
|
|
|
22
22
|
## match dimensions (AND)
|
|
23
23
|
|
|
@@ -29,9 +29,36 @@ Only `rules` is allowed at the top level; each rule allows only `match`, `action
|
|
|
29
29
|
| `paths` | `string[]` | Workspace-relative path patterns; any candidate matching any pattern satisfies the dimension. Candidates come from argument values under these keys at ANY nesting depth (depth-capped): `path` `paths` `file` `files` `file_path` `dir` `directory` `directories` `cwd` `workspace` `root` `target` `targets` `output`. Absolute candidates outside the workspace are dropped; relative `../` forms are kept so explicit out-of-root globs still work. In path patterns `*` does not cross `/`; `**` crosses any depth (including zero). With `caseInsensitivePaths` on (Windows default) the root comparison and the patterns ignore ASCII case. |
|
|
30
30
|
| `absent` | `string[]` | Argument keys that must be ABSENT; **every listed key must be missing** (non-object arguments satisfy this trivially). |
|
|
31
31
|
| `when` | `{ env, platform }` | Host conditions: `env` is env-var name → pattern(s), **every listed var must be present AND match**; `platform` is any-of a closed list (`aix` `android` `darwin` `freebsd` `linux` `openbsd` `sunos` `win32`). |
|
|
32
|
+
| `network` | `{ domains, ips, ports, schemes }` | Network scope (a network rule): the call must carry a URL candidate satisfying every listed dimension. `domains` (subdomain-inclusive unless wildcarded), `ips` (literals/globs/CIDRs), `ports` (`*`, one port, or a range), `schemes` (`http`/`https`). See the next section. |
|
|
32
33
|
|
|
33
34
|
All dimensions are ANDed: a rule matches only when **every non-empty dimension matches**. Rules evaluate in order — **the first match wins**; no match = passthrough.
|
|
34
35
|
|
|
36
|
+
## network dimension
|
|
37
|
+
|
|
38
|
+
A rule whose `match` carries a `network` block is a **network rule**. It matches a tool call only when the call carries a URL candidate — a web-tool URL argument (`url`, `endpoint`, `webhook`, …) or a URL embedded in `bash`/`pwsh` command text — that satisfies every listed dimension (AND); at the proxy layer it matches the shell subprocess connection target directly. A rule WITHOUT `network` keeps its file/command behavior exactly as before.
|
|
39
|
+
|
|
40
|
+
| Field | Semantics |
|
|
41
|
+
|---|---|
|
|
42
|
+
| `domains` | Domain patterns, lowercased with a trailing dot stripped. A pattern without wildcards is subdomain-inclusive — `example.com` also matches `api.example.com`; `*.example.com` matches subdomains only; `*`/`**` compile as ordinary globs. ANY pattern matching the target host satisfies the dimension. |
|
|
43
|
+
| `ips` | Exact IPv4/IPv6 literal, a glob (`10.0.*.*`), or an IPv4 CIDR (`10.0.0.0/8`). A literal IP in the URL is always a candidate; the proxy additionally resolves hostnames and tests their addresses, while `tools/pre-execute` matches literal IPs only (no DNS in the hot path). ANY match satisfies the dimension. |
|
|
44
|
+
| `ports` | `*`, one port (`443`), or an inclusive range (`8000-9000`); numeric YAML ports are accepted. Evaluated against the effective port (URL port, else 80/443 by scheme). ANY match satisfies the dimension. |
|
|
45
|
+
| `schemes` | `http` and/or `https`; the target scheme must be one of them. |
|
|
46
|
+
|
|
47
|
+
A network block must name at least one of the four fields. Scope a network rule by tool with `tools: [bash, pwsh]` (shell traffic), `tools: [web_fetch, web_search]` (web tools), or leave `tools` empty to cover both. The three policy modes that decide unlisted targets (`deny-all` / `whitelist` / `allow-all`, with an `auto` mode mapped onto the sandbox presets) are plugin config, not rule syntax — see the README "Network policy" section.
|
|
48
|
+
|
|
49
|
+
```yaml
|
|
50
|
+
rules:
|
|
51
|
+
# block one host for web tools; the shell proxy enforces the same for curl
|
|
52
|
+
- match: { tools: [web_fetch, web_search], network: { domains: [blocked.example] } }
|
|
53
|
+
action: deny
|
|
54
|
+
reason: "blocked.example is off-limits"
|
|
55
|
+
|
|
56
|
+
# allow only pinned package registries over https (whitelist-friendly rule)
|
|
57
|
+
- match: { tools: [bash, pwsh], network: { domains: ["registry.npmjs.org", "proxy.golang.org"], schemes: [https] } }
|
|
58
|
+
action: allow
|
|
59
|
+
reason: "pinned package registries"
|
|
60
|
+
```
|
|
61
|
+
|
|
35
62
|
## action, reason, and metadata
|
|
36
63
|
|
|
37
64
|
- `action: allow | deny | ask` (required).
|
package/docs/rules-format.md
CHANGED
|
@@ -17,7 +17,7 @@ rules: # 规则列表,按书写顺序求值;可以省略或为空
|
|
|
17
17
|
reason: ...
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
顶层只允许 `rules` 一个键;每条规则只允许 `match`、`action`、`reason`、`enabled`、`description`、`tags` 六个键;`match` 只允许 `tools`、`agents`、`params`、`paths`、`absent`、`when`
|
|
20
|
+
顶层只允许 `rules` 一个键;每条规则只允许 `match`、`action`、`reason`、`enabled`、`description`、`tags` 六个键;`match` 只允许 `tools`、`agents`、`params`、`paths`、`absent`、`when`、`network` 七个键。出现任何未知键都在加载期报错(响亮失败),绝不静默忽略。
|
|
21
21
|
|
|
22
22
|
## match 维度(全部 AND)
|
|
23
23
|
|
|
@@ -29,9 +29,36 @@ rules: # 规则列表,按书写顺序求值;可以省略或为空
|
|
|
29
29
|
| `paths` | `string[]` | 工作区相对路径模式,任一候选命中任一模式即可。候选来自参数中下列键的值(**任意嵌套深度**、深度上限):`path` `paths` `file` `files` `file_path` `dir` `directory` `directories` `cwd` `workspace` `root` `target` `targets` `output`。工作区外的绝对候选被丢弃;相对 `../` 形式保留,可显式匹配工作区外。路径模式中 `*` 不跨 `/`,`**` 跨任意深度(含零层)。`caseInsensitivePaths` 开启时(Windows 默认)根比较与模式匹配忽略 ASCII 大小写。 |
|
|
30
30
|
| `absent` | `string[]` | 必须**缺席**的参数键;**每个列出的键都必须缺失**(非对象参数天然满足)。 |
|
|
31
31
|
| `when` | `{ env, platform }` | 宿主条件:`env` 为环境变量名 → 模式(**每个列出的变量都必须存在且命中**);`platform` 为任一命中即可的封闭列表(`aix` `android` `darwin` `freebsd` `linux` `openbsd` `sunos` `win32`)。 |
|
|
32
|
+
| `network` | `{ domains, ips, ports, schemes }` | 网络作用域(网络规则):调用必须携带命中每个列出维度的 URL 候选。`domains`(无通配符时包含子域)、`ips`(字面量/glob/CIDR)、`ports`(`*`、单端口或区间)、`schemes`(`http`/`https`)。详见下一节。 |
|
|
32
33
|
|
|
33
34
|
所有维度为 AND:一条规则只有在它的**每个非空维度都命中**时才命中。规则按顺序求值,**首条命中生效**;无命中 = 透传。
|
|
34
35
|
|
|
36
|
+
## network 维度
|
|
37
|
+
|
|
38
|
+
`match` 带 `network` 块的规则是**网络规则**。它只有在调用携带命中每个列出维度(AND)的 URL 候选时才命中——候选来自 web 工具的 URL 参数(`url`、`endpoint`、`webhook` 等)或 `bash`/`pwsh` 命令文本中嵌入的 URL;在代理层则直接对 shell 子进程的连接目标求值。不带 `network` 的规则保持原有文件/命令行为不变。
|
|
39
|
+
|
|
40
|
+
| 字段 | 语义 |
|
|
41
|
+
|---|---|
|
|
42
|
+
| `domains` | 域名模式,小写化并去掉末尾点。无通配符的模式包含子域——`example.com` 同时命中 `api.example.com`;`*.example.com` 只匹配子域;`*`/`**` 按普通 glob 编译。任一模式命中目标主机即满足该维度。 |
|
|
43
|
+
| `ips` | 精确 IPv4/IPv6 字面量、glob(`10.0.*.*`)或 IPv4 CIDR(`10.0.0.0/8`)。URL 中的字面量 IP 始终是候选;代理额外解析主机名并测试其地址,而 `tools/pre-execute` 只匹配字面量 IP(热路径不做 DNS)。任一命中即满足。 |
|
|
44
|
+
| `ports` | `*`、单端口(`443`)或闭区间(`8000-9000`);接受数值型 YAML 端口。按有效端口求值(URL 端口,否则按 scheme 取 80/443)。任一命中即满足。 |
|
|
45
|
+
| `schemes` | `http` 和/或 `https`;目标 scheme 必须是其中之一。 |
|
|
46
|
+
|
|
47
|
+
网络块必须至少命名四个字段之一。用工具作用域限定网络规则:`tools: [bash, pwsh]`(shell 流量)、`tools: [web_fetch, web_search]`(web 工具),或留空 `tools` 同时覆盖两者。决定未列出目标的三档策略模式(`deny-all` / `whitelist` / `allow-all`,以及映射到沙箱预设的 `auto` 模式)是插件配置而非规则语法——见 README「Network policy」一节。
|
|
48
|
+
|
|
49
|
+
```yaml
|
|
50
|
+
rules:
|
|
51
|
+
# 对 web 工具封锁一个主机;shell 代理对 curl 同样生效
|
|
52
|
+
- match: { tools: [web_fetch, web_search], network: { domains: [blocked.example] } }
|
|
53
|
+
action: deny
|
|
54
|
+
reason: "blocked.example 禁止访问"
|
|
55
|
+
|
|
56
|
+
# 仅放行固定的包镜像(https,白名单友好规则)
|
|
57
|
+
- match: { tools: [bash, pwsh], network: { domains: ["registry.npmjs.org", "proxy.golang.org"], schemes: [https] } }
|
|
58
|
+
action: allow
|
|
59
|
+
reason: "固定包镜像"
|
|
60
|
+
```
|
|
61
|
+
|
|
35
62
|
## action、reason 与元数据
|
|
36
63
|
|
|
37
64
|
- `action: allow | deny | ask`(必填)。
|
|
@@ -108,6 +108,38 @@
|
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
+
},
|
|
112
|
+
"network": {
|
|
113
|
+
"description": "Network scope (a network rule): the call must carry a URL candidate (a web-tool URL argument, or a URL embedded in bash/pwsh command text) — or, at the proxy layer, a connection target — satisfying every listed dimension. domains are subdomain-inclusive unless wildcarded; ips accept IPv4/IPv6 literals, globs, and IPv4 CIDRs; ports accept \"*\", one port, or an inclusive low-high range (numeric YAML ports accepted); schemes are http/https. A network block must name at least one dimension.",
|
|
114
|
+
"type": "object",
|
|
115
|
+
"additionalProperties": false,
|
|
116
|
+
"properties": {
|
|
117
|
+
"domains": {
|
|
118
|
+
"description": "Domain patterns; ANY matching the target host satisfies the dimension.",
|
|
119
|
+
"type": "array",
|
|
120
|
+
"items": { "type": "string", "minLength": 1 }
|
|
121
|
+
},
|
|
122
|
+
"ips": {
|
|
123
|
+
"description": "IP literals, globs, or IPv4 CIDRs; ANY matching the target address satisfies the dimension.",
|
|
124
|
+
"type": "array",
|
|
125
|
+
"items": { "type": "string", "minLength": 1 }
|
|
126
|
+
},
|
|
127
|
+
"ports": {
|
|
128
|
+
"description": "\"*\", one port, or an inclusive low-high range; ANY matching the effective port satisfies the dimension.",
|
|
129
|
+
"type": "array",
|
|
130
|
+
"items": {
|
|
131
|
+
"oneOf": [
|
|
132
|
+
{ "type": "string", "minLength": 1 },
|
|
133
|
+
{ "type": "integer", "minimum": 0, "maximum": 65535 }
|
|
134
|
+
]
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
"schemes": {
|
|
138
|
+
"description": "Target scheme must be one of these.",
|
|
139
|
+
"type": "array",
|
|
140
|
+
"items": { "enum": ["http", "https"] }
|
|
141
|
+
}
|
|
142
|
+
}
|
|
111
143
|
}
|
|
112
144
|
}
|
|
113
145
|
},
|
package/lib/index.js
CHANGED
|
@@ -3267,7 +3267,7 @@ async function apply(ctx, config) {
|
|
|
3267
3267
|
systemPrompt.context({
|
|
3268
3268
|
name: "network:policy",
|
|
3269
3269
|
order: 115,
|
|
3270
|
-
text: "Network policy (permission-rules): shell commands reach the network only through a local policy proxy, and web tools are gated the same way — every target is allowed or blocked per the active rules and sandbox mode, and a blocked connection fails with a [network: …] message. Follow the denial messages and do not attempt to bypass the proxy."
|
|
3270
|
+
text: "You are a helpful assistant. Network policy (permission-rules): shell commands reach the network only through a local policy proxy, and web tools are gated the same way — every target is allowed or blocked per the active rules and sandbox mode, and a blocked connection fails with a [network: …] message. Follow the denial messages and do not attempt to bypass the proxy."
|
|
3271
3271
|
});
|
|
3272
3272
|
});
|
|
3273
3273
|
await ctx.plugin(PermissionRulesRemoteService, { runtime });
|
|
@@ -3283,15 +3283,19 @@ async function apply(ctx, config) {
|
|
|
3283
3283
|
* `ignorable` envelope-marker surface: the released `0.1.0-rc.1`–`0.1.0-rc.7`
|
|
3284
3284
|
* lines silently drop the marker from `Session.append` options, so audit
|
|
3285
3285
|
* events written by those builds land unmarked and break resume on
|
|
3286
|
-
* stricter hosts. `0.1.0-rc.8` and later stamp the marker.
|
|
3287
|
-
*
|
|
3288
|
-
*
|
|
3289
|
-
*
|
|
3286
|
+
* stricter hosts. `0.1.0-rc.8` and later stamp the marker. The `0.1.1-rc`
|
|
3287
|
+
* line regressed the same way (verified on `0.1.1-rc.2` — the stamping
|
|
3288
|
+
* fix exists only on harness master), so `0.1.1-rc.1`–`0.1.1-rc.7` are
|
|
3289
|
+
* treated as unmarked too; over-refusal is harmless because
|
|
3290
|
+
* `allowUnmarkedAudit: true` opts back in. Extend the bound if a future
|
|
3291
|
+
* rc line regresses. Non-matching (later rc, stable, or unresolvable)
|
|
3292
|
+
* versions are treated as possibly-marker-aware and verified by the
|
|
3293
|
+
* append probe.
|
|
3290
3294
|
* @param version - the installed peer version string.
|
|
3291
|
-
* @returns true for the known-unmarked rc.1–rc.7 lines.
|
|
3295
|
+
* @returns true for the known-unmarked rc.1–rc.7 lines of `0.1.0` and `0.1.1`.
|
|
3292
3296
|
*/
|
|
3293
3297
|
function isUnmarkedHostVersion(version) {
|
|
3294
|
-
const match = /^0\.1\.
|
|
3298
|
+
const match = /^0\.1\.[01]-rc\.(\d+)$/.exec(version.trim());
|
|
3295
3299
|
if (match === null) return false;
|
|
3296
3300
|
return Number(match[1]) <= 7;
|
|
3297
3301
|
}
|
package/lib/types/runtime.d.ts
CHANGED
|
@@ -384,12 +384,16 @@ export declare function apply(ctx: Context, config: Config): Promise<void>;
|
|
|
384
384
|
* `ignorable` envelope-marker surface: the released `0.1.0-rc.1`–`0.1.0-rc.7`
|
|
385
385
|
* lines silently drop the marker from `Session.append` options, so audit
|
|
386
386
|
* events written by those builds land unmarked and break resume on
|
|
387
|
-
* stricter hosts. `0.1.0-rc.8` and later stamp the marker.
|
|
388
|
-
*
|
|
389
|
-
*
|
|
390
|
-
*
|
|
387
|
+
* stricter hosts. `0.1.0-rc.8` and later stamp the marker. The `0.1.1-rc`
|
|
388
|
+
* line regressed the same way (verified on `0.1.1-rc.2` — the stamping
|
|
389
|
+
* fix exists only on harness master), so `0.1.1-rc.1`–`0.1.1-rc.7` are
|
|
390
|
+
* treated as unmarked too; over-refusal is harmless because
|
|
391
|
+
* `allowUnmarkedAudit: true` opts back in. Extend the bound if a future
|
|
392
|
+
* rc line regresses. Non-matching (later rc, stable, or unresolvable)
|
|
393
|
+
* versions are treated as possibly-marker-aware and verified by the
|
|
394
|
+
* append probe.
|
|
391
395
|
* @param version - the installed peer version string.
|
|
392
|
-
* @returns true for the known-unmarked rc.1–rc.7 lines.
|
|
396
|
+
* @returns true for the known-unmarked rc.1–rc.7 lines of `0.1.0` and `0.1.1`.
|
|
393
397
|
*/
|
|
394
398
|
export declare function isUnmarkedHostVersion(version: string): boolean;
|
|
395
399
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAEjF,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAE5E,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEzD,OAAO,KAAK,EAAkB,eAAe,EAA+B,OAAO,EAAE,MAAM,YAAY,CAAA;AAIvG,OAAO,KAAK,EAAiC,WAAW,EAAE,MAAM,cAAc,CAAA;AAE9E,OAAO,KAAK,EAAE,kBAAkB,EAAoB,MAAM,YAAY,CAAA;AAItE,OAAO,KAAK,EAAiD,eAAe,EAAE,MAAM,aAAa,CAAA;AAEjG,eAAO,MAAM,IAAI,qBAAqB,CAAA;AAEtC,kDAAkD;AAClD,eAAO,MAAM,MAAM,UAAwB,CAAA;AAE3C,iDAAiD;AACjD,UAAU,WAAW;IACnB,wDAAwD;IACxD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,wFAAwF;IACxF,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;IACnC,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAA;IAClC,iGAAiG;IACjG,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,CAAA;CACvB;AAuBD;;;GAGG;AACH,qBAAa,sBAA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,OAAO,CAAC,UAAU,EAAE,iBAAiB,GAAG,aAAa;IA4DrD;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,WAAW;IA0DnB,mHAAmH;IACnH,OAAO,CAAC,aAAa;IAMrB,gFAAgF;IAChF,OAAO,CAAC,gBAAgB;IAiBxB,8FAA8F;IAC9F,OAAO,CAAC,cAAc;IAmBtB;;;;;;OAMG;IACH,uBAAuB,IAAI,IAAI;IAa/B,0EAA0E;IAC1E,OAAO,CAAC,iBAAiB;IAUzB,+EAA+E;IAC/E,OAAO,CAAC,WAAW;IAmCnB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,cAAc;IAetB;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;IAOxB;;;;;;;OAOG;IACH,OAAO,CAAC,oBAAoB;IAyC5B,qHAAqH;IACrH,OAAO,CAAC,kBAAkB;IAU1B,8FAA8F;IAC9F,OAAO,CAAC,aAAa;IAarB;;;;;;OAMG;IACH,OAAO,CAAC,WAAW;IAYnB,4DAA4D;IAC5D,kBAAkB,IAAI,MAAM;IAI5B,sEAAsE;IACtE,kBAAkB,IAAI,MAAM;IAI5B;;;;;OAKG;IACH,OAAO,CAAC,cAAc;CAevB;AAED;;;;;GAKG;AACH,wBAAsB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA4BvE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAI9D"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-permission-rules",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.6",
|
|
4
4
|
"description": "Declarative Claude Code-style permission rules plus a Codex-style process-level network policy for DeepSeek Harness: ordered allow/deny/ask rules with tool-name, argument (glob/regex), workspace-path, and network-target (domain/ip/port/scheme) matching on the tools/pre-execute waterfall, a built-in local HTTP/CONNECT proxy governing shell subprocess traffic, three network modes mapped onto the official sandbox presets, full session-log audit, HMR rule reload, and a settings page with a rule editor, block counters, and recent interception lists.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -160,7 +160,7 @@
|
|
|
160
160
|
"@eslint/js": "^10.0.1",
|
|
161
161
|
"@types/node": "^22.19.0",
|
|
162
162
|
"@vitest/coverage-v8": "^3.2.0",
|
|
163
|
-
"dsh-auto-review": "file:vendor/dsh-auto-review-0.
|
|
163
|
+
"dsh-auto-review": "file:vendor/dsh-auto-review-0.6.0.tgz",
|
|
164
164
|
"eslint": "^10.8.1",
|
|
165
165
|
"globals": "^17.11.0",
|
|
166
166
|
"react": "18.3.1",
|
package/src/runtime.ts
CHANGED
|
@@ -1159,7 +1159,7 @@ export async function apply(ctx: Context, config: Config): Promise<void> {
|
|
|
1159
1159
|
systemPrompt.context({
|
|
1160
1160
|
name: 'network:policy',
|
|
1161
1161
|
order: 115,
|
|
1162
|
-
text: 'Network policy (permission-rules): shell commands reach the network only through a local policy proxy, and web tools are gated the same way — every target is allowed or blocked per the active rules and sandbox mode, and a blocked connection fails with a [network: …] message. Follow the denial messages and do not attempt to bypass the proxy.',
|
|
1162
|
+
text: 'You are a helpful assistant. Network policy (permission-rules): shell commands reach the network only through a local policy proxy, and web tools are gated the same way — every target is allowed or blocked per the active rules and sandbox mode, and a blocked connection fails with a [network: …] message. Follow the denial messages and do not attempt to bypass the proxy.',
|
|
1163
1163
|
})
|
|
1164
1164
|
})
|
|
1165
1165
|
await ctx.plugin(PermissionRulesRemoteService, { runtime })
|
|
@@ -1176,15 +1176,19 @@ export async function apply(ctx: Context, config: Config): Promise<void> {
|
|
|
1176
1176
|
* `ignorable` envelope-marker surface: the released `0.1.0-rc.1`–`0.1.0-rc.7`
|
|
1177
1177
|
* lines silently drop the marker from `Session.append` options, so audit
|
|
1178
1178
|
* events written by those builds land unmarked and break resume on
|
|
1179
|
-
* stricter hosts. `0.1.0-rc.8` and later stamp the marker.
|
|
1180
|
-
*
|
|
1181
|
-
*
|
|
1182
|
-
*
|
|
1179
|
+
* stricter hosts. `0.1.0-rc.8` and later stamp the marker. The `0.1.1-rc`
|
|
1180
|
+
* line regressed the same way (verified on `0.1.1-rc.2` — the stamping
|
|
1181
|
+
* fix exists only on harness master), so `0.1.1-rc.1`–`0.1.1-rc.7` are
|
|
1182
|
+
* treated as unmarked too; over-refusal is harmless because
|
|
1183
|
+
* `allowUnmarkedAudit: true` opts back in. Extend the bound if a future
|
|
1184
|
+
* rc line regresses. Non-matching (later rc, stable, or unresolvable)
|
|
1185
|
+
* versions are treated as possibly-marker-aware and verified by the
|
|
1186
|
+
* append probe.
|
|
1183
1187
|
* @param version - the installed peer version string.
|
|
1184
|
-
* @returns true for the known-unmarked rc.1–rc.7 lines.
|
|
1188
|
+
* @returns true for the known-unmarked rc.1–rc.7 lines of `0.1.0` and `0.1.1`.
|
|
1185
1189
|
*/
|
|
1186
1190
|
export function isUnmarkedHostVersion(version: string): boolean {
|
|
1187
|
-
const match = /^0\.1\.
|
|
1191
|
+
const match = /^0\.1\.[01]-rc\.(\d+)$/.exec(version.trim())
|
|
1188
1192
|
if (match === null) return false
|
|
1189
1193
|
return Number(match[1]) <= 7
|
|
1190
1194
|
}
|