变更说明
- 新增规则级本地上下文匹配。GitHub 和 Sourcegraph 仍使用
content发现候选结果,并可通过可选的matchPattern(Go/RE2 正则)在结果入库前校验代码片段,减少宽泛关键词带来的误报。 - 规则管理页面和 CSV 导入模板增加“本地匹配正则”字段;空值保持原有扫描行为,无效正则会停止该规则本轮扫描并记录错误。
- 修复系统配置保存后运行时配置未同步刷新的问题,配置更新成功后立即对当前进程生效。
- 已验证相关 Go 服务、GitHub/Sourcegraph 扫描包及前端生产构建。
- SQL / 数据库结构影响:无 SQL 文件;
rule表新增match_pattern VARCHAR(200)字段,由项目现有 GORMAutoMigrate在启动时自动创建,已有部署无需手工执行 SQL 升级语句。
What's Changed
- Added rule-level local context matching. GitHub and Sourcegraph continue to use
contentfor candidate discovery and can optionally apply a Go/RE2matchPatternto returned code fragments before persistence, reducing false positives from broad searches. - Added the local match regex field to the rule management page and CSV import template. An empty value preserves existing behavior, while an invalid expression stops that rule for the current scan and records an error.
- Fixed runtime configuration refresh after system settings are saved, so successful updates take effect in the current process immediately.
- Verified the affected Go service and GitHub/Sourcegraph scanner packages, plus the frontend production build.
- SQL/database impact: no SQL files are included. The
ruletable gains amatch_pattern VARCHAR(200)column through the existing GORMAutoMigratestartup path, so existing deployments do not need to run a manual SQL migration.
完整变更 / Full Changelog: v2.1.24...v2.1.25