[BUG] A2A lookups by task or context ID reveal whether another user's resource exists

未关闭 适合新手
#3,787 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
68/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
go
领域
backend, security

调研方向

从 go/core/internal/service/session/interactions.go 中的 storedSession (L83-94) 和 interactionError 映射 (L713-714) 开始;然后阅读调用点 taskSession (L615-630)、SendMessage (L456-458) 和 ListTasks (L637)。针对 A2A controller 复现 issue 中的四个步骤,以查看三个不同的错误响应。完成条件是:未知 ID、另一个用户的会话以及另一个 Agent 的会话都返回 TASK_NOT_FOUND,而能够读取该会话但缺少该 verb 的调用方仍然收到权限错误。

由索引模型根据 Issue 内容生成。

描述

📋 Prerequisites
  • I have searched the existing issues to avoid creating a duplicate
  • By submitting this issue, you agree to follow our Code of Conduct
  • I am using the latest version of the software (checked against main at e8cd153)
  • I have tried to clear cache/cookies or used incognito mode (if ui-related)
  • I can consistently reproduce this issue
🎯 Affected Service(s)

Controller (A2A gateway)

🚦 Impact/Severity

Minor

🐛 Bug Description

The A2A gateway tells a caller whether a task or context it may not read exists. A2A 1.0.1 §3.3.2 says servers MUST NOT reveal the existence of resources the client is not authorized to access. IDs are random, so the impact is low, but the MUST is not met.

Every lookup goes through storedSession (interactions.go L83-94), which answers in three different ways:

  • unknown ID: TASK_NOT_FOUND
  • another user's session: a permission error, since interactionError maps CodePermissionDenied to ErrUnauthorized (L713-714)
  • a session that belongs to a different Agent: ErrUnauthorized with "context does not belong to this Agent" (L91-92)

This affects GetTask, CancelTask and SubscribeToTask through taskSession (L615-630), and also SendMessage with a taskId or contextId (L456-458) and ListTasks with a contextId (L637).

🔄 Steps To Reproduce
  1. User A sends a message to Agent X and notes the returned task ID and context ID.
  2. User B calls GetTask on Agent X with A's task ID, then with a random ID.
  3. User B calls ListTasks on Agent X with A's context ID, then with a random one.
  4. User A calls GetTask on Agent Y with their own task ID.
🤔 Expected Behavior

Every call returns TASK_NOT_FOUND.

📱 Actual Behavior

Steps 2 and 3 return a permission error for A's IDs and TASK_NOT_FOUND for random ones. Step 4 returns "context does not belong to this Agent".

🔍 Additional Context

The fix belongs in storedSession: answer not-found when the caller cannot read the session, or when it belongs to another Agent. A caller who can read a session but lacks the verb for the operation (for example, a read-only share user who sends a message) may still get a permission error, since they already know it exists.

主要语言
Go
星标
4.5k
派生
937
平均合并
1 天 10 小时
30 天内合并 PR
150

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

kagent-dev/kagent 的其他 Issue

查看 kagent-dev/kagent 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。