Repository navigation
fix(bridge): deny deleting peer experts through the tunnel - #1862
Closed
fengyue-xve wants to merge 1 commit into
Closed
fengyue-xve wants to merge 1 commit into
fengyue-xve wants to merge 1 commit into
Conversation
fengyue-xve
force-pushed
the
fix/peer-expert-delete-guard
branch
2 times, most recently
from
October 10, 2026 08:06
22ff4cc to
4231dd1
Compare
DELETE /api/agents/{id} was tunneled to the peer and executed there as
the connection owner, so the peer-side owner check could not stop the
hub's experts list from deleting a peer's expert. Reject bare
agent-resource DELETEs in the tunnel policy and hide the delete
affordance for bridge experts in the experts table and card.
Fixes TencentCloud#1849
fengyue-xve
force-pushed
the
fix/peer-expert-delete-guard
branch
from
October 10, 2026 08:08
4231dd1 to
fe9f091
Compare
Collaborator
GitHub PR 提交规范✅ PR 必备清单1. 📸 提供视觉证明(截图/录屏)必须贴截图,无论放在 PR 描述中还是评论里——让 reviewer 看到"人",证明是经过人工检查、用心完成的。 2. 🧪 测试用例完整 & CI 通过
3. 🔄 与 AI 协作:确认理解一致
4. 🎯 代码质量:最小修改 & 追问优化
📋 Quick Checklist(可直接放进 PR 模板)- [ ] 📸 已提供 UI 截图/功能演示
- [ ] 🧱 测试用例已添加并通过
- [ ] ✅ CI Workflow 全部通过
- [ ] 🤖 已与 AI 对齐需求理解
- [ ] 🎯 遵循最小修改原则,代码结构清晰
- [ ] 📝 已询问并处理代码优化建议核心原则:PR 是沟通,不是交接。让 reviewer 轻松,就是让自己更快合入。 🔍 本 PR 自动检查发现的问题
|
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.
Summary
Fixes #1849: in云端协同 mode, the hub's 「专家」 module could delete a peer (bridge) expert.
Two layers caused it:
DELETE /api/agents/{id}matched_AGENT_RESOURCEand was tunneled to the peer, where it ran as the connection owner — the peer-side owner check (_assert_agent_owner) cannot stop it, because the request identity is the owner themselves.list_remote_agentsmaps bridge shadow experts withis_owner: true, so the delete button rendered for them too.Changes:
tunnel_policy.py: deny tunneling a bare agent-resourceDELETE /api/agents/{id}(local orbridge:shadow id). Agent sub-surfaces (threads / files / avatar / skills / …) stay deletable, and editing (PATCH /api/agents/{id}) still tunnels.AgentExpertsTableandAgentCardhide the delete button forbridgeexperts, with a new render test (AgentExpertsTable.bridgeDelete.test.tsx).Target branch
develop(feature / fix — default)main(release/*orhotfix/*only)Type of change
Test plan
tests/unit/bridge/test_tunnel_policy.py— newtest_denies_deleting_the_agent_itself: bare DELETE (local id,bridge:id, trailing slash) denied; sub-path DELETE andPATCHstill allowed. Ran locally: 7 passed.dashboard:AgentExpertsTable.bridgeDelete.test.tsxrenders a local + a bridge expert and asserts exactly one Delete button remains (the local row). Ran locally with vitest: 1 passed.make allpasses locally — ran the targeted backend test module, ruff (check + format), and the targeted vitest file; full CI will cover the rest.Checklist
CHANGELOG.md(if user-facing)