progmune-runtime 3.7.1 → 3.7.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/CHANGELOG.md CHANGED
@@ -1,5 +1,43 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.7.3] — 2026-08-24
4
+
5
+ ### 文档全量一致性审计
6
+
7
+ - 全仓文档与当前进度核对并修正:
8
+ - **CLAUDE.md**:Current coverage reality 更新至 2026-08-24(TS 795 gold 98.5%/100%、Python ✅ 生产级、C ⚠️);"Python/Go/Java planned"→"TS + Python production";"Don't add TS rules"禁令改按现行基准表述;P0-P3 标注历史阶段;架构表补 `src/call-sequence.ts`(P4.6)、Protocol Detector 标注为正则回退;SDK 导出修正为 verify/explain/getCompatibility
9
+ - **README 双语**:P0-P3 数字统一为权威口径(+31 规则/+86 轨迹/+13 检测器/+11 防护,另 +19 检测);21→27 命名空间;架构图 Protocol Detector 标注正则回退 + 补 P4.6 调用序列层
10
+ - **覆盖矩阵双语**:C 列 Connection 按图例降 ⚠️(极高误报率),汇总 ✅×4/⚠️×4;IR 层补 3.7.1 恢复 IR-first + 词段门控注记;日期 08-24
11
+ - **BASELINE_PROTOCOL_PYTHON_v1.md**:标题升 v1.2(文件名兼容保留);风格表补 S5 行
12
+ - **BASELINE_v6.md**:reset_password"已检出/未覆盖"矛盾消歧(md5 形状已检出、其他形状无规则);TS precision 99.1%(8-15 波次)与 100%(8-16 打磨后)口径注明
13
+ - **QUICK_START.md**:npx 子命令(发布包中不存在)改为真实入口(MCP / GitHub Action / 仓库 CLI);覆盖表对齐覆盖矩阵
14
+ - **API_REFERENCE.md**:按真实表面重写——SDK 仅 verify/explain/getCompatibility(verify 为同步单参、VerificationResult 字段如实列出);npm bin = MCP server(工具清单);仓库 CLI scripts 表;环境变量表保留
15
+ - **RUNTIME_ARCHITECTURE.md**:7 protocol definitions→27 命名空间/148 规则;业务指标表过时数字(FPR 97%、F1 27-41%)改为现行基准(0 FP、TS 98.5%/100%、C F1 16.5%)
16
+ - **项目全解.html**:hero 版本 v3.2.0→v3.7.2;21→27 命名空间(2 处);85.2% F1 旧数字→现行基准;5.7 基准表补协议盲测 v1.2 行;6.1 产品形态补社区双渠道机器人
17
+ - **投资人白皮书_v3.2.html**:Python"未激活"→✅;144→148 规则(2 处);PrintLab 案例对齐最终态(46→0 违规、44→87 APPROVED);P2 待办 Python/Go→Go/Java;里程碑表补 3.7 行;"当前能力(v3.2)"标注最新 npm 3.7.2
18
+
19
+ ### 修复
20
+
21
+ - `src/sdk.ts` `RUNTIME_VERSION` 1.0.0 → 3.7.2(verify() 输出的运行时版本与发布版本对齐)
22
+
23
+ ## [3.7.2] — 2026-08-23
24
+
25
+ ### 新增:社区双渠道自动回复机器人(微信 + WhatsApp)
26
+
27
+ - **微信公众号自动回复 Bot**(`wechat-bot/`):零依赖 Node webhook——公众号开发者模式服务器配置(sha1 签名校验、安全模式 AES-256-CBC 加解密、被动回复 5s 窗口)、关键词规则自动回复(与 whatsapp-bot 同规则)、关注欢迎语;`Dockerfile`/`fly.toml` 部署模板 + 本地冒烟文档
28
+ - **WhatsApp 自动回复 Bot**(`whatsapp-bot/`,补录):零依赖 Node webhook——Meta webhook 握手、Graph API 回复、可选 `X-Hub-Signature-256` 签名校验、关键词规则自动回复;`Dockerfile`/`fly.toml` 部署模板 + 本地冒烟文档
29
+ - **「群」指令升级为二维码图片消息**:新增合成图 `assets/community-qr.png`(微信 + WhatsApp 群码并排);公众号侧经 access_token + 临时素材上传回图片消息(3 天有效、到期自动重传,未配置 `WEIXIN_APP_SECRET` 时回文字版指引);WhatsApp 侧直接发送图片链接
30
+ - README(中英)「社区与反馈」章节注明双渠道自动回复已上线:关注公众号 / 向官方号码发送「帮助」查看全部指令
31
+ - 回复规则双端同步维护;版本号硬编码于规则内,发版后需同步(`RULES` 数组)
32
+
33
+ ### 修复:微信安全模式 AES 加解密 IV 规范
34
+
35
+ - 对齐官方 WXBizMsgCrypt:**IV = AES 密钥前 16 字节、密文不带 IV 前缀**(此前误按"IV = 密文前 16 字节"导致解密错位 16 字节、`msgLen` 读出乱码、`appid mismatch`)
36
+
37
+ ### 文档
38
+
39
+ - CHANGELOG 悬空项收口:3.6.0「二维码占位待替换」补注 3.6.1 已换真实群码;3.7.0「合并形态 IR-first 待恢复」补注 3.7.1 已完成;3.4.0「check 失败待单独排期」补注 3.4.1 已修复
40
+
3
41
  ## [3.7.1] — 2026-08-23
4
42
 
5
43
  ### 修复:词段匹配门控(仅项目函数适用)
@@ -20,7 +58,7 @@
20
58
 
21
59
  - `src/call-sequence.ts`:`buildCallSequences` 共享序列构建——入口函数(不被项目函数调用)的调用链做传递展开(内联被调项目函数体,深度 ≤4、环安全);非入口函数的孤立片段不再单独验证(违规归因到调用它的入口),消除 helper 片段误报
22
60
  - 规则名函数与叶子原语(函数体只调外部调用)不内联——协议原语只在调用链内验证,调用名保留给匹配层
23
- - trust 引擎接线:`extractCallSequencesFromIR` 换用 `buildCallSequences`,规则名集合作为展开保留单元;生效范围如实记录——ir.json 为函数数组形态(协议盲测语料 / extractIR 直出)时 P4.6 生效;合并形态 `{ typeMap, functions }`(execute/MCP 写盘)沿用既有回退路径(3.5.0 起的既有行为,恢复 IR-first 需先做词段匹配门控的 FP 打磨)
61
+ - trust 引擎接线:`extractCallSequencesFromIR` 换用 `buildCallSequences`,规则名集合作为展开保留单元;生效范围如实记录——ir.json 为函数数组形态(协议盲测语料 / extractIR 直出)时 P4.6 生效;合并形态 `{ typeMap, functions }`(execute/MCP 写盘)沿用既有回退路径(3.5.0 起的既有行为)——**合并形态的 IR-first 恢复已于 3.7.1 完成**(词段匹配门控 + 形状兼容)
24
62
  - 边界(与 C 的 L3 同类,如实记录):展开是语法内联(调用链扁平化),不做数据流/指针/分支分析
25
63
 
26
64
  ### 新增:协议盲测 v1.2(跨函数 + 任意命名变体)
@@ -57,7 +95,7 @@
57
95
 
58
96
  ### 文档
59
97
 
60
- - README 新增「社区与反馈」章节:讨论群二维码(`assets/wechat-group.png`,当前为占位图待替换真实群码)+ GitHub Issues 通道(中英双语)
98
+ - README 新增「社区与反馈」章节:讨论群二维码(`assets/wechat-group.png`,3.6.0 发布时为占位图,**3.6.1 已替换为真实群码**并直展双群二维码)+ GitHub Issues 通道(中英双语)
61
99
  - README 删除双峰(Two-Hump)内容:科学基础章节的双峰类比段与 P0-P3 节的双峰报告链接
62
100
  - 覆盖矩阵(中英)刷新至 2026-08-23 并新增英文版 `coverage-matrix-en.md`;架构图规则数修正 140→148(与 protocols.json 实测一致)
63
101
 
@@ -122,7 +160,7 @@
122
160
 
123
161
  ### 已知问题
124
162
 
125
- - `npm run check` 的 Ledger 不变量 / 回放 / 覆盖率失败为历史遗留(基线核查确认与本次改动无关),待单独排期
163
+ - `npm run check` 的 Ledger 不变量 / 回放 / 覆盖率失败为历史遗留(基线核查确认与本次改动无关)——**3.4.1 已修复**(check 根因修复:包目录回退 / 空快照比较 / INIT 规范化 / 覆盖率祖父条款)
126
164
 
127
165
  ## [3.3.8] — 2026-08-18
128
166
 
package/README.md CHANGED
@@ -158,8 +158,8 @@ C analysis is **research-only**: gold benchmark F1=16.5% across 4 repos (curl, l
158
158
 
159
159
  ### P0-P3 Rule Injection (2026-08)
160
160
 
161
- - **+19 new detections** across 10 TS projects, **0 false positives** across 6 C repos + PostgreSQL
162
- - Bootstrapping deadlock broken: all 21 protocol namespaces now have rule vocabulary
161
+ - **+31 rules / +86 trajectories / +13 detectors / +11 safeguards** injected; +19 new detections across 10 TS projects, **0 false positives** across 6 C repos + PostgreSQL
162
+ - Bootstrapping deadlock broken: all 21 protocol namespaces gained rule vocabulary (today: 27 namespaces, 148 rules)
163
163
  - `excludePatterns` + `languages` architecture for FP management
164
164
 
165
165
  → [P0-P3 Final Report](https://github.com/shenlian19831109/progmune-runtime/blob/main/docs/p0-p3-final-report.md)
@@ -173,7 +173,9 @@ SDK (src/sdk.ts) verify() → APPROVED / NEEDS_REVIEW / BLOCKED
173
173
  └─ Trust Engine 4-dimension scoring → Decision
174
174
  ├─ Policy Engine Enterprise policy enforcement (ALLOW/WARN/BLOCK)
175
175
  ├─ SSG Validator Protocol state machine verification
176
- ├─ Protocol Detector Regex-based protocol step detection (22 detectors)
176
+ ├─ Call Sequences P4.6 cross-function: entry expansion (depth ≤4) +
177
+ │ helper-fragment suppression
178
+ ├─ Protocol Detector Regex fallback for IR-less languages (C), 22 detectors
177
179
  ├─ IR Extraction Registry-based: TS (ts-morph) + Python (ast module)
178
180
  │ merged into one function IR per project;
179
181
  │ source-level markers: taint tracking, import resolution,
@@ -204,6 +206,8 @@ SDK (src/sdk.ts) verify() → APPROVED / NEEDS_REVIEW / BLOCKED
204
206
 
205
207
  Your feedback shapes Progmune. Scan the QR code to join the user discussion group (WeChat / WhatsApp), or open a [GitHub Issue](https://github.com/shenlian19831109/progmune-runtime/issues) for bug reports, feature requests, and suggestions.
206
208
 
209
+ **Auto-reply bots are live on both official messaging channels** — keyword-based instant replies via the WeChat Official Account bot ([`wechat-bot/`](wechat-bot/README.md)) and the WhatsApp Business API bot ([`whatsapp-bot/`](whatsapp-bot/README.md)). Follow the official account / message the business number with "help" to see all commands.
210
+
207
211
  ---
208
212
 
209
213
  ## Scientific Foundation
package/README.zh-CN.md CHANGED
@@ -158,8 +158,8 @@ C 分析**仅研究**:黄金基准 F1=16.5%,覆盖 4 个仓库(curl、libs
158
158
 
159
159
  ### P0-P3 规则注入(2026-08)
160
160
 
161
- - 10 个 TS 项目 **+19 条新检测**,6 个 C 仓库 + PostgreSQL **0 误报**
162
- - 打破引导死锁:全部 21 个协议命名空间已有规则词汇
161
+ - 注入 **+31 条规则 / +86 条轨迹 / +13 个检测器 / +11 条防护**;10 个 TS 项目 **+19 条新检测**,6 个 C 仓库 + PostgreSQL **0 误报**
162
+ - 打破引导死锁:全部 21 个协议命名空间获得规则词汇(今天:27 个命名空间、148 条规则)
163
163
  - `excludePatterns` + `languages` 架构管理误报
164
164
 
165
165
  → [P0-P3 终报](https://github.com/shenlian19831109/progmune-runtime/blob/main/docs/p0-p3-final-report.md)
@@ -173,7 +173,9 @@ SDK (src/sdk.ts) verify() → APPROVED / NEEDS_REVIEW / BLOCKED
173
173
  └─ 信任引擎 四维评分 → 决策
174
174
  ├─ 策略引擎 企业策略执行(ALLOW/WARN/BLOCK)
175
175
  ├─ SSG 校验器 协议状态机验证
176
- ├─ 协议检测器 基于正则的协议步骤检测(22 个检测器)
176
+ ├─ 调用序列 P4.6 跨函数:入口展开(深度 ≤4)+
177
+ │ helper 片段抑制
178
+ ├─ 协议检测器 无 IR 语言(C)的正则回退,22 个检测器
177
179
  ├─ IR 提取 注册表式:TS(ts-morph)+ Python(ast 模块)
178
180
  │ 合并为每项目一份函数 IR;
179
181
  │ 源码级标记:污点追踪、import 解析、限定调用链、跨文件模板分析
@@ -203,6 +205,8 @@ SDK (src/sdk.ts) verify() → APPROVED / NEEDS_REVIEW / BLOCKED
203
205
 
204
206
  你的意见塑造 Progmune。扫码加入用户讨论群(微信 / WhatsApp),或通过 [GitHub Issue](https://github.com/shenlian19831109/progmune-runtime/issues) 提交缺陷报告、功能需求与建议。
205
207
 
208
+ **双渠道自动回复已上线**:微信公众号与 WhatsApp Business 均已接入关键词自动回复机器人([`wechat-bot/`](wechat-bot/README.md) 与 [`whatsapp-bot/`](whatsapp-bot/README.md))——关注公众号 / 向官方号码发送「帮助」即可查看全部指令,即时互动。
209
+
206
210
  ---
207
211
 
208
212
  ## 科学基础
package/dist/sdk.js CHANGED
@@ -20,7 +20,7 @@ const risk_model_1 = require("./risk-model");
20
20
  const protocol_knowledge_1 = require("./protocol-knowledge");
21
21
  const evidence_repository_1 = require("./evidence-repository");
22
22
  /** Runtime version — stable public identifier. Internal layers evolve underneath. */
23
- exports.RUNTIME_VERSION = "1.0.0";
23
+ exports.RUNTIME_VERSION = "3.7.2";
24
24
  function verify(filePath) {
25
25
  const cert = (0, certify_1.certify)(filePath);
26
26
  const kb = (0, protocol_knowledge_1.buildKnowledgeBase)();
@@ -174,7 +174,7 @@
174
174
  本文档面向两类读者:想快速理解的初学者,与需要专业判断的投资人。</div>
175
175
  <div class="meta">
176
176
  <span>📄 版本 v1.0 · 2026-08</span>
177
- <span>🧪 引擎版本 v3.2.0</span>
177
+ <span>🧪 引擎版本 v3.7.2</span>
178
178
  <span>📊 13/13 安全类别覆盖</span>
179
179
  <span>🔓 开源 MIT</span>
180
180
  <span>📦 npm install progmune-runtime</span>
@@ -449,7 +449,7 @@ IR: { name: "createOrder", params: [{name:"userId", type:"number"}...],
449
449
 
450
450
  <h3>5.2 协议状态机:把"顺序规则"变成可执行检查</h3>
451
451
  <p>每个关键协议被建模为一个状态机。以登录为例:</p>
452
- <pre><code>规则(protocols.json,共 148 条,覆盖 21 个命名空间):
452
+ <pre><code>规则(protocols.json,共 148 条,覆盖 27 个命名空间):
453
453
  verify_password: UNAUTHENTICATED → PASSWORD_VERIFIED
454
454
  generate_jwt: PASSWORD_VERIFIED → TOKEN_ISSUED
455
455
  create_session: TOKEN_ISSUED → SESSION_ACTIVE
@@ -505,6 +505,7 @@ AI 生成: create_session(...) ← 当前状态 UNAUTHENTICATED
505
505
  <tr><th>基准</th><th>方法</th><th>结果</th></tr>
506
506
  <tr><td><strong>盲测基准</strong>(TypeScript,100 项目)</td><td>90 个合成风格变体 + 10 个模型变体项目、795 条 gold finding、严格定位匹配</td><td>精确率 <strong>100%</strong> · 召回率 <strong>98.5%</strong>(有效口径 100%)· 事实性误报 <strong>0</strong></td></tr>
507
507
  <tr><td><strong>盲测基准</strong>(Python,90 项目)</td><td>90 个合成风格变体、729 条 gold finding</td><td>精确率 <strong>100%</strong> · 召回率 <strong>100%</strong> · 事实性误报 <strong>0</strong></td></tr>
508
+ <tr><td><strong>协议盲测</strong>(Python v1.2,38 项目)</td><td>8 违规类型 × 5 结构/命名风格、66 条可测金标、生产 SSG 桥接校验器(P4.6 跨函数传播)</td><td>召回 <strong>97%</strong> · 精确率 <strong>100%</strong> · 误报 <strong>0</strong>(2 漏检为注解依赖前置,已单列)</td></tr>
508
509
  <tr><td><strong>真实应用验证</strong>(PyGoat)</td><td>OWASP 故意脆弱 Django 应用、232 条检测逐条人工核实</td><td>标记精确率 <strong>100%</strong>(67 真阳性 / 0 误报);覆盖 14 个漏洞类别</td></tr>
509
510
  <tr><td><strong>良构应用</strong>(django/fastapi realworld、django-unicorn)</td><td>176 条检测</td><td>0 条误报真阳性;3 条框架内部边界 FP(已定性归档)</td></tr>
510
511
  <tr><td><strong>黄金基准</strong>(C 语言)</td><td>curl/libssh/nginx/openssl 等真实 CVE 案例</td><td>F1 16.5% —— <strong>研究阶段</strong>,诚实披露</td></tr>
@@ -526,6 +527,7 @@ AI 生成: create_session(...) ← 当前状态 UNAUTHENTICATED
526
527
  <tr><td><strong>SDK</strong></td><td>一行调用:<code>verify(file) → BLOCK/WARN/ALLOW</code></td><td>✅ 可用</td></tr>
527
528
  <tr><td><strong>CLI</strong></td><td><code>npm run trust</code>、<code>npm run governance</code>——命令行信任检查与治理报告(终端/JSON/Markdown/HTML 四种格式)</td><td>✅ 可用</td></tr>
528
529
  <tr><td><strong>GitHub Action</strong></td><td>PR 合并前自动门禁</td><td>✅ 可用</td></tr>
530
+ <tr><td><strong>社区自动回复</strong></td><td>公众号(wechat-bot)与 WhatsApp(whatsapp-bot)双渠道关键词自动回复,「群」指令发送社区二维码合成图</td><td>✅ 上线(3.7.2)</td></tr>
529
531
  <tr><td><strong>Trust API</strong></td><td><code>POST /trust/check</code> 机器间接口</td><td>✅ 可用</td></tr>
530
532
  <tr><td><strong>SaaS 仪表盘</strong></td><td>多项目可视化管理</td><td>🔲 规划中(等 PoC 验证后)</td></tr>
531
533
  </table>
@@ -543,7 +545,7 @@ AI 生成: create_session(...) ← 当前状态 UNAUTHENTICATED
543
545
  <h3>6.3 知识库规模</h3>
544
546
  <div class="stats">
545
547
  <div class="stat"><div class="n">148</div><div class="l">协议规则</div></div>
546
- <div class="stat"><div class="n">21</div><div class="l">协议命名空间全覆盖</div></div>
548
+ <div class="stat"><div class="n">27</div><div class="l">协议命名空间全覆盖</div></div>
547
549
  <div class="stat"><div class="n">22+26+15</div><div class="l">检测器 + 防护 + 源码级规则</div></div>
548
550
  <div class="stat"><div class="n">39</div><div class="l">黄金缺陷案例(人工验证)</div></div>
549
551
  <div class="stat"><div class="n">190</div><div class="l">盲测项目(TS 100 + Python 90)</div></div>
@@ -693,7 +695,7 @@ AI 生成: create_session(...) ← 当前状态 UNAUTHENTICATED
693
695
  <li><strong>真问题 + 真窗口</strong>:76% 企业已用 AI 编码,验证层是明确的基础设施缺口,且没有巨头占位</li>
694
696
  <li><strong>差异化足够深</strong>:协议顺序验证是传统 SAST 的系统性盲区——这是"品类级"差异,不是"功能级"差异</li>
695
697
  <li><strong>数据飞轮成立</strong>:每次拦截都沉淀为抗体,使用量即壁垒(与 Salesforce 的网络效应同构)</li>
696
- <li><strong>开源已验证</strong>:19 个工具、148 条规则、85.2% F1、真实项目案例(PrintLab 从 BLOCKED 到 APPROVED 的完整过程可复现)</li>
698
+ <li><strong>开源已验证</strong>:MCP 工具集成、148 条规则、TS 盲测 Recall 98.5% / Precision 100%(0 FP)、真实项目案例(PrintLab 从 BLOCKED 到 APPROVED 的完整过程可复现)</li>
697
699
  </ol>
698
700
 
699
701
  <h3>为什么需要谨慎</h3>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "progmune-runtime",
3
- "version": "3.7.1",
3
+ "version": "3.7.3",
4
4
  "description": "Progmune — AI Trust Decision Engine. Verify AI-generated code before it reaches production. Outputs APPROVED / NEEDS_REVIEW / BLOCKED with evidence.",
5
5
  "files": [
6
6
  "dist/",