@goodandready/dsh-approval-gate 0.1.21 → 0.1.22
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 +8 -0
- package/lib/audit-log.js +348 -345
- package/lib/engine.js +48 -35
- package/lib/escalation.js +151 -0
- package/lib/guidance.js +119 -0
- package/lib/index.js +44 -2
- package/lib/lineage.js +182 -0
- package/lib/measure-kinds.js +3 -0
- package/lib/messages.js +27 -0
- package/package.json +55 -55
package/lib/measure-kinds.js
CHANGED
|
@@ -56,6 +56,9 @@ const SYSTEM_LEVEL_TOOLS = new Set([
|
|
|
56
56
|
*/
|
|
57
57
|
export function classifyMeasureKind(execution, context = {}) {
|
|
58
58
|
if (!execution) return MEASURE_KINDS.LOCAL_SINGLE;
|
|
59
|
+
if (typeof execution === "string") {
|
|
60
|
+
execution = { name: "bash", arguments: { command: execution } };
|
|
61
|
+
}
|
|
59
62
|
|
|
60
63
|
const toolName = execution.name || execution.tool || "";
|
|
61
64
|
const args = execution.arguments || {};
|
package/lib/messages.js
CHANGED
|
@@ -82,6 +82,12 @@ export const MESSAGES = Object.freeze({
|
|
|
82
82
|
ruleAgentsMdProhibitedPath: "File modification prohibited by rules in AGENTS.md",
|
|
83
83
|
askMajorVersionBump: "Package.json modification contains major dependency bump; review before allowing",
|
|
84
84
|
ruleMajorVersionBump: "Unauthorized major dependency version bump",
|
|
85
|
+
askRedundantSandbox: "Redundant sandbox elevation requested for safe workspace operation; review or execute in sandboxed mode",
|
|
86
|
+
ruleRedundantSandbox: "Unnecessary sandbox elevation requested for workspace-internal task",
|
|
87
|
+
askMissingJustification: "Privilege escalation requires an explicit justification; review before allowing",
|
|
88
|
+
ruleMissingJustification: "System privilege escalation requested without justification",
|
|
89
|
+
askInsufficientJustification: "Privilege escalation justification is too brief or generic; review before allowing",
|
|
90
|
+
ruleInsufficientJustification: "Insufficient privilege escalation justification",
|
|
85
91
|
hintRecursiveRm: "Specify exact target files instead of recursive deletion",
|
|
86
92
|
hintPathTraversal: "Keep operations strictly within the project directory",
|
|
87
93
|
hintSecretWrite: "Modify configuration via settings or environment variables, not raw file overwrite",
|
|
@@ -109,6 +115,9 @@ export const MESSAGES = Object.freeze({
|
|
|
109
115
|
hintAgentsMdProhibited: "Review project-specific guidelines and constraints defined in AGENTS.md",
|
|
110
116
|
hintMajorVersionBump: "Verify compatibility before bumping major dependency versions in package.json",
|
|
111
117
|
hintUnmatchedAsk: "Unrecognized operations default to fail-closed approval under defaultVerdict='ask'",
|
|
118
|
+
hintRedundantSandbox: "Execute the command in standard sandbox mode without danger-full-access",
|
|
119
|
+
hintMissingJustification: "Provide a justification field with at least 10 non-placeholder characters",
|
|
120
|
+
hintInsufficientJustification: "Describe the specific operational reason for privilege escalation",
|
|
112
121
|
},
|
|
113
122
|
zh: {
|
|
114
123
|
blockedPrefix: "dsh-approval-gate 规则已阻止",
|
|
@@ -190,6 +199,12 @@ export const MESSAGES = Object.freeze({
|
|
|
190
199
|
ruleAgentsMdProhibitedPath: "文件修改被 AGENTS.md 中的规则明确禁止",
|
|
191
200
|
askMajorVersionBump: "package.json 包含破坏性依赖主版本升级;请在允许前进行审查",
|
|
192
201
|
ruleMajorVersionBump: "未授权的依赖包主版本升级",
|
|
202
|
+
askRedundantSandbox: "对安全的内部操作请求了冗余的沙箱提权;请在允许前审查或以标准沙箱模式执行",
|
|
203
|
+
ruleRedundantSandbox: "工作区内部任务请求了不必要的沙箱提权",
|
|
204
|
+
askMissingJustification: "特权提升需要明确的理由说明;请在允许前进行审查",
|
|
205
|
+
ruleMissingJustification: "未提供理由即请求系统提权",
|
|
206
|
+
askInsufficientJustification: "特权提升理由过短或为占位符;请在允许前进行审查",
|
|
207
|
+
ruleInsufficientJustification: "特权提升理由不充分",
|
|
193
208
|
hintRecursiveRm: "请指定具体目标文件,避免递归删除",
|
|
194
209
|
hintPathTraversal: "请将操作限制在项目根目录内",
|
|
195
210
|
hintSecretWrite: "请通过设置或环境变量修改配置,不要直接覆盖敏感配置文件",
|
|
@@ -217,6 +232,9 @@ export const MESSAGES = Object.freeze({
|
|
|
217
232
|
hintAgentsMdProhibited: "请核对项目根目录 AGENTS.md 中定义的安全约束和禁止指令",
|
|
218
233
|
hintMajorVersionBump: "在升级 package.json 依赖主版本前请确认破坏性变更与兼容性",
|
|
219
234
|
hintUnmatchedAsk: "在 defaultVerdict='ask' 模式下,未识别的操作默认需要人工审核确认",
|
|
235
|
+
hintRedundantSandbox: "在标准沙箱模式下重新执行该命令,无需申请 danger-full-access",
|
|
236
|
+
hintMissingJustification: "请提供至少10个字符的有效理由说明字段",
|
|
237
|
+
hintInsufficientJustification: "请详细说明提权操作的具体业务或技术原因",
|
|
220
238
|
},
|
|
221
239
|
});
|
|
222
240
|
|
|
@@ -291,6 +309,9 @@ const RULE_KEYS = Object.freeze({
|
|
|
291
309
|
"agents-md-prohibited-command": "ruleAgentsMdProhibitedCommand",
|
|
292
310
|
"agents-md-prohibited-path": "ruleAgentsMdProhibitedPath",
|
|
293
311
|
"major-version-bump": "askMajorVersionBump",
|
|
312
|
+
"redundant-sandbox-privilege": "ruleRedundantSandbox",
|
|
313
|
+
"missing-escalation-justification": "ruleMissingJustification",
|
|
314
|
+
"insufficient-escalation-justification": "ruleInsufficientJustification",
|
|
294
315
|
});
|
|
295
316
|
|
|
296
317
|
const HINT_KEYS = Object.freeze({
|
|
@@ -322,6 +343,9 @@ const HINT_KEYS = Object.freeze({
|
|
|
322
343
|
"agents-md-prohibited-path": "hintAgentsMdProhibited",
|
|
323
344
|
"major-version-bump": "hintMajorVersionBump",
|
|
324
345
|
"unmatched-ask": "hintUnmatchedAsk",
|
|
346
|
+
"redundant-sandbox-privilege": "hintRedundantSandbox",
|
|
347
|
+
"missing-escalation-justification": "hintMissingJustification",
|
|
348
|
+
"insufficient-escalation-justification": "hintInsufficientJustification",
|
|
325
349
|
});
|
|
326
350
|
|
|
327
351
|
const ASK_KEYS = Object.freeze({
|
|
@@ -329,6 +353,9 @@ const ASK_KEYS = Object.freeze({
|
|
|
329
353
|
"unknown-format": "askUnknownFormat",
|
|
330
354
|
"unknown-write-target": "askUnknownWriteTarget",
|
|
331
355
|
"unmatched-ask": "askUnmatched",
|
|
356
|
+
"redundant-sandbox-privilege": "askRedundantSandbox",
|
|
357
|
+
"missing-escalation-justification": "askMissingJustification",
|
|
358
|
+
"insufficient-escalation-justification": "askInsufficientJustification",
|
|
332
359
|
"dynamic-command": "askDynamicCommand",
|
|
333
360
|
"dynamic-arguments": "askDynamicArguments",
|
|
334
361
|
"dynamic-redirect": "askDynamicRedirect",
|
package/package.json
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@goodandready/dsh-approval-gate",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Host-only command safety gate for DeepSeek Harness: blocks recognized dangerous operations and requests DSH approval when a command cannot be inspected.",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "lib/index.js",
|
|
7
|
-
"exports": {
|
|
8
|
-
".": "./lib/index.js",
|
|
9
|
-
"./package.json": "./package.json",
|
|
10
|
-
"./cordis.patch.yml": "./cordis.patch.yml"
|
|
11
|
-
},
|
|
12
|
-
"files": [
|
|
13
|
-
"lib",
|
|
14
|
-
"rules",
|
|
15
|
-
"cordis.patch.yml",
|
|
16
|
-
"README.md",
|
|
17
|
-
"README.zh.md",
|
|
18
|
-
"README.ru.md",
|
|
19
|
-
"CHANGELOG.md",
|
|
20
|
-
"LICENSE"
|
|
21
|
-
],
|
|
22
|
-
"dsh": {
|
|
23
|
-
"bundle": {
|
|
24
|
-
"patch": "./cordis.patch.yml"
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
"license": "MIT",
|
|
28
|
-
"peerDependencies": {
|
|
29
|
-
"@deepseek-ai/cordis": "^4.0.1",
|
|
30
|
-
"@deepseek-ai/schemastery": "^3.18.1"
|
|
31
|
-
},
|
|
32
|
-
"repository": {
|
|
33
|
-
"type": "git",
|
|
34
|
-
"url": "git+https://github.com/GooDAnDReaDY/dsh-approval-gate.git"
|
|
35
|
-
},
|
|
36
|
-
"homepage": "https://github.com/GooDAnDReaDY/dsh-approval-gate#readme",
|
|
37
|
-
"bugs": {
|
|
38
|
-
"url": "https://github.com/GooDAnDReaDY/dsh-approval-gate/issues"
|
|
39
|
-
},
|
|
40
|
-
"scripts": {
|
|
41
|
-
"test": "node --test test/*.test.mjs"
|
|
42
|
-
},
|
|
43
|
-
"publishConfig": {
|
|
44
|
-
"registry": "https://registry.npmjs.org",
|
|
45
|
-
"access": "public"
|
|
46
|
-
},
|
|
47
|
-
"keywords": [
|
|
48
|
-
"dsh",
|
|
49
|
-
"dsh-plugin",
|
|
50
|
-
"deepseek-harness",
|
|
51
|
-
"security",
|
|
52
|
-
"approval-gate",
|
|
53
|
-
"safety"
|
|
54
|
-
]
|
|
55
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@goodandready/dsh-approval-gate",
|
|
3
|
+
"version": "0.1.22",
|
|
4
|
+
"description": "Host-only command safety gate for DeepSeek Harness: blocks recognized dangerous operations and requests DSH approval when a command cannot be inspected.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./lib/index.js",
|
|
9
|
+
"./package.json": "./package.json",
|
|
10
|
+
"./cordis.patch.yml": "./cordis.patch.yml"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"lib",
|
|
14
|
+
"rules",
|
|
15
|
+
"cordis.patch.yml",
|
|
16
|
+
"README.md",
|
|
17
|
+
"README.zh.md",
|
|
18
|
+
"README.ru.md",
|
|
19
|
+
"CHANGELOG.md",
|
|
20
|
+
"LICENSE"
|
|
21
|
+
],
|
|
22
|
+
"dsh": {
|
|
23
|
+
"bundle": {
|
|
24
|
+
"patch": "./cordis.patch.yml"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"@deepseek-ai/cordis": "^4.0.1",
|
|
30
|
+
"@deepseek-ai/schemastery": "^3.18.1"
|
|
31
|
+
},
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "git+https://github.com/GooDAnDReaDY/dsh-approval-gate.git"
|
|
35
|
+
},
|
|
36
|
+
"homepage": "https://github.com/GooDAnDReaDY/dsh-approval-gate#readme",
|
|
37
|
+
"bugs": {
|
|
38
|
+
"url": "https://github.com/GooDAnDReaDY/dsh-approval-gate/issues"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"test": "node --test test/*.test.mjs"
|
|
42
|
+
},
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"registry": "https://registry.npmjs.org",
|
|
45
|
+
"access": "public"
|
|
46
|
+
},
|
|
47
|
+
"keywords": [
|
|
48
|
+
"dsh",
|
|
49
|
+
"dsh-plugin",
|
|
50
|
+
"deepseek-harness",
|
|
51
|
+
"security",
|
|
52
|
+
"approval-gate",
|
|
53
|
+
"safety"
|
|
54
|
+
]
|
|
55
|
+
}
|