APIKeyAuth cookie mode overwrites existing Cookie headers
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 72/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- python
- 領域
- api, authentication
調査の方向性
lib/crewai/src/crewai/a2a/auth/client_schemes.py の APIKeyAuth.apply_auth から始めてください。ここでは cookie の分岐が Cookie ヘッダー全体を置き換えています。再現用のスニペットを使い捨てのスクリプトにコピーして、session と theme のペアが消えることを確認してください。そのうえで、分岐が既存のヘッダーを大文字と小文字を区別せずに検索し、代入ではなく ; name=key を追記するように変更します。既存のケースと新しいケースは lib/crewai/tests/a2a/test_client_schemes.py にあります。このファイルを実行して、値の保持、ヘッダーがない場合の作成、小文字の cookie の再利用を確認してください。報告者によると修正 PR が後から提出される予定なので、作業が重複しないようメンテナーに確認してください。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Python
- スター
- 61.2k
- フォーク
- 9.2k
- 平均マージ
- 1日 13時間
- マージ済み PR(30日)
- 221
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
crewAIInc/crewAI のほかの issue
-
[BUG] Agent.copy() shares the LLM's additional_params and token usage対応中かも @HanYuanLu が 4 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
crewAIInc/crewAI#9587 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[FEATURE] Document a single-agent workflow with skills対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信
-
feature-request
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
crewAIInc/crewAI#9200 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[FEATURE] Docs: ApifyActorsTool example with a typed-input Actor対応中かも @johnisanerd が 14 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
crewAIInc/crewAI#9132 · コメント 5 件 ·
メンテナーはふだん 1 日以内に返信
crewAIInc/crewAI の issue をすべて見る
似ている issue
-
Triage-Needed
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
pulp/pulp-oci-images#875 ·
-
intake mcp-intake needs-human-review priority:high type:bug
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
Ikalus1988/MisakaNet#5718 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
facebookresearch/autoform-bot#872 ·
メンテナーはふだん 1 日以内に返信
-
Dataset.to_json() writes "Value": [] for an empty sequence対応中かも @DG47 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信
-
area: docs area: providers/oci priority: p3 size: S type: documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
finos/open-resource-broker#933 ·
メンテナーはふだん 1 日以内に返信