Document ASGI-only requirement for BedrockAgentCoreContext
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 半日
- 初心者へのやさしさ
- 45/100
- issue の種類
- ドキュメント
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- python
調査の方向性
src/bedrock_agentcore/runtime/context.py:16-21 から始め、続いて src/bedrock_agentcore/runtime/app.py:299-347 のリクエストコンテキストの設定を確認してください。BedrockAgentCoreContext は ASGI での使用を意図していることを文書化し、WSGI における ContextVar の分離リスクを説明してください。その確認で特定した README または主要なドキュメントの場所を更新してください。完了とは、ユーザーが ASGI 専用要件とセキュリティ上の影響を明確に確認できる状態です。
索引モデルが issue の本文から書いたものです。
説明
Summary
BedrockAgentCoreContext uses ContextVar for storing request-scoped sensitive data (workload access tokens, OAuth2 callback URLs, authorization headers). While this is safe for ASGI web frameworks, it creates a critical security vulnerability if used with WSGI frameworks.
Problem
ContextVar isolation behavior:
- ✅ ASGI frameworks (Starlette, FastAPI, Quart): Automatically isolated per async task (each HTTP request)
- ❌ WSGI frameworks (Flask, Django WSGI): NOT automatically isolated - threads are reused across requests
Security risk with WSGI:
# WSGI thread pool scenario
# Request A (Thread 1) → BedrockAgentCoreContext.set_workload_access_token("USER_A_TOKEN")
# Request B (Thread 1) → BedrockAgentCoreContext.get_workload_access_token()
# → Returns "USER_A_TOKEN" ❌ (LEAKED!)
This causes:
- Token leakage between requests
- Authorization bypass vulnerabilities
- Data access from one user by another
Current Status
The AgentCore SDK correctly uses Starlette (ASGI), making it safe. However, there's no documentation warning against using BedrockAgentCoreContext in non-ASGI environments.
Recommendation
Add documentation to explicitly state:
-
In
src/bedrock_agentcore/runtime/context.pydocstring:- BedrockAgentCoreContext is designed for ASGI web frameworks only
- Using with WSGI frameworks creates security vulnerabilities
- ContextVars rely on async task isolation, not thread isolation
-
In README or main documentation:
- Note that the SDK requires ASGI (already uses Starlette)
- If users want to integrate with Flask/WSGI, they need alternative approaches (Flask's
gobject, thread-local storage with manual cleanup)
-
Consider adding a runtime check (optional):
- Detect if running in WSGI context
- Emit warning about unsafe usage
References
- BedrockAgentCoreContext implementation:
src/bedrock_agentcore/runtime/context.py:16-21 - Context initialization in request handler:
src/bedrock_agentcore/runtime/app.py:299-347 - Python ContextVar documentation: https://docs.python.org/3/library/contextvars.html
Impact
- Severity: High (security vulnerability if misused)
- Likelihood: Low (SDK uses Starlette, but users might try to reuse context pattern)
- Action: Documentation update to prevent misuse
- 主要言語
- Python
- スター
- 786
- フォーク
- 163
- 平均マージ
- 4時間
- マージ済み PR(30日)
- 22
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
aws/bedrock-agentcore-sdk-python のほかの issue
-
bug high-severity
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
aws/bedrock-agentcore-sdk-python#752 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
aws/bedrock-agentcore-sdk-python#751 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
delete_all_long_term_memories_in_namespace deletes only the first 10 records対応中かも @Fire162 が 18 日前に担当しました。 オープンbug high-severity
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
aws/bedrock-agentcore-sdk-python#727 ·
メンテナーはふだん 1 日以内に返信
-
MPP: credential is always sent in Authorization, ignoring header="Payment-Authorization" in the challenge対応中かも @abhiramshaji-cyber が 24 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
aws/bedrock-agentcore-sdk-python#702 ·
メンテナーはふだん 1 日以内に返信
-
[Bug] update_message fails with parameter validation error when SessionMessage.message_id is a Strands positional integer index対応中かも @citizen204 が 144 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
aws/bedrock-agentcore-sdk-python#556 ·
メンテナーはふだん 1 日以内に返信
aws/bedrock-agentcore-sdk-python の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
snap-stanford/Biomni#380 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
microsoft/playwright-python#3361 ·
メンテナーはふだん 1 日以内に返信
-
documentation priority: low size: S status: needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
cubrid-lab/sqlalchemy-cubrid#1397 ·
メンテナーはふだん 1 日以内に返信
-
documentation priority: low size: S status: needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
cubrid-lab/pycubrid#1307 ·
メンテナーはふだん 1 日以内に返信
-
[Bug]: Installer hides SSL certificate errors as bare URLError, and the suggested fix can't workオープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
ShaftHQ/chaosengine-harness#143 ·
メンテナーはふだん 1 日以内に返信