dsh-code-security 0.3.2 → 0.3.4
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/README.en.md +12 -0
- package/README.md +9 -1
- package/lib/index.js +1 -1
- package/lib/tools.js +7 -6
- package/package.json +61 -61
package/README.en.md
CHANGED
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
# dsh-code-security
|
|
2
2
|
|
|
3
|
+
## 0.3.4 update (2026-09-27)
|
|
4
|
+
|
|
5
|
+
Fixes scan output validation when no baseline exists. SARIF now uses workspace file URIs, relative locations and structured rule descriptions, including paths with spaces and Unicode.
|
|
6
|
+
|
|
7
|
+
Validation host: Harness 0.1.7-rc.2 built from official sources, retaining the local tool-scheduler fix. Build and automated checks pass; interactive coverage and external-service limits are recorded in this release round.
|
|
8
|
+
|
|
3
9
|
   
|
|
4
10
|
|
|
5
11
|
> Every agent code change passes a local security scan before delivery.
|
|
6
12
|
|
|
7
13
|
A DeepSeek Harness plugin for AI code security review: deterministic rule engine, git-diff incremental review, fix-verify loop, and policy gate. Methodology borrows from Codex security skills (evidence-first findings, severity ordering, supply-chain layers). Zero runtime dependencies.
|
|
8
14
|
|
|
15
|
+
## Compatibility
|
|
16
|
+
|
|
17
|
+
Verified with official `@deepseek-ai/dsh@0.1.5-rc.1` and Node `24.16.0` on 2026-09-11: all 18 components load alongside Modlens, with passing tool-schema, skill-registration and offline read-only invocation checks. Uses the `cordis.patch.yml` + `dsh.bundle.patch` bundle model. Node requirements match this Harness release: 22.19 or later within 22.x, or 24 or later. Live external-service workflows require separate configuration and validation.
|
|
18
|
+
|
|
19
|
+
2026-09-13 fix: retain the service receiver when calling `subprocess.spawn`, preventing failures caused by passing the method as an unbound callback. Verified with official `0.1.5-rc.1` and `0.1.5-rc.2` on Node `24.16.0`. `secure_diff` reads a real isolated Git repository through the host subprocess service and reports the changed file and added line.
|
|
20
|
+
|
|
9
21
|
## Tools
|
|
10
22
|
|
|
11
23
|
| Tool | Purpose | Write |
|
package/README.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# dsh-code-security
|
|
2
2
|
|
|
3
|
+
## 0.3.4 更新(2026-09-27)
|
|
4
|
+
|
|
5
|
+
修复未设置基线时扫描结果被新版 Harness 拒绝的问题。SARIF 正确使用工作区文件 URI、相对路径和规则描述对象,支持空格与中文文件名。
|
|
6
|
+
|
|
7
|
+
验证宿主:官方源码构建的 Harness 0.1.7-rc.2(保留本地工具调度器修复)。构建与自动测试通过;实际操作和外部服务限制见本轮验收记录。
|
|
8
|
+
|
|
3
9
|
   
|
|
4
10
|
|
|
5
11
|
> 让 agent 每次改完代码,先过一道本地安全扫描,修复完了才准交付。
|
|
@@ -33,7 +39,9 @@ DeepSeek Harness AI 代码安全审查插件:确定性规则引擎 + git diff
|
|
|
33
39
|
|
|
34
40
|
## 兼容性
|
|
35
41
|
|
|
36
|
-
|
|
42
|
+
已在官方 `@deepseek-ai/dsh@0.1.5-rc.1`、Node `24.16.0` 上验证(2026-09-11):18 个组件与 Modlens 同载,工具 schema、技能注册及离线只读调用检查通过。采用 `cordis.patch.yml` + `dsh.bundle.patch` 组合包模型。Node 要求与该版本 Harness 一致:22.19 及以上的 22.x,或 24 及以上。外部服务的实际业务操作需按各组件配置单独验证。
|
|
43
|
+
|
|
44
|
+
2026-09-13 修复:保留宿主 `subprocess.spawn` 的服务对象,避免方法独立传递后因 `this` 丢失而报错。已在官方 `0.1.5-rc.1` 和 `0.1.5-rc.2`、Node `24.16.0` 上验证。`secure_diff` 已通过真实宿主进程服务读取隔离 Git 仓库差异,正确识别变更文件和新增行。
|
|
37
45
|
|
|
38
46
|
## 安装
|
|
39
47
|
|
package/lib/index.js
CHANGED
|
@@ -21,7 +21,7 @@ export function apply(ctx, config) {
|
|
|
21
21
|
console.warn('[dsh-code-security] ' + (error instanceof Error ? error.message : String(error)));
|
|
22
22
|
cfg = resolveConfig(null);
|
|
23
23
|
}
|
|
24
|
-
const runner = createSubprocessRunner(ctx.subprocess.spawn, 10000, 60000);
|
|
24
|
+
const runner = createSubprocessRunner((spec) => ctx.subprocess.spawn(spec), 10000, 60000);
|
|
25
25
|
const tools = buildSecureTools(cfg, process.cwd(), runner);
|
|
26
26
|
const disposers = [];
|
|
27
27
|
for (const definition of tools) {
|
package/lib/tools.js
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { writeFile } from 'node:fs/promises';
|
|
9
9
|
import path from 'node:path';
|
|
10
|
+
import { pathToFileURL } from 'node:url';
|
|
10
11
|
import { optionalString, requiredString } from './config.js';
|
|
11
12
|
import { buildExtraTools } from './extra.js';
|
|
12
13
|
import { runGitDiff, scanDiff } from './diff.js';
|
|
@@ -54,7 +55,7 @@ const scanSchema = {
|
|
|
54
55
|
failOn: { type: 'string' }, durationMs: { type: 'integer' },
|
|
55
56
|
newFindings: { type: 'array', items: findingSchema }, newCounts: countsSchema,
|
|
56
57
|
acceptedFindings: { type: 'array', items: findingSchema },
|
|
57
|
-
baseline: { type: 'object', additionalProperties: true },
|
|
58
|
+
baseline: { oneOf: [{ type: 'object', additionalProperties: true }, { type: 'null' }] },
|
|
58
59
|
},
|
|
59
60
|
additionalProperties: true,
|
|
60
61
|
};
|
|
@@ -320,7 +321,7 @@ export function buildSecureTools(cfg, cwd, runner) {
|
|
|
320
321
|
const state = await loadState(stateDir);
|
|
321
322
|
if (state.last === null)
|
|
322
323
|
throw new Error('尚无扫描结果,请先执行 secure_scan 或 secure_diff。');
|
|
323
|
-
const text = format === 'sarif' ? buildSarif(state.last.findings,
|
|
324
|
+
const text = format === 'sarif' ? buildSarif(state.last.findings, cwd) : buildMarkdown(state.last.findings, state.last.target);
|
|
324
325
|
if (target !== undefined)
|
|
325
326
|
await writeFile(target, text, 'utf8');
|
|
326
327
|
return { format, path: target ?? '', text, findingCount: state.last.findings.length };
|
|
@@ -362,15 +363,15 @@ function buildMarkdown(findings, target) {
|
|
|
362
363
|
}
|
|
363
364
|
return lines.join('\n') + '\n';
|
|
364
365
|
}
|
|
365
|
-
function buildSarif(findings,
|
|
366
|
+
function buildSarif(findings, cwd) {
|
|
366
367
|
const rules = new Map();
|
|
367
368
|
const results = findings.map((finding, index) => {
|
|
368
|
-
rules.set(finding.ruleId, { id: finding.ruleId, name: finding.title, shortDescription: finding.title });
|
|
369
|
+
rules.set(finding.ruleId, { id: finding.ruleId, name: finding.title, shortDescription: { text: finding.title } });
|
|
369
370
|
return {
|
|
370
371
|
ruleId: finding.ruleId,
|
|
371
372
|
level: finding.severity === 'critical' || finding.severity === 'high' ? 'error' : finding.severity === 'medium' ? 'warning' : 'note',
|
|
372
373
|
message: { text: finding.message },
|
|
373
|
-
locations: [{ physicalLocation: { artifactLocation: { uri: finding.file.replace(/\\/g, '/') }, region: { startLine: finding.line } } }],
|
|
374
|
+
locations: [{ physicalLocation: { artifactLocation: { uri: finding.file.replace(/\\/g, '/').split('/').map(encodeURIComponent).join('/'), uriBaseId: 'ROOTPATH' }, region: { startLine: finding.line } } }],
|
|
374
375
|
partialFingerprints: { primaryLocationLineHash: finding.id + ':' + String(index) },
|
|
375
376
|
};
|
|
376
377
|
});
|
|
@@ -379,7 +380,7 @@ function buildSarif(findings, target) {
|
|
|
379
380
|
$schema: 'https://json.schemastore.org/sarif-2.1.0.json',
|
|
380
381
|
runs: [{
|
|
381
382
|
tool: { driver: { name: 'dsh-code-security', version: '0.1.0', informationUri: 'https://github.com/STARDUSTLC666/dsh-code-security', rules: [...rules.values()] } },
|
|
382
|
-
originalUriBaseIds: { ROOTPATH: { uri:
|
|
383
|
+
originalUriBaseIds: { ROOTPATH: { uri: pathToFileURL(path.resolve(cwd) + path.sep).href } },
|
|
383
384
|
results,
|
|
384
385
|
}],
|
|
385
386
|
}, null, 2);
|
package/package.json
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "dsh-code-security",
|
|
3
|
-
"version": "0.3.
|
|
4
|
-
"description": "DSH
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "lib/index.js",
|
|
7
|
-
"types": "lib/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"types": "./lib/index.d.ts",
|
|
11
|
-
"default": "./lib/index.js"
|
|
12
|
-
},
|
|
13
|
-
"./cordis.patch.yml": "./cordis.patch.yml",
|
|
14
|
-
"./package.json": "./package.json"
|
|
15
|
-
},
|
|
16
|
-
"files": [
|
|
17
|
-
"lib",
|
|
18
|
-
"cordis.patch.yml",
|
|
19
|
-
"README.md",
|
|
20
|
-
"README.en.md"
|
|
21
|
-
],
|
|
22
|
-
"scripts": {
|
|
23
|
-
"build": "tsc -p tsconfig.json",
|
|
24
|
-
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
25
|
-
"test": "pnpm run build && node --test \"test/*.test.mjs\"",
|
|
26
|
-
"prepublishOnly": "pnpm run build"
|
|
27
|
-
},
|
|
28
|
-
"dsh": {
|
|
29
|
-
"bundle": {
|
|
30
|
-
"patch": "./cordis.patch.yml"
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
"keywords": [
|
|
34
|
-
"dsh",
|
|
35
|
-
"deepseek-harness",
|
|
36
|
-
"plugin",
|
|
37
|
-
"security",
|
|
38
|
-
"code-review",
|
|
39
|
-
"sast",
|
|
40
|
-
"secrets",
|
|
41
|
-
"owasp"
|
|
42
|
-
],
|
|
43
|
-
"license": "MIT",
|
|
44
|
-
"engines": {
|
|
45
|
-
"node": ">=
|
|
46
|
-
},
|
|
47
|
-
"devDependencies": {
|
|
48
|
-
"@types/node": "^24.0.0",
|
|
49
|
-
"typescript": "^5.6.0"
|
|
50
|
-
},
|
|
51
|
-
"repository": {
|
|
52
|
-
"type": "git",
|
|
53
|
-
"url": "git+https://github.com/STARDUSTLC666/dsh-code-security.git"
|
|
54
|
-
},
|
|
55
|
-
"bugs": {
|
|
56
|
-
"url": "https://github.com/STARDUSTLC666/dsh-code-security/issues"
|
|
57
|
-
},
|
|
58
|
-
"homepage": "https://github.com/STARDUSTLC666/dsh-code-security#readme",
|
|
59
|
-
"author": "stardustlc",
|
|
60
|
-
"packageManager": "pnpm@11.7.0"
|
|
61
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "dsh-code-security",
|
|
3
|
+
"version": "0.3.4",
|
|
4
|
+
"description": "DSH 代码安全审查插件:40+ 确定性规则与密钥熵检测,支持 git diff/staged 审查、SARIF 导出、基线接受与 SBOM-lite。",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"types": "lib/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./lib/index.d.ts",
|
|
11
|
+
"default": "./lib/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./cordis.patch.yml": "./cordis.patch.yml",
|
|
14
|
+
"./package.json": "./package.json"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"lib",
|
|
18
|
+
"cordis.patch.yml",
|
|
19
|
+
"README.md",
|
|
20
|
+
"README.en.md"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "tsc -p tsconfig.json",
|
|
24
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
25
|
+
"test": "pnpm run build && node --test \"test/*.test.mjs\"",
|
|
26
|
+
"prepublishOnly": "pnpm run build"
|
|
27
|
+
},
|
|
28
|
+
"dsh": {
|
|
29
|
+
"bundle": {
|
|
30
|
+
"patch": "./cordis.patch.yml"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"keywords": [
|
|
34
|
+
"dsh",
|
|
35
|
+
"deepseek-harness",
|
|
36
|
+
"plugin",
|
|
37
|
+
"security",
|
|
38
|
+
"code-review",
|
|
39
|
+
"sast",
|
|
40
|
+
"secrets",
|
|
41
|
+
"owasp"
|
|
42
|
+
],
|
|
43
|
+
"license": "MIT",
|
|
44
|
+
"engines": {
|
|
45
|
+
"node": "^22.19.0 || >=24.0.0"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/node": "^24.0.0",
|
|
49
|
+
"typescript": "^5.6.0"
|
|
50
|
+
},
|
|
51
|
+
"repository": {
|
|
52
|
+
"type": "git",
|
|
53
|
+
"url": "git+https://github.com/STARDUSTLC666/dsh-code-security.git"
|
|
54
|
+
},
|
|
55
|
+
"bugs": {
|
|
56
|
+
"url": "https://github.com/STARDUSTLC666/dsh-code-security/issues"
|
|
57
|
+
},
|
|
58
|
+
"homepage": "https://github.com/STARDUSTLC666/dsh-code-security#readme",
|
|
59
|
+
"author": "stardustlc",
|
|
60
|
+
"packageManager": "pnpm@11.7.0"
|
|
61
|
+
}
|