APIKeyAuth cookie mode overwrites existing Cookie headers
Maintainer thường phản hồi trong vòng 1 ngà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
- 72/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ệ
- python
- Lĩnh vực
- api, authentication
Hướng nghiên cứu
Bắt đầu từ lib/crewai/src/crewai/a2a/auth/client_schemes.py tại APIKeyAuth.apply_auth, nơi nhánh cookie thay thế toàn bộ header Cookie. Sao chép đoạn mã tái hiện vào một script thử nghiệm để xác nhận các cặp session và theme bị mất, sau đó sửa nhánh này để tìm header hiện có mà không phân biệt chữ hoa chữ thường và nối thêm ; name=key thay vì gán lại. Các trường hợp hiện có và mới nằm trong lib/crewai/tests/a2a/test_client_schemes.py; chạy file này để kiểm tra việc giữ nguyên giá trị, tạo mới khi header chưa tồn tại và tái sử dụng cookie viết thường. Người báo lỗi cho biết sẽ có PR sửa lỗi theo sau, vì vậy hãy hỏi maintainer trước khi làm trùng công việc.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
In lib/crewai/src/crewai/a2a/auth/client_schemes.py, APIKeyAuth.apply_auth handles the cookie location by assigning the whole Cookie header:
if self.location == "header":
headers[self.name] = self.api_key
elif self.location == "cookie":
headers["Cookie"] = f"{self.name}={self.api_key}"
Any cookies already present on the request are discarded. A client that carries a session cookie (or any other cookie) and uses API key auth in cookie mode loses those cookies, so the server sees only the API key pair.
Reproduction
import asyncio
from crewai.a2a.auth.client_schemes import APIKeyAuth
auth = APIKeyAuth(api_key="secret", location="cookie", name="api_key")
headers = {"Cookie": "session=abc123; theme=dark"}
print(asyncio.run(auth.apply_auth(None, headers)))
# {'Cookie': 'api_key=secret'}
On current main (d1aa368749f932311a6c1916e63a756877cab55a) the pre-existing session=abc123; theme=dark pair is gone.
Expected behavior
The API key is added as an additional cookie pair (session=abc123; theme=dark; api_key=secret), preserving existing cookies and the header's original casing when it is already present.
Suggested fix
Look up an existing Cookie header case-insensitively, append ; <name>=<key> when one exists, and create the header only when absent. A fix PR will follow.
Tests
New tests in lib/crewai/tests/a2a/test_client_schemes.py cover preserving an existing Cookie header, creating it when absent, and reusing a lowercase cookie header name. Two of the three fail on unmodified main.
Prepared with an AI coding agent. Please apply the llm-generated label; this account cannot set repository labels.
- Ngôn ngữ chính
- Python
- Star
- 61.2k
- Fork
- 9.2k
- Merge trung bình
- 1 ngày 13 giờ
- Pull request đã merge (30 ngày)
- 221
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của crewAIInc/crewAI
-
[BUG] Agent.copy() shares the LLM's additional_params and token usageCó thể đã có người làm @HanYuanLu đã nhận 4 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
crewAIInc/crewAI#9587 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[FEATURE] Document a single-agent workflow with skillsCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Feature request: GoldenDirectiveTool (harmonic relationship score, full vs cropped reporting)Đang mởfeature-request
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
crewAIInc/crewAI#9200 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[FEATURE] Docs: ApifyActorsTool example with a typed-input ActorCó thể đã có người làm @johnisanerd đã nhận 14 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
crewAIInc/crewAI#9132 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của crewAIInc/crewAI
Issue tương tự
-
Triage-Needed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
pulp/pulp-oci-images#875 ·
-
intake mcp-intake needs-human-review priority:high type:bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Ikalus1988/MisakaNet#5718 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
facebookresearch/autoform-bot#872 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Dataset.to_json() writes "Value": [] for an empty sequenceCó thể đã có người làm @DG47 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày
-
area: docs area: providers/oci priority: p3 size: S type: documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
finos/open-resource-broker#933 ·
Maintainer thường phản hồi trong vòng 1 ngày