Skip to content

Conversation

@coltea
Copy link
Collaborator

@coltea coltea commented Jan 7, 2026

PR 标题

fix(search) 修复搜索文档展示了不可访问的文档

变更类型

请勾选适用的变更类型:

  • Bug 修复 (不兼容变更的修复)
  • 新功能 (不兼容变更的新功能)
  • 功能改进 (不兼容现有功能的改进)
  • 文档更新
  • 依赖更新
  • 重构 (不影响功能的代码修改)
  • 测试用例
  • CI/CD 配置变更
  • 其他 (请描述):

变更内容

详细描述本次 PR 的具体变更内容:

  1. fix(search) 修复搜索文档展示了不可访问的文档

测试情况

描述本次变更的测试情况:

  • 已本地测试
  • 已添加测试用例
  • 不需要测试 (理由: )

其他说明

任何其他需要说明的事项:

Copilot AI review requested due to automatic review settings January 7, 2026 10:33
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a security issue where search results included documents that users don't have permission to access. The fix adds permission filtering to the search functionality by checking node visitable permissions against user group memberships before returning search results.

Key Changes:

  • Added permission checking logic to filter search results based on node visitable permissions
  • Implemented GetNodesByIDs repository method to batch fetch node permission data
  • Updated ChatUsecase to include NodeRepository dependency for permission checks

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
backend/usecase/chat.go Added permission filtering logic in Search method to check visitable permissions and filter inaccessible nodes from search results
backend/repo/pg/node.go Implemented GetNodesByIDs method to retrieve multiple nodes by their IDs for permission checking
backend/pro Updated subproject commit reference
backend/cmd/api/wire_gen.go Updated dependency injection to include nodeRepository parameter in ChatUsecase initialization

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@coltea coltea force-pushed the fix-search-node-perm branch from 813f2d0 to d818435 Compare January 7, 2026 10:40
@coltea coltea merged commit f2d76a1 into chaitin:main Jan 7, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant