refactor: unify security-event sink and improve model config UX#26
Open
refactor: unify security-event sink and improve model config UX#26
Conversation
.gitignore 对已被索引的文件无效,导致 GeneratedPluginRegistrant.java、 generated_plugin_registrant.*、generated_plugins.cmake、local.properties 每次 flutter pub get 后都在 git status 里冒泡。 本次改动: - 将 8 个由 Flutter 工具链生成的文件从索引中移除(磁盘文件保留)。 - 将 linux/flutter/ 和 windows/flutter/ 目录级忽略收敛为按生成文件与 ephemeral/ 精确匹配,避免误拦 CMakeLists.txt 等应跟踪的工程文件。
_rawToDisplay 的兜底分支会把 rawValue 整除 1000,导致 DB 里 50/500 等 小于 1000 的值在界面上显示为 0,并且再次保存会被静默抹成 0。新增 base (个/tokens)单位作为兜底并显式渲染 0,保证任意 DB 值 roundtrip 无损。 Made-with: Cursor
- 代理层新增 emitSecurityEvent,在会话配额/每日配额/沙箱/ShepherdGate 四类拦截分支与 blockedCount++ 同步记录事件,修复 NEEDS_CONFIRMATION 触发时事件面板为空的问题 - ShepherdGate 启发式与 5 个 plugin gateway 不再直接写 SecurityEvent,集中到代理层单一权威写入点,拦截次数与事件列表保证 >= 关系 - 新增 shepherd.PostValidationOverrideTag 常量与 needs_confirmation 事件类型,提示词注入强制改写后 Detail 加 post_validation_override 标签 - 前端对 QUOTA/SANDBOX_BLOCKED/NEEDS_CONFIRMATION 等 Go 常量做展示本地化(配额/沙箱拦截/待确认),并为待确认事件增加独立颜色与图标 - 新增 _rules/security_event.md 固化触发口径与职责边界,global.md §7 追加索引 - 新增 proxy_protection_security_event_test.go 覆盖 4 条拦截分支、needs_confirmation 分桶与 PostValidationOverrideTag 契约 Made-with: Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改了什么
ProxyProtection作为唯一权威写入点,补齐QUOTA、SANDBOX_BLOCKED、NEEDS_CONFIRMATION等分支事件写入,并新增对应 Go 测试。asset_id仅由name + config_path计算,移除运行态动态字段(端口/进程路径)参与,保证同一资产跨重启稳定。为什么改
asset_id漂移,进而引发策略绑定丢失或重复。影响范围
core/proxy、core/shepherd、core/asset、plugins/* gateway/scanner、chatmodel-routing。_rules/global.md、新增_rules/security_event.md。.gitignore与 Flutter 生成文件跟踪策略。如何验证
go test ./...(在go_lib)通过。QUOTA/SANDBOX_BLOCKED/NEEDS_CONFIRMATION分支能写入SecurityEvent。asset_id在相同(name, config_path)下跨重启保持稳定。flutter analyze当前存在历史问题:test/widget_test.dart中MyApp非类型引用(与本 PR 变更文件无直接关联)。