MPP: credential is always sent in Authorization, ignoring header="Payment-Authorization" in the challenge
Maintainer thường phản hồi trong vòng 1 ngày
@abhiramshaji-cyber đang làm issue này rồi.
Từ ngày 27/10/2026.
- #719 của @abhiramshaji-cyber — đang mở
Đá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
Hướng nghiên cứu
Bắt đầu tại bedrock_agentcore/payments/manager.py, ở PaymentManager._generate_mpp_payment_header, rồi lần theo cách header challenge được chọn đi đến generate_payment_header. Kiểm tra cách handler của Strands và middleware của LangGraph áp dụng các header được trả về, đồng thời thêm hoặc chạy các bài kiểm thử tập trung cho cả Payment-Authorization và hành vi mặc định của Authorization. Hoàn thành khi header được chọn chứa thông tin xác thực và giá trị Authorization hiện có của bên gọi được giữ nguyên.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
The MPP core spec lets a challenge choose the request header for the credential. With header="Payment-Authorization", the client must send the credential in Payment-Authorization, so that Authorization stays free for the client's own authentication (draft-httpauth-payment-01, section "Credentials"). The server accepts the credential only from the selected field, and a client that does not support Payment-Authorization must not send a credential for such a challenge.
PaymentManager._generate_mpp_payment_header always returns {"Authorization": "Payment <credential>"}, whatever the selected challenge says. For a challenge with header="Payment-Authorization", the SDK:
- pays it (
ProcessPaymentis called); - returns the credential under
Authorization, where the server does not look for it; - replaces the caller's own
Authorizationvalue (for example a Bearer token) when the Strands plugin or the LangGraph middleware applies the header to the retried request (apply_payment_headerupdates the headers dict).
mppx servers send this parameter when created with Mppx.create({ requiresAuth: true, ... }) (added in mppx 0.9.0), and then read the credential only from Payment-Authorization.
To Reproduce
bedrock-agentcore 1.24.1 (main at b70e0b7), Python 3.10:
import base64
import json
from unittest.mock import MagicMock, patch
from bedrock_agentcore.payments.integrations.handlers import GenericPaymentHandler
from bedrock_agentcore.payments.manager import PaymentManager
request = {
"amount": "1000",
"currency": "0x036CbD53842c5426634e7929541eC2318f3dCF71",
"recipient": "0x742d35Cc6634C0532925a3b844Bc9e7595f8fE00",
"methodDetails": {"chainId": 84532},
}
encoded = base64.urlsafe_b64encode(json.dumps(request, separators=(",", ":")).encode()).decode().rstrip("=")
challenge = (
f'Payment id="x7Tg2pLqR9mKvNwY3hBcZa", realm="api.example.com", method="evm", intent="charge", '
f'header="Payment-Authorization", request="{encoded}"'
)
with patch("boto3.Session") as session:
session.return_value.region_name = "us-west-2"
manager = PaymentManager(
payment_manager_arn="arn:aws:bedrock-agentcore:us-west-2:123456789012:payment-manager/pm-abc123",
region_name="us-west-2",
)
manager._payment_client = MagicMock()
manager._payment_client.get_payment_instrument.return_value = {
"paymentInstrument": {"paymentInstrumentDetails": {"embeddedCryptoWallet": {"network": "ETHEREUM"}}}
}
manager._payment_client.process_payment.return_value = {
"processPayment": {
"status": "PROOF_GENERATED",
"paymentOutput": {"mpp": {"selectedPaymentId": "x7Tg2pLqR9mKvNwY3hBcZa", "paymentCredential": "eyJ0b2tlbiI6MX0"}},
}
}
payment_header = manager.generate_payment_header(
user_id="user-1",
payment_instrument_id="pi-1",
payment_session_id="ps-1",
payment_required_request={"statusCode": 402, "headers": {"WWW-Authenticate": challenge}, "body": {}},
)
print("ProcessPayment calls:", manager._payment_client.process_payment.call_count)
print("payment header:", payment_header)
tool_input = {"url": "https://api.example.com/resource", "headers": {"Authorization": "Bearer mF_9.B5f-4.1JqM"}}
GenericPaymentHandler().apply_payment_header(tool_input, payment_header)
print("retried request headers:", tool_input["headers"])
Output:
ProcessPayment calls: 1
payment header: {'Authorization': 'Payment eyJ0b2tlbiI6MX0'}
retried request headers: {'Authorization': 'Payment eyJ0b2tlbiI6MX0'}
Expected behavior
For a challenge with header="Payment-Authorization", generate_payment_header returns {"Payment-Authorization": "Payment <credential>"}, and the retried request keeps its own Authorization header. A challenge without header keeps using Authorization, as now. Until the field is supported, such a challenge should not be selected or paid.
Additional context
- The parameter was added to the spec in tempoxyz/mpp-specs#328 (2026-08-25), a week after MPP support landed here in #643 (2026-08-18).
- The spec also asks the client to echo
headerin the credential'schallengeobject. The raw challenge, includingheader, is already forwarded toProcessPayment, so that part may be handled by the service; I could not check it.
- Ngôn ngữ chính
- Python
- Star
- 786
- Fork
- 163
- Merge trung bình
- 4 giờ
- Pull request đã merge (30 ngày)
- 22
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không 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 aws/bedrock-agentcore-sdk-python
-
bug high-severity
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
aws/bedrock-agentcore-sdk-python#752 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
OpenAIConverseConverter restores an empty history when one blob or text payload fails to parseĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
aws/bedrock-agentcore-sdk-python#751 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
delete_all_long_term_memories_in_namespace deletes only the first 10 recordsCó thể đã có người làm @Fire162 đã nhận 18 ngày trước. Đang mởbug high-severity
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
aws/bedrock-agentcore-sdk-python#727 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] update_message fails with parameter validation error when SessionMessage.message_id is a Strands positional integer indexCó thể đã có người làm @citizen204 đã nhận 144 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
aws/bedrock-agentcore-sdk-python#556 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
CodeInterpreter should not require a region argumentCó thể đã có người làm @citizen204 đã nhận 159 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
aws/bedrock-agentcore-sdk-python#511 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của aws/bedrock-agentcore-sdk-python
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
snap-stanford/Biomni#380 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
microsoft/playwright-python#3361 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation priority: low size: S status: needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
cubrid-lab/sqlalchemy-cubrid#1397 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation priority: low size: S status: needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
cubrid-lab/pycubrid#1307 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: Installer hides SSL certificate errors as bare URLError, and the suggested fix can't workĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
ShaftHQ/chaosengine-harness#143 ·
Maintainer thường phản hồi trong vòng 1 ngày