dsh-git-push 2.10.4 → 2.12.3
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/.auditignore +2 -4
- package/README.md +78 -1483
- package/lib/app/audit-api.js +2 -0
- package/lib/app/inject-text.js +0 -1
- package/lib/app/repo-ownership.js +65 -0
- package/lib/app/tool-call.js +6 -2
- package/lib/ast/io-risk-loop.js +1 -1
- package/lib/ast/tokenizer.js +76 -1
- package/lib/ast/treesitter.js +78 -14
- package/lib/audit/audit-file.js +15 -1
- package/lib/audit/collector.js +9 -1
- package/lib/audit/finding.js +8 -1
- package/lib/audit/orchestrate.js +1 -0
- package/lib/audit/ownership.js +46 -0
- package/lib/audit/report-yaml.js +5 -1
- package/lib/audit-rules/audit-rules-comment.yml +0 -68
- package/lib/audit-rules/audit-rules-csharp.yml +82 -0
- package/lib/audit-rules/audit-rules-structure.yml +2 -3
- package/lib/cli/commands-audit.mjs +3 -0
- package/lib/git/push.js +1 -1
- package/lib/rule/loader.js +5 -1
- package/lib/self/index.js +1 -1
- package/lib/skip-dirs.js +6 -3
- package/package.json +6 -1
- package/scripts/bump-version.mjs +163 -0
- package/scripts/doc-tree.mjs +4 -2
- package/scripts/doc-version.mjs +4 -4
- package/scripts/{readme-gen.mjs → version-source.mjs} +8 -153
- package/skills/dev/dsh-git-push.md +3 -11
- package/skills/guide/guide-cli-scripts.md +0 -2
- package/assets/tree-sitter/LICENSE +0 -21
- package/assets/tree-sitter/README.md +0 -69
- package/assets/tree-sitter/VERSIONS.txt +0 -1
- package/assets/tree-sitter/tree-sitter-javascript.wasm +0 -0
- package/assets/tree-sitter/tree-sitter-python.wasm +0 -0
- package/assets/tree-sitter/tree-sitter-typescript.wasm +0 -0
- package/assets/tree-sitter/tree-sitter.js +0 -3980
- package/assets/tree-sitter/tree-sitter.wasm +0 -0
- package/lib/readme-templates/readme.yml +0 -38
- package/lib/vendor/js-yaml/LICENSE +0 -21
- package/lib/vendor/js-yaml/js-yaml.mjs +0 -3073
- package/scripts/scrub-user-wording.mjs +0 -420
package/lib/app/audit-api.js
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
import { buildRuleSlotMap } from '../audit/slot.js';
|
|
14
14
|
import { isBlockerFinding } from '../audit/index.js';
|
|
15
15
|
import { MAX_MSG_PREVIEW } from './constants.js';
|
|
16
|
+
import { probeRepoOwnership } from './repo-ownership.js';
|
|
16
17
|
|
|
17
18
|
/** 支持的聚合维度(非法值回落 rule)。 */
|
|
18
19
|
export const GROUP_BY_KEYS = ['rule', 'file', 'severity', 'slot'];
|
|
@@ -102,6 +103,7 @@ export async function runAuditApi(repo, params = {}, cfg = {}) {
|
|
|
102
103
|
const { scoreQuality } = await import('../score/index.js');
|
|
103
104
|
const scope = params.scope === 'diff' ? 'diff' : 'full';
|
|
104
105
|
const auditOpts = {
|
|
106
|
+
ownership: probeRepoOwnership(repo), // 隐私规则只对自有仓库生效(审计层只消费该字符串)
|
|
105
107
|
scope,
|
|
106
108
|
rulesetDir: params.rulesetDir || '',
|
|
107
109
|
maxScanFiles: params.maxScanFiles ?? cfg.maxScanFiles ?? 0,
|
package/lib/app/inject-text.js
CHANGED
|
@@ -35,7 +35,6 @@ export const FUNCTION_USAGE_HINT = [
|
|
|
35
35
|
'· git_remote_create —— 按项目文件夹在 GitHub 建远端仓库(已存在则复用),并把 origin 指向它。',
|
|
36
36
|
'· git_set_visibility —— 切换仓库 public/private。',
|
|
37
37
|
'· git_clone —— 从 GitHub clone 到本地(走 GitHub API,不直连 github.com)。',
|
|
38
|
-
' (README 生成已抽为独立脚本:`node scripts/readme-gen.mjs <repo> [--write <path>]`,见插件 skill 文档组织节)',
|
|
39
38
|
'· link_check —— 检查文档内链接有效性(只报 warning,不拦截)。',
|
|
40
39
|
'· npm_publish —— npm 发包(**后台 job**,返回 jobId 可用 job_output 查):默认 dryRun=true 只体检 + `npm publish --dry-run`(不写 registry ✗);真发必须同时传 confirm=true 与 dryRun=false(不可撤销,先 dryRun 看包内容)。参数:dir(目标包目录,缺省工作区)/ tag(默认 latest)/ otp(2FA)/ dryRun / confirm。',
|
|
41
40
|
'· git_sluice —— 浅包装 git 透传工具(AI 直接调用任意 git 命令,凭据自动注入):args 传与 git 完全一致的参数串(空格分隔,路径含空格用引号);例:git_sluice({args:"status --short"}) / git_sluice({args:"log --oneline -5"}) / git_sluice({args:"branch -a"})。返回 status + stdout/stderr。git 的其余能力(log/diff/branch/tag/remote 等)用它;高频写操作仍走 git_commit_push/git_clone 等专用工具(自带审计/门禁)。',
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 装配层 · 仓库归属探测(供审计的隐私规则判断「是不是自己的仓库」)
|
|
3
|
+
*
|
|
4
|
+
* 为什么放在这里而不是 `lib/audit/`:
|
|
5
|
+
* 判定归属需要「本机 GitHub 账号」+「仓库 remote」,两者都在 `lib/git/**`;而边界门禁
|
|
6
|
+
* (test-audit-git-boundary.mjs)禁止 `lib/audit/**` 依赖 git 层——审计要能脱离宿主独立使用。
|
|
7
|
+
* 故探测放在装配层,结果以**字符串**注入审计(依赖倒置);纯判定逻辑在
|
|
8
|
+
* `lib/audit/ownership.js`(零依赖、可单测)。
|
|
9
|
+
*
|
|
10
|
+
* 取数口径(都只读本地,不跑网络):
|
|
11
|
+
* · 本机 login:账号状态快照(token/ssh 的 login 字段,由账号检查写入,见 account-status.js);
|
|
12
|
+
* · 仓库 owner:`git remote -v` 的 fetch URL 解析(parseGithubUrl)。
|
|
13
|
+
* 判不出(无快照 / 无 GitHub remote)一律返回 'unknown' ⇒ 上游按「照旧生效」处理。
|
|
14
|
+
*
|
|
15
|
+
* 已知局限:组织仓库的 owner 是组织名而非个人 login ⇒ 判为 'foreign'(隐私规则关闭)。
|
|
16
|
+
* 方向是保守误伤(少报),不是漏报自家隐私;如需覆盖组织仓库,可在此扩展自有组织名单。
|
|
17
|
+
*/
|
|
18
|
+
import { listRemotes, parseGithubUrl } from '../git/remote-resolve.js';
|
|
19
|
+
import { readAccountStatus } from '../git/account-status.js';
|
|
20
|
+
import { classifyOwnership } from '../audit/ownership.js';
|
|
21
|
+
|
|
22
|
+
/** 同一仓库只探一次(remote 与账号快照都是磁盘读,逐文件审计时重复开销明显)。 */
|
|
23
|
+
const CACHE = new Map();
|
|
24
|
+
|
|
25
|
+
/** 本机 GitHub 登录名(小写;取不到返回空串)。 */
|
|
26
|
+
export function localLogin() {
|
|
27
|
+
try {
|
|
28
|
+
const st = readAccountStatus({});
|
|
29
|
+
const login = String(st?.token?.login || '') || String(st?.ssh?.login || '');
|
|
30
|
+
return login.trim().toLowerCase();
|
|
31
|
+
} catch {
|
|
32
|
+
return '';
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** 仓库 GitHub owner(小写;无 GitHub remote 返回空串)。 */
|
|
37
|
+
export function remoteOwner(repoPath) {
|
|
38
|
+
try {
|
|
39
|
+
const map = listRemotes(repoPath || '') || {};
|
|
40
|
+
for (const name of Object.keys(map)) {
|
|
41
|
+
const url = (map[name] && (map[name].fetch || map[name].push)) || '';
|
|
42
|
+
const parsed = parseGithubUrl(String(url || ''));
|
|
43
|
+
if (parsed && parsed.owner) return String(parsed.owner).trim().toLowerCase();
|
|
44
|
+
}
|
|
45
|
+
} catch { /* 非 git 目录 / 无 remote → 空串 */ }
|
|
46
|
+
return '';
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* 探测仓库归属(带进程内缓存)。
|
|
51
|
+
* @param {string} repoPath 仓库根目录
|
|
52
|
+
* @returns {'own'|'foreign'|'unknown'}
|
|
53
|
+
*/
|
|
54
|
+
export function probeRepoOwnership(repoPath = '') {
|
|
55
|
+
const key = String(repoPath || '');
|
|
56
|
+
if (CACHE.has(key)) return CACHE.get(key);
|
|
57
|
+
const verdict = classifyOwnership(localLogin(), remoteOwner(key));
|
|
58
|
+
CACHE.set(key, verdict);
|
|
59
|
+
return verdict;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** 清空缓存(测试用 / 账号切换后)。 */
|
|
63
|
+
export function resetRepoOwnershipCache() {
|
|
64
|
+
CACHE.clear();
|
|
65
|
+
}
|
package/lib/app/tool-call.js
CHANGED
|
@@ -35,6 +35,7 @@ import { buildAuditApiGuide } from './inject-text.js';
|
|
|
35
35
|
import { exemptStatsOf, GROUP_BY_KEYS } from './audit-api.js';
|
|
36
36
|
import { setLastSlotHitStats } from './slot-stats.js';
|
|
37
37
|
import { getDefaultScanRoot } from './scan-root.js';
|
|
38
|
+
import { probeRepoOwnership } from './repo-ownership.js';
|
|
38
39
|
|
|
39
40
|
/**
|
|
40
41
|
* 工具调用分发(薄适配:参数 → 总入口函数)。
|
|
@@ -448,6 +449,9 @@ function buildAuditOpts(args, cfg, scope) {
|
|
|
448
449
|
includeIgnored: args.includeIgnored === true,
|
|
449
450
|
// 分析覆盖率信息项(默认开;coverage:false 关闭——大仓库省一次读取+解析)
|
|
450
451
|
coverage: args.coverage !== false,
|
|
452
|
+
// 仓库归属:隐私/凭据类规则只对自有仓库生效(他人仓库等同关闭),见 lib/audit/ownership.js。
|
|
453
|
+
// 探测在装配层(依赖 git 层),审计层只消费这个字符串(边界门禁:lib/audit 不得依赖 lib/git)。
|
|
454
|
+
ownership: probeRepoOwnership(args.repo),
|
|
451
455
|
};
|
|
452
456
|
}
|
|
453
457
|
|
|
@@ -576,8 +580,8 @@ export async function callTool(toolName, args = {}, env = {}, cfg = defaultConfi
|
|
|
576
580
|
case 'code_audit':
|
|
577
581
|
return callCodeAudit(args, env, cfg, log, jobs, exec);
|
|
578
582
|
case 'git_gen_readme': {
|
|
579
|
-
// README
|
|
580
|
-
return { ok: false, error: 'git_gen_readme
|
|
583
|
+
// README 生成能力已整体下线(README 由 readme-spec 手工维护,不再按模板渲染)。
|
|
584
|
+
return { ok: false, error: 'git_gen_readme 已移除:README 由使用手册规范手工维护,不再提供模板生成' };
|
|
581
585
|
}
|
|
582
586
|
case 'git_clone': {
|
|
583
587
|
if (!args.target) return { ok: false, error: 'target 必填' };
|
package/lib/ast/io-risk-loop.js
CHANGED
|
@@ -35,7 +35,7 @@ export function isSmallLiteralCallee(tokens, methodIdx) {
|
|
|
35
35
|
* 识别 `const candidates = ['a']; if (x) candidates.push(b); for (const f of candidates)`
|
|
36
36
|
* 这类**候选路径探测**——它规模确定(≤ SMALL_FIXED_LOOP_MAX)、执行次数极少,
|
|
37
37
|
* 与字面量数组同义;不识别会导致「循环内 I/O 高风险」误报(实测 config.js /
|
|
38
|
-
*
|
|
38
|
+
* 文档生成脚本 / credentials.js 共 8 处候选探测全被误判)。
|
|
39
39
|
*
|
|
40
40
|
* 保守策略:只要出现字面量数组**之外**的写入方式(concat/splice/展开赋值等),
|
|
41
41
|
* 即视为规模未知,返回 false(宁可保守报高风险,也不放过真问题)。
|
package/lib/ast/tokenizer.js
CHANGED
|
@@ -179,7 +179,10 @@ function tokenizeUncached(text = '') {
|
|
|
179
179
|
// `const css = ` 后面紧跟换行(反引号正好在行尾)时,token 值就是**单个反引号**,
|
|
180
180
|
// endsWith('`') 为真 ⇒ 旧判据漏置跨行状态 ⇒ 模板正文(CSS/帮助文本)整段被当代码,
|
|
181
181
|
// CSS 里的 #141518 / #888 / 1.5 被 readability/magic-number-smart 当魔数误报。
|
|
182
|
-
|
|
182
|
+
// 判据补 startsWith('`'):C# 插值串产物同为 tmpl 但不含反引号,
|
|
183
|
+
// 不收紧会把其后所有行并进模板(实测整段被吞成一个 tmpl token)。
|
|
184
|
+
if (lastTok && lastTok.type === 'tmpl' && String(lastTok.value).startsWith('`')
|
|
185
|
+
&& String(lastTok.value).indexOf('`', 1) === -1) inTemplate = true;
|
|
183
186
|
i = res; continue;
|
|
184
187
|
}
|
|
185
188
|
// 标点 / 其他(单字符)
|
|
@@ -246,6 +249,11 @@ const REGEX_AFTER_KEYWORD = /^(?:return|typeof|case|in|of|new|delete|void|do|els
|
|
|
246
249
|
* 分支密集,全部内联在 while 里无法维护;按词素类型抽独立函数,主循环只做分派。
|
|
247
250
|
*/
|
|
248
251
|
function consumeLexeme(src, i, n, ch, next, tokens, push) { // dsh-skip-complexity: 词素分派器(六类词素分派分支为结构必然,拆分后职责单一)
|
|
252
|
+
// C# 插值串($"…" / $@"…" / @$"…")→ tmpl,须先于普通字符串与标识符分支判定
|
|
253
|
+
if (ch === '$' || ch === '@') {
|
|
254
|
+
const cs = consumeCsharpInterpolated(src, i, n, push);
|
|
255
|
+
if (cs) return cs;
|
|
256
|
+
}
|
|
249
257
|
// 字符串(' ")——普通单引号字符串;三引号(""" ''')由主循环专门处理
|
|
250
258
|
if (ch === '"' || ch === "'") return consumeString(src, i, n, ch, push);
|
|
251
259
|
// 模板字符串(`)——嵌套 ${} 简化处理:遇未闭合 ` 归并到行尾
|
|
@@ -284,6 +292,73 @@ function consumeLexeme(src, i, n, ch, next, tokens, push) { // dsh-skip-complexi
|
|
|
284
292
|
return 0;
|
|
285
293
|
}
|
|
286
294
|
|
|
295
|
+
/**
|
|
296
|
+
* C# 插值串(`$"…"` / `$@"…"` / `@$"…"`)—— 产出 `tmpl` 类型。
|
|
297
|
+
*
|
|
298
|
+
* 为什么:插值串里的 `{expr}` 是**表达式**而不是文本。若按普通字符串(`str`)处理,
|
|
299
|
+
* 「重复硬编码文本」统计会把表达式当成硬编码值参与计数(C# 语料实测 10/41 由此误报,
|
|
300
|
+
* 如 `$"<error: {ex.Message}>"` 被提成 `<error: {ex.Message}>`)。它在语义上与 JS 模板串
|
|
301
|
+
* 同类,故复用既有 `tmpl` 口径(该规则的提取器已刻意排除 `tmpl`)。
|
|
302
|
+
* 边界:
|
|
303
|
+
* · `@"…"`(verbatim 但**不插值**)是纯字面量,仍按 `str`,不在此处理;
|
|
304
|
+
* · verbatim 串内连续两个 `""` 表示一个转义引号,不构成闭合;
|
|
305
|
+
* · 插值洞 `{…}` 里可以再出现字符串(`$"{(c ? a : "null")}, "`),洞内的 `"` **不**结束
|
|
306
|
+
* 整个插值串,故必须按花括号深度判定——否则会在洞内第一个引号处截断,残留 `)}, "` 片段
|
|
307
|
+
* 又被当成普通字符串参与统计(实测该形态仍误报);
|
|
308
|
+
* · 转义的大括号 `{{` / `}}` 是字面量括号,不改变深度。
|
|
309
|
+
* @returns {number} 消费后的新下标;非插值串返回 0(交其它词素处理)
|
|
310
|
+
*/
|
|
311
|
+
function consumeCsharpInterpolated(src, i, n, push) { // dsh-skip-complexity: 三前缀组合 + 洞内嵌套串 + verbatim 转义
|
|
312
|
+
const three = src.slice(i, i + 3);
|
|
313
|
+
const two = src.slice(i, i + 2);
|
|
314
|
+
let quoteAt = -1;
|
|
315
|
+
if (three === '$@"' || three === '@$"') quoteAt = i + 2;
|
|
316
|
+
else if (two === '$"') quoteAt = i + 1;
|
|
317
|
+
if (quoteAt < 0) return 0;
|
|
318
|
+
const verbatim = src.slice(i, quoteAt).includes('@');
|
|
319
|
+
let j = quoteAt + 1;
|
|
320
|
+
let str = src.slice(i, quoteAt + 1);
|
|
321
|
+
let depth = 0;
|
|
322
|
+
const pushChar = () => { str += src[j]; j++; };
|
|
323
|
+
while (j < n) {
|
|
324
|
+
const ch = src[j];
|
|
325
|
+
if (depth > 0) {
|
|
326
|
+
// 洞内:花括号调节深度;字符串整段跳过(不参与闭合判定)
|
|
327
|
+
if (ch === '"') {
|
|
328
|
+
pushChar();
|
|
329
|
+
while (j < n) {
|
|
330
|
+
if (src[j] === '\\') { pushChar(); if (j < n) pushChar(); continue; }
|
|
331
|
+
const c2 = src[j];
|
|
332
|
+
pushChar();
|
|
333
|
+
if (c2 === '"') break;
|
|
334
|
+
}
|
|
335
|
+
continue;
|
|
336
|
+
}
|
|
337
|
+
if (ch === '{') { depth++; pushChar(); continue; }
|
|
338
|
+
if (ch === '}') { depth--; pushChar(); continue; }
|
|
339
|
+
pushChar();
|
|
340
|
+
continue;
|
|
341
|
+
}
|
|
342
|
+
if (!verbatim && ch === '\\') { pushChar(); if (j < n) pushChar(); continue; }
|
|
343
|
+
if (ch === '{') {
|
|
344
|
+
if (src[j + 1] === '{') { pushChar(); pushChar(); continue; } // {{ 转义,不计深度
|
|
345
|
+
depth++; pushChar(); continue;
|
|
346
|
+
}
|
|
347
|
+
if (ch === '}') {
|
|
348
|
+
if (src[j + 1] === '}') { pushChar(); pushChar(); continue; } // }} 转义,不计深度
|
|
349
|
+
pushChar(); continue;
|
|
350
|
+
}
|
|
351
|
+
if (ch === '"') {
|
|
352
|
+
if (verbatim && src[j + 1] === '"') { pushChar(); pushChar(); continue; }
|
|
353
|
+
pushChar();
|
|
354
|
+
break;
|
|
355
|
+
}
|
|
356
|
+
pushChar();
|
|
357
|
+
}
|
|
358
|
+
push('tmpl', str);
|
|
359
|
+
return j;
|
|
360
|
+
}
|
|
361
|
+
|
|
287
362
|
/** 字符串字面量(' ")——遇转义 \ 跳两字符;未闭合归并到行尾。 */
|
|
288
363
|
function consumeString(src, i, n, ch, push) {
|
|
289
364
|
let j = i + 1;
|
package/lib/ast/treesitter.js
CHANGED
|
@@ -8,8 +8,12 @@
|
|
|
8
8
|
* 为什么这么设计:审计是提交门禁的一部分,**不能因为增强件坏了就整体失效** ✗。
|
|
9
9
|
* 回退不是异常路径,而是常态路径之一 ✓。
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
11
|
+
* 来源:**npm 依赖**——`web-tree-sitter@0.25.10`(运行时 + 它的 tree-sitter.wasm)与
|
|
12
|
+
* `tree-sitter-wasms@0.1.13`(各语言预编译 grammar,MIT)。仓库内不再保存任何 vendored 副本。
|
|
13
|
+
* 两者**必须精确锁版**:实测 web-tree-sitter@0.27.1 与本套语法 ABI 不兼容
|
|
14
|
+
* (在 getDylinkMetadata 处报空消息错误)⇒ 升版会让 AST 全线静默降级。
|
|
15
|
+
* 解析顺序(三级):`DSH_GIT_PUSH_TS_ASSETS` env 覆盖 → npm 包目录 → 两者都拿不到即返回「不可用」,
|
|
16
|
+
* 由调用方回退 token 级判定。
|
|
13
17
|
*
|
|
14
18
|
* 语言口径(既定口径):**加载哪些语言 = lib/audit-rules/ 里存在哪些语言规则包**
|
|
15
19
|
* (**空占位包也算**:cpp/go/php/rust/swift)。语法文件不存在时该语言自动走回退 ✓。
|
|
@@ -19,17 +23,59 @@ import { createHash } from 'node:crypto';
|
|
|
19
23
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
20
24
|
import { dirname, join } from 'node:path';
|
|
21
25
|
|
|
22
|
-
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
export const ASSETS_DIR = process.env.DSH_GIT_PUSH_TS_ASSETS
|
|
26
|
-
|
|
26
|
+
/** env 覆盖的外部目录:内含 tree-sitter.js / tree-sitter.wasm / tree-sitter-<lang>.wasm。
|
|
27
|
+
* **回退路径测试**把它指向不存在的目录即可(测试不碰真实依赖 ✗);运维也可用它把资产指到别处。
|
|
28
|
+
* 在模块加载时求值,测试需用子进程改 env ✓ */
|
|
29
|
+
export const ASSETS_DIR = process.env.DSH_GIT_PUSH_TS_ASSETS || '';
|
|
30
|
+
|
|
31
|
+
/** 包目录(解析失败为空串 ⇒ 上层按「不可用」回退)。 */
|
|
32
|
+
let runtimeDir = null;
|
|
33
|
+
let grammarsDir = null;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 定位两个依赖包目录。
|
|
37
|
+
*
|
|
38
|
+
* 用 `import.meta.resolve` 而不是 `require.resolve`:本模块是 ESM,且 require 需要 createRequire 垫片。
|
|
39
|
+
* web-tree-sitter 有 exports 字段,`resolve('web-tree-sitter')` 拿到的是 **ESM 入口**
|
|
40
|
+
* tree-sitter.js(实测),取其 dirname 即包目录,`tree-sitter.wasm` 就在同级 ✓;
|
|
41
|
+
* `web-tree-sitter/package.json` 反而**不在 exports 白名单里**(ERR_PACKAGE_PATH_NOT_EXPORTED)⇒
|
|
42
|
+
* 想拿包目录只能由入口路径回溯,不要改成解析 package.json。
|
|
43
|
+
* tree-sitter-wasms 无 exports 字段 ⇒ 子路径可自由解析(这里解析一个必然存在的语法作为锚)。
|
|
44
|
+
* @returns {{runtimeDir: string, grammarsDir: string}}
|
|
45
|
+
*/
|
|
46
|
+
function resolveDirs() {
|
|
47
|
+
if (runtimeDir !== null && grammarsDir !== null) return { runtimeDir, grammarsDir };
|
|
48
|
+
const pick = (spec) => {
|
|
49
|
+
try { return dirname(fileURLToPath(import.meta.resolve(spec))); } catch { return ''; }
|
|
50
|
+
};
|
|
51
|
+
if (runtimeDir === null) runtimeDir = pick('web-tree-sitter');
|
|
52
|
+
if (grammarsDir === null) grammarsDir = pick('tree-sitter-wasms/out/tree-sitter-javascript.wasm');
|
|
53
|
+
// env 覆盖优先:指向一个「runtime 与语法同级」的目录(回退实验与运维换源都走这里)
|
|
54
|
+
if (ASSETS_DIR) { runtimeDir = ASSETS_DIR; grammarsDir = ASSETS_DIR; }
|
|
55
|
+
return { runtimeDir, grammarsDir };
|
|
56
|
+
}
|
|
27
57
|
|
|
28
58
|
/** 扩展名 → 语法名(grammar)。没有映射的扩展名一律走回退 ✓。 */
|
|
29
59
|
export const EXT_TO_GRAMMAR = {
|
|
30
60
|
js: 'javascript', mjs: 'javascript', cjs: 'javascript', jsx: 'javascript',
|
|
31
61
|
ts: 'typescript', tsx: 'typescript', mts: 'typescript', cts: 'typescript',
|
|
32
62
|
py: 'python',
|
|
63
|
+
// ── 规则包早已存在、此前一直无语法树(走 token 级回退)的语言 ──
|
|
64
|
+
// 语法名以 tree-sitter-wasms@0.1.13 的 out/ 里**实际存在的文件名**为准(逐个核对过,不凭记忆写)。
|
|
65
|
+
// C# 的内部名带下划线:写成 csharp 会去找不存在的 wasm ⇒ 静默回退,规则表现成「看起来接不通」。
|
|
66
|
+
cs: 'c_sharp',
|
|
67
|
+
c: 'c',
|
|
68
|
+
cpp: 'cpp', cc: 'cpp', cxx: 'cpp', hpp: 'cpp', hh: 'cpp', hxx: 'cpp',
|
|
69
|
+
// .h 归属取 cpp 而非 c:C 与 C++ 共用该扩展名,cpp 语法是 C 的超集。
|
|
70
|
+
// 交给 c 语法时,合法 C++ 头文件会解析出 ERROR ⇒ 整棵树作废退回 token 级(等于白接);
|
|
71
|
+
// 反过来把纯 C 头交给 cpp 语法不会报错(C 是子集)。
|
|
72
|
+
h: 'cpp',
|
|
73
|
+
go: 'go',
|
|
74
|
+
java: 'java',
|
|
75
|
+
kt: 'kotlin',
|
|
76
|
+
php: 'php', phtml: 'php',
|
|
77
|
+
rs: 'rust',
|
|
78
|
+
swift: 'swift',
|
|
33
79
|
};
|
|
34
80
|
|
|
35
81
|
/** 单文件解析预算(字符数):超此长度不解析,直接回退(避免大文件拖慢审计)。 */
|
|
@@ -47,14 +93,20 @@ const treeCache = new Map(); // hash → tree(简单 FIFO 淘汰)
|
|
|
47
93
|
/** 资产是否就位(供调用方与自检使用)。 */
|
|
48
94
|
export function treesitterAvailable() {
|
|
49
95
|
try {
|
|
50
|
-
|
|
96
|
+
const { runtimeDir: rd } = resolveDirs();
|
|
97
|
+
if (!rd) return false;
|
|
98
|
+
// env 覆盖模式下 runtime 是目录里的 tree-sitter.js;npm 模式下入口由 exports 决定
|
|
99
|
+
// (tree-sitter.js / tree-sitter.mjs 都可能),故只校验「能拿到 ESM 入口 + 同级 wasm」。
|
|
100
|
+
return existsSync(join(rd, 'tree-sitter.wasm'));
|
|
51
101
|
} catch { return false; }
|
|
52
102
|
}
|
|
53
103
|
|
|
54
104
|
/** 当前资产里实际可用的语法名列表(按目录里存在的 wasm 推断)。 */
|
|
55
105
|
export function availableGrammars() {
|
|
56
106
|
try {
|
|
57
|
-
|
|
107
|
+
const { grammarsDir: gd } = resolveDirs();
|
|
108
|
+
if (!gd) return [];
|
|
109
|
+
return readdirSync(gd)
|
|
58
110
|
.map((f) => /^tree-sitter-(.+)\.wasm$/.exec(f))
|
|
59
111
|
.filter(Boolean)
|
|
60
112
|
.map((m) => m[1])
|
|
@@ -73,7 +125,15 @@ export function grammarForExt(ext = '') {
|
|
|
73
125
|
* tree-sitter-wasms@0.1.13 的语法不兼容 —— 实测 0.27.1 在 getDylinkMetadata 处报空消息错误 ✗)。 */
|
|
74
126
|
async function loadModule() {
|
|
75
127
|
if (!modPromise) {
|
|
76
|
-
|
|
128
|
+
// 两种布局:
|
|
129
|
+
// · npm 依赖 → 裸 specifier,让 ESM loader 按包的 exports 取 ESM 入口(0.25.10 → ./tree-sitter.js);
|
|
130
|
+
// · vendored / env 覆盖目录 → 目录里就有 tree-sitter.js,必须按文件路径加载,
|
|
131
|
+
// 否则在「只拷了插件目录、没装 dependencies」的部署端会 import 失败(实测过:语法读得到、runtime 拿不到)。
|
|
132
|
+
const { runtimeDir: rd } = resolveDirs();
|
|
133
|
+
const vendoredRuntime = rd ? join(rd, 'tree-sitter.js') : '';
|
|
134
|
+
modPromise = vendoredRuntime && existsSync(vendoredRuntime)
|
|
135
|
+
? import(pathToFileURL(vendoredRuntime).href)
|
|
136
|
+
: import('web-tree-sitter');
|
|
77
137
|
}
|
|
78
138
|
return modPromise;
|
|
79
139
|
}
|
|
@@ -83,8 +143,11 @@ async function ensureInit() {
|
|
|
83
143
|
if (!initPromise) {
|
|
84
144
|
initPromise = (async () => {
|
|
85
145
|
const { Parser } = await loadModule();
|
|
86
|
-
// locateFile:告诉运行时去哪里取 web-tree-sitter.wasm(默认会按 URL
|
|
87
|
-
|
|
146
|
+
// locateFile:告诉运行时去哪里取 web-tree-sitter.wasm(默认会按 URL 猜,容器里不可靠)。
|
|
147
|
+
// 目录来自 resolveDirs()(npm 包目录或 env 覆盖目录)——不能写死 ASSETS_DIR:
|
|
148
|
+
// 无 env 覆盖时它是空串,join('', f) 会退化成相对路径 ⇒ ENOENT(改这行时踩过)。
|
|
149
|
+
const { runtimeDir: rd } = resolveDirs();
|
|
150
|
+
await Parser.init({ locateFile: (f) => (rd ? join(rd, f) : f) });
|
|
88
151
|
return true;
|
|
89
152
|
})().catch(() => null);
|
|
90
153
|
}
|
|
@@ -93,7 +156,8 @@ async function ensureInit() {
|
|
|
93
156
|
|
|
94
157
|
/** 取(并缓存)某语言的 Parser;不可用返回 null。 */
|
|
95
158
|
async function getParser(grammar) {
|
|
96
|
-
|
|
159
|
+
const { grammarsDir: gd } = resolveDirs();
|
|
160
|
+
if (!grammar || !gd || !existsSync(join(gd, `tree-sitter-${grammar}.wasm`))) return null;
|
|
97
161
|
if (parserCache.has(grammar)) return parserCache.get(grammar);
|
|
98
162
|
try {
|
|
99
163
|
if (!(await ensureInit())) return null;
|
|
@@ -102,7 +166,7 @@ async function getParser(grammar) {
|
|
|
102
166
|
if (!lang) {
|
|
103
167
|
// 传**字节**而不是路径:0.27.x 的 load(路径) 会静默失败(Node 分支虽会 readFile,但 dylink 不兼容);
|
|
104
168
|
// 字节是唯一被实测验证可用的入口(0.25.10 ✓)
|
|
105
|
-
lang = await Language.load(readFileSync(join(
|
|
169
|
+
lang = await Language.load(readFileSync(join(gd, `tree-sitter-${grammar}.wasm`)));
|
|
106
170
|
langCache.set(grammar, lang);
|
|
107
171
|
}
|
|
108
172
|
const parser = new Parser();
|
package/lib/audit/audit-file.js
CHANGED
|
@@ -2,6 +2,7 @@ import { runChecks } from './checks.js';
|
|
|
2
2
|
import { exemptForFinding } from '../exempt/index.js';
|
|
3
3
|
import { hasExternalCallTimeout, hasMkdirInSameFunction, hasForeignWriteTarget } from './file-context.js';
|
|
4
4
|
import { CODE_EXTS } from './finding.js';
|
|
5
|
+
import { privacyRulesEnabled, isPrivacyRule } from './ownership.js';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* 单文件审计:读文件 → 跑检查 → 豁免过滤(注册表驱动,7 标记全消费)。
|
|
@@ -132,7 +133,20 @@ export function auditFile({ file, relPath, text, grouped }, opts = {}) {
|
|
|
132
133
|
const isTestFile = /(^|[/\\])(test|tests|__tests__|spec)[/\\]|\.(test|spec)\.(js|mjs|cjs|ts)$/i.test(String(relPath || file));
|
|
133
134
|
const maintainabilityScoped = !isCode || isTestFile;
|
|
134
135
|
const scopedGrouped = maintainabilityScoped ? { ...grouped, 'repeated-string': undefined, 'min-occurrences': undefined } : grouped;
|
|
135
|
-
|
|
136
|
+
// 隐私/凭据类规则只对**自有仓库**生效:克隆来的他人仓库里有什么邮箱/密钥与本次提交无关,
|
|
137
|
+
// 报出来是纯噪声(实测:某第三方 Unity 项目 3 条 blocker 全是 LICENSE 里的作者邮箱)。
|
|
138
|
+
// 判不出归属('unknown')时照旧生效——保守方向:宁可多报,不可漏掉自家隐私。
|
|
139
|
+
const privacyOn = privacyRulesEnabled(opts?.ownership);
|
|
140
|
+
const finalGrouped = privacyOn ? scopedGrouped : (() => {
|
|
141
|
+
const stripped = {};
|
|
142
|
+
for (const [kind, rules] of Object.entries(scopedGrouped || {})) {
|
|
143
|
+
if (!Array.isArray(rules)) { stripped[kind] = rules; continue; }
|
|
144
|
+
const keep = rules.filter((r) => !isPrivacyRule(r?.id));
|
|
145
|
+
if (keep.length) stripped[kind] = keep;
|
|
146
|
+
}
|
|
147
|
+
return stripped;
|
|
148
|
+
})();
|
|
149
|
+
let findings = runChecks({ file, relPath, text, grouped: finalGrouped }, { level: opts?.level, repoHasJsYamlImport: opts?.repoHasJsYamlImport, repoLevelRules: opts?.repoLevelRules, repoPath: opts?.repoPath, treeConfirm: opts?.treeConfirm });
|
|
136
150
|
const isRuleDefFile = /(^|[/\\])audit-rules-[a-z0-9-]+\.ya?ml$/i.test(String(relPath || file));
|
|
137
151
|
const fileLines = String(text || '').split('\n');
|
|
138
152
|
// 语义级豁免:纯 regex 规则看不到的上下文在此兜底——
|
package/lib/audit/collector.js
CHANGED
|
@@ -17,7 +17,7 @@ import { GIT_GLOBAL_ARGS } from '../core/exec.js';
|
|
|
17
17
|
/** 跳过目录集合 = 硬编码基线(node_modules/.git) ∪ yml 黑名单关键词(加载一次缓存)。 */
|
|
18
18
|
const SKIP_DIRS = getSkipSet();
|
|
19
19
|
|
|
20
|
-
const TEXT_EXT = new Set([
|
|
20
|
+
export const TEXT_EXT = new Set([
|
|
21
21
|
'js', 'mjs', 'cjs', 'ts', 'tsx', 'jsx', 'json', 'yml', 'yaml', 'md', 'txt', 'html', 'css',
|
|
22
22
|
'sh', 'py', 'rb', 'go', 'rs', 'java', 'c', 'cpp', 'h', 'hpp', 'xml', 'toml', 'ini', 'cfg',
|
|
23
23
|
'conf', 'env', 'gitignore', 'npmrc', 'properties', 'sql', 'vue', 'svelte',
|
|
@@ -25,6 +25,14 @@ const TEXT_EXT = new Set([
|
|
|
25
25
|
// ⇒ 这两个语言的文件从来没进过审计管道,规则写了也永远 0 命中(实测合成样例 0 命中定位到此处)。
|
|
26
26
|
// phtml 是 PHP 模板扩展名(同 PHP 槽位 exts),kt 与 java 槽位共用一个包。
|
|
27
27
|
'php', 'phtml', 'swift', 'kt',
|
|
28
|
+
// 2026-10-29 补:C# 与 C/C++ 的其余常见扩展名。
|
|
29
|
+
// .cs 此前不在白名单 ⇒ C# 文件**完全不进审计管道**(668 个 .cs 的全量审计只收到 26 个非 .cs 文件);
|
|
30
|
+
// cc/cxx/hh/hxx 同理——EXT_TO_GRAMMAR 里映射了语法,但白名单不放行的话文件根本到不了解析那一步。
|
|
31
|
+
// 这两处必须同时改:只补映射 = 语法永远用不上,只补白名单 = 一直走 token 级回退。
|
|
32
|
+
'cs', 'cc', 'cxx', 'hh', 'hxx',
|
|
33
|
+
// mts/cts 是 TypeScript 的模块变体扩展名:EXT_TO_GRAMMAR 早已映射到 typescript 语法,
|
|
34
|
+
// 但这里一直没放行 ⇒ 文件不进管道(与 .cs 同一类缺口)。wasms 里没有独立语法,复用 typescript 即可。
|
|
35
|
+
'mts', 'cts',
|
|
28
36
|
]);
|
|
29
37
|
/** git 探活 / 忽略清单批量判定 / 单目录判定 的超时(毫秒)。 */
|
|
30
38
|
const GIT_PROBE_TIMEOUT_MS = 10_000;
|
package/lib/audit/finding.js
CHANGED
|
@@ -90,4 +90,11 @@ export function summarize(findings = []) {
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
/** 代码文件扩展名(residue/style 类检查只对代码生效,修规则定义/文档自举假阳性)。 */
|
|
93
|
-
export const CODE_EXTS = new Set([
|
|
93
|
+
export const CODE_EXTS = new Set([
|
|
94
|
+
'js', 'mjs', 'cjs', 'ts', 'tsx', 'jsx', 'py', 'go', 'rs', 'java', 'kt', 'swift', 'php', 'rb', 'sh', 'bash',
|
|
95
|
+
// C / C++ / C#:这些扩展名早就在 collect 的 TEXT_EXT 白名单里、也已有 cpp 规则包,
|
|
96
|
+
// 但一直没进本表 ⇒ audit-file 判它们为「非代码文件」、semantic 类检查直接整体跳过,
|
|
97
|
+
// 等于把 C/C++/C# 当文档审(既有缺口,不是本轮新引入)。
|
|
98
|
+
// phtml 是 PHP 模板(php 已在表内,同语言不同扩展名不能只放一半)。
|
|
99
|
+
'c', 'cc', 'cxx', 'cpp', 'h', 'hpp', 'hh', 'hxx', 'cs', 'phtml',
|
|
100
|
+
]);
|
package/lib/audit/orchestrate.js
CHANGED
|
@@ -224,6 +224,7 @@ async function auditFiles(repoPath, files, opts = {}) {
|
|
|
224
224
|
level: opts.auditLevel, repoHasJsYamlImport, repoPath,
|
|
225
225
|
repoLevelRules: skipRepoLevel ? repoLevelRules : null,
|
|
226
226
|
treeConfirm,
|
|
227
|
+
ownership: opts.ownership, // 仓库归属('own'|'foreign'|'unknown'):由装配层探测注入,审计层不读 git
|
|
227
228
|
}));
|
|
228
229
|
}
|
|
229
230
|
// 跨文件重复代码检测(maintainability/no-duplicate-code,该抽公共函数)。
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 审计层 · 隐私规则的生效范围(按仓库归属)
|
|
3
|
+
*
|
|
4
|
+
* 为什么需要(2026-10-28 用户确立的口径):
|
|
5
|
+
* 隐私/凭据类规则(secret-email、credfile-*、credref-* …)的**目的**是防止**自己的仓库**
|
|
6
|
+
* 把隐私推到远端。克隆来的第三方公开仓库里有什么邮箱/密钥,与你无关:报出来是纯粹噪声,
|
|
7
|
+
* 而且常常成片出现(实测:克隆一个 Unity 项目直接 3 条 blocker,全是第三方 LICENSE 里的
|
|
8
|
+
* 作者邮箱——版权文件含作者邮箱是法律要求,根本不是隐私泄漏)。
|
|
9
|
+
* 故:**隐私类规则只在「自己的仓库」生效;别人的 git 仓库等同关闭。**
|
|
10
|
+
*
|
|
11
|
+
* 为什么这里只放纯函数(架构约束):
|
|
12
|
+
* `lib/audit/**` 不得依赖 `lib/git/**`(边界门禁 test-audit-git-boundary.mjs:审计按独立包
|
|
13
|
+
* 设计,要能脱离宿主使用)。而「取本机账号 + 读 remote」必然依赖 git 层 ⇒ 探测放在**装配层**
|
|
14
|
+
* `lib/app/repo-ownership.js`,结果以**字符串**经 opts 注入进来(依赖倒置)。
|
|
15
|
+
* 本模块因此零 import、零副作用,可在任何环境下单测。
|
|
16
|
+
*
|
|
17
|
+
* 判据语义:'own'=自有(生效)|'foreign'=他人(关闭)|'unknown'=判不出(**照旧生效**——
|
|
18
|
+
* 保守方向:宁可多报,不可漏掉自家隐私)。
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 纯函数:由「本机 login」与「仓库 owner」判归属。
|
|
23
|
+
* @param {string} login 本机 GitHub 登录名(空串 = 未知)
|
|
24
|
+
* @param {string} owner 仓库 remote 解析出的 owner(空串 = 未知)
|
|
25
|
+
* @returns {'own'|'foreign'|'unknown'}
|
|
26
|
+
*/
|
|
27
|
+
export function classifyOwnership(login = '', owner = '') {
|
|
28
|
+
const me = String(login || '').trim().toLowerCase();
|
|
29
|
+
const them = String(owner || '').trim().toLowerCase();
|
|
30
|
+
if (!me || !them) return 'unknown';
|
|
31
|
+
return them === me ? 'own' : 'foreign';
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* 隐私/凭据类规则是否应在该仓库生效。
|
|
36
|
+
* @param {'own'|'foreign'|'unknown'} [ownership] 归属(缺省/undefined 按 unknown 处理 ⇒ 生效)
|
|
37
|
+
* @returns {boolean} true = 生效;false = 他人仓库,关闭
|
|
38
|
+
*/
|
|
39
|
+
export function privacyRulesEnabled(ownership) {
|
|
40
|
+
return ownership !== 'foreign';
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** 规则 id 是否属隐私/凭据类(这类规则受归属限制)。 */
|
|
44
|
+
export function isPrivacyRule(ruleId) {
|
|
45
|
+
return /^(secret-|credfile-|credref-)/.test(String(ruleId || ''));
|
|
46
|
+
}
|
package/lib/audit/report-yaml.js
CHANGED
|
@@ -5,7 +5,11 @@
|
|
|
5
5
|
* 供 CLI --json / 插件工具 code_audit 返回体携带,便于人读与机器解析。
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
// js-yaml 走 npm 依赖(仓库内不保存副本)。
|
|
9
|
+
// 这里**故意用静态 import**:规则加载是启动关键路径,依赖没装上就应当在模块加载期
|
|
10
|
+
// 抛 ERR_MODULE_NOT_FOUND(错误里带包名,够响亮),而不是被 try/catch 吞成「0 条规则」
|
|
11
|
+
// 继续跑——静默无规则比启动失败更危险(口径见 docs/2026-10-28-弃零依赖引入npm与AST优先规则方案.MD D5)。
|
|
12
|
+
import { dump as yamlDump } from 'js-yaml';
|
|
9
13
|
|
|
10
14
|
/** 拦截级别顺序(聚合时按此排布;未知级别归入其他)。 */
|
|
11
15
|
const SEVERITY_ORDER = ['blocker', 'warning', 'notice', 'info'];
|
|
@@ -156,74 +156,6 @@ rules:
|
|
|
156
156
|
- "@date"
|
|
157
157
|
fixable: false
|
|
158
158
|
|
|
159
|
-
# ----- 清洗改写表(scrub-user-wording.mjs 读取;审计不消费)-----
|
|
160
|
-
# 顺序敏感:先特例后通配。match 为 JS 正则源码(脚本加 g 标志)。
|
|
161
|
-
# replace 为替换模板:$1/$2… 对应捕获组;空串=删除。
|
|
162
|
-
rewrites:
|
|
163
|
-
# 1) 括注「用户原话」→ 删除括注,后续冒号保留
|
|
164
|
-
- match: "(用户原话)"
|
|
165
|
-
replace: ""
|
|
166
|
-
- match: "\\(用户原话\\)"
|
|
167
|
-
replace: ""
|
|
168
|
-
# 2) 日期 + 措辞 → 只留日期
|
|
169
|
-
- match: "(\\d{4}-\\d{2}-\\d{2}) 用户要求("
|
|
170
|
-
replace: "$1("
|
|
171
|
-
- match: "(\\d{4}-\\d{2}-\\d{2}) 用户要求加回"
|
|
172
|
-
replace: "$1 加回"
|
|
173
|
-
- match: "(\\d{4}-\\d{2}-\\d{2}) 用户要求:"
|
|
174
|
-
replace: "$1:"
|
|
175
|
-
- match: "(\\d{4}-\\d{2}-\\d{2}) 用户要求"
|
|
176
|
-
replace: "$1"
|
|
177
|
-
- match: "(\\d{4}-\\d{2}-\\d{2}) 用户原话:"
|
|
178
|
-
replace: "$1:"
|
|
179
|
-
- match: "(\\d{4}-\\d{2}-\\d{2}) 用户约定:"
|
|
180
|
-
replace: "$1:"
|
|
181
|
-
- match: "(\\d{4}-\\d{2}-\\d{2}) 用户确立"
|
|
182
|
-
replace: "$1"
|
|
183
|
-
- match: "(\\d{4}-\\d{2}-\\d{2}) 用户确认"
|
|
184
|
-
replace: "$1"
|
|
185
|
-
- match: "(\\d{4}-\\d{2}-\\d{2}) 用户同意"
|
|
186
|
-
replace: "$1"
|
|
187
|
-
# 3) 措辞 + 「内容」 → 「内容」(引号内容保留)
|
|
188
|
-
- match: "用户原话[::]?「"
|
|
189
|
-
replace: "「"
|
|
190
|
-
- match: "用户原话「"
|
|
191
|
-
replace: "「"
|
|
192
|
-
# 4) (用户要求…) → (…
|
|
193
|
-
- match: "(用户要求[::]?"
|
|
194
|
-
replace: "("
|
|
195
|
-
- match: "\\(用户要求[::]?"
|
|
196
|
-
replace: "("
|
|
197
|
-
# 5) 「用户要求恢复此形态」→ 删除
|
|
198
|
-
- match: "用户要求恢复此形态"
|
|
199
|
-
replace: ""
|
|
200
|
-
# 6) 孤立措辞 → 删除
|
|
201
|
-
- match: "用户要求[::]?"
|
|
202
|
-
replace: ""
|
|
203
|
-
- match: "用户原话[::]?"
|
|
204
|
-
replace: ""
|
|
205
|
-
- match: "用户约定[::]?"
|
|
206
|
-
replace: ""
|
|
207
|
-
- match: "用户规定[::]?"
|
|
208
|
-
replace: ""
|
|
209
|
-
- match: "用户明确[::]?"
|
|
210
|
-
replace: ""
|
|
211
|
-
- match: "用户拍板[::]?"
|
|
212
|
-
replace: ""
|
|
213
|
-
- match: "用户确立[::]?"
|
|
214
|
-
replace: ""
|
|
215
|
-
- match: "用户确认[::]?"
|
|
216
|
-
replace: ""
|
|
217
|
-
- match: "用户同意[::]?"
|
|
218
|
-
replace: ""
|
|
219
|
-
- match: "用户许可[::]?"
|
|
220
|
-
replace: ""
|
|
221
|
-
- match: "用户说[::]?"
|
|
222
|
-
replace: ""
|
|
223
|
-
- match: "用户:"
|
|
224
|
-
replace: ""
|
|
225
|
-
|
|
226
|
-
# ----- 严重级别 -----
|
|
227
159
|
severity_map:
|
|
228
160
|
info: "info"
|
|
229
161
|
|