Repository navigation
feat(audit): add security audit logging to backend management APIs - #4055
Merged
Merged
Conversation
实现了模型创建、更新、删除、批量操作等接口的安全审计日志功能,过滤了敏感凭证信息,确保审计日志安全合规。新增了审计安全字段过滤工具函数,补充了对应的测试用例验证审计日志的正确性和安全性。
为agent和agent_repository相关的API接口添加安全审计事件记录,包括代理更新、图标上传、删除、导出、导入、版本发布/回滚/更新/删除等操作,同时补充对应的测试用例验证审计日志的正确性,确保敏感数据不被记录。
为tool、mcp、remote_mcp、skill模块的所有关键增删改接口添加安全审计日志,记录操作人、资源信息等关键字段,同时避免记录敏感信息如凭证、密钥等。新增对应的测试用例验证审计日志的正确性,确保敏感数据不会被泄露。
在多个服务端点添加安全审计日志,记录关键操作信息 同时统一审计详情列表的长度限制为20,防止日志被恶意payload撑爆
为 config_sync_app 和 memory_config_app 的配置操作接口添加安全审计事件记录,记录操作人、租户、操作类型和相关字段信息,同时更新测试用例验证审计日志的正确性,确保敏感配置值不被记录。
为测试用例中的 upload_files 调用添加 http_request=None 参数,避免测试时可能出现的未定义错误
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
charmingchi1
marked this pull request as ready for review
October 9, 2026 09:12
charmingchi1
requested review from
Dallas98,
WMC001,
YehongPan,
hhhhsc701 and
jeffwu-1999
as code owners
October 9, 2026 09:12
WMC001
approved these changes
Oct 10, 2026
JasonW404
added a commit
that referenced
this pull request
Oct 10, 2026
* feat(audit): add security audit logging to backend management APIs (#4055) * feat: 为模型管理接口添加安全审计日志记录 实现了模型创建、更新、删除、批量操作等接口的安全审计日志功能,过滤了敏感凭证信息,确保审计日志安全合规。新增了审计安全字段过滤工具函数,补充了对应的测试用例验证审计日志的正确性和安全性。 * feat: 为多个接口添加安全审计日志记录 为agent和agent_repository相关的API接口添加安全审计事件记录,包括代理更新、图标上传、删除、导出、导入、版本发布/回滚/更新/删除等操作,同时补充对应的测试用例验证审计日志的正确性,确保敏感数据不被记录。 * feat: 为MCP和技能相关接口添加上下文安全审计日志 为tool、mcp、remote_mcp、skill模块的所有关键增删改接口添加安全审计日志,记录操作人、资源信息等关键字段,同时避免记录敏感信息如凭证、密钥等。新增对应的测试用例验证审计日志的正确性,确保敏感数据不会被泄露。 * feat: 添加安全审计日志并限制审计详情列表长度 在多个服务端点添加安全审计日志,记录关键操作信息 同时统一审计详情列表的长度限制为20,防止日志被恶意payload撑爆 * feat: 为配置相关接口添加安全审计日志记录 为 config_sync_app 和 memory_config_app 的配置操作接口添加安全审计事件记录,记录操作人、租户、操作类型和相关字段信息,同时更新测试用例验证审计日志的正确性,确保敏感配置值不被记录。 * test: 为上传测试用例添加 http_request 参数默认值 为测试用例中的 upload_files 调用添加 http_request=None 参数,避免测试时可能出现的未定义错误 * chore: bootstrap semantic repair stream fix draft * fix(agent): commit accepted streamed code action repairs * test(agent): verify repaired streams in deployed runtime and browser * test(agent): clarify deployed repair assertion failures --------- Co-authored-by: charmingchi1 <71816192+charmingchi1@users.noreply.github.com>
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.
背景
平台管理类接口(模型、Agent、MCP、技能、配置、文件、知识库等)此前缺少统一的安全审计记录,安全事件发生后无法回溯"谁在什么时间对什么资源做了什么操作"。本 PR 依据安全审计需求,为后端管理接口补齐 SEC_AUDIT 安全审计事件。
审计实现
统一通过
services/audit_service.py的record_security_event()记录事件,写入audit.securitylogger([SEC_AUDIT]前缀),每条事件包含:安全与稳定性约束
_AUDIT_SAFE_MODEL_KEYS)仅复制非凭据字段,api_key / access_token 等敏感值永远不会进入审计日志AUDIT_DETAIL_LIST_LIMIT = 20,批量操作详情列表超限自动截断,仅保留计数覆盖接口
测试