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

Đang mở Phù hợp với người mới
#3,787 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
68/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
go
Lĩnh vực
backend, security

Hướng nghiên cứu

Bắt đầu trong go/core/internal/service/session/interactions.go tại storedSession (L83-94) và ánh xạ interactionError (L713-714); sau đó đọc các điểm gọi taskSession (L615-630), SendMessage (L456-458) và ListTasks (L637). Tái hiện bốn bước từ issue với controller A2A để thấy ba phản hồi lỗi riêng biệt. Hoàn tất khi ID không xác định, phiên của người dùng khác và phiên của Agent khác đều trả về TASK_NOT_FOUND, trong khi một người gọi có thể đọc phiên nhưng thiếu verb vẫn nhận lỗi quyền.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

📋 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.

Ngôn ngữ chính
Go
Star
4.5k
Fork
937
Merge trung bình
1 ngày 10 giờ
Pull request đã merge (30 ngày)
150

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của kagent-dev/kagent

Tất cả issue của kagent-dev/kagent

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.