pushed_authorization_request sends list authorization_details as a Python repr
メンテナーはふだん 1 日以内に返信
評価
調査の方向性
PushedAuthorizationRequests.pushed_authorization_request()と、issueで言及されている既存のテストtest_with_authorization_detailsから始めてください。RestClient._request()がリスト値をどのようにエンコードするかを、#695のBackChannelLogin.back_channel_login()の修正と比較してください。リストが渡されたとき、フォーム本文にauthorization_detailsが二重引用符を使ったJSON配列として含まれていれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Checklist
- I have looked into the README and have not found a suitable solution or answer.
- I have searched the issues and have not found a suitable solution or answer.
Description
PushedAuthorizationRequests.pushed_authorization_request() posts a form-encoded body (Content-Type: application/x-www-form-urlencoded). RestClient._request() converts the payload with urllib.parse.urlencode(), which turns a list value into its Python repr.
When you pass authorization_details as a list, which the existing test test_with_authorization_details does, the request body contains:
authorization_details=%5B%7B%27type%27%3A+%27money_transfer%27%2C+...
That decodes to [{'type': 'money_transfer', ...}], with single quotes, which is not JSON. RFC 9396 requires authorization_details to be a JSON array, so RAR through PAR does not work with a list.
BackChannelLogin.back_channel_login() had the same problem and was fixed in #695 by calling json.dumps() on list values.
Reproduction
from unittest import mock
from urllib.parse import parse_qs
from auth0.authentication.pushed_authorization_requests import PushedAuthorizationRequests
with mock.patch("requests.request") as req:
req.return_value.status_code = 201
req.return_value.text = '{"request_uri": "urn:x", "expires_in": 30}'
PushedAuthorizationRequests("my.domain.com", "cid", client_secret="s").pushed_authorization_request(
response_type="code",
redirect_uri="https://example.com/cb",
authorization_details=[{"type": "money_transfer"}],
)
print(parse_qs(req.call_args.kwargs["data"])["authorization_details"])
# ["[{'type': 'money_transfer'}]"]
Expected: ['[{"type": "money_transfer"}]'].
Additional context
Workaround: pass authorization_details=json.dumps([...]).
auth0-python version
6.8.0 (main at 9aae3e5)
Python version
3.12
- 主要言語
- Python
- スター
- 578
- フォーク
- 190
- 平均マージ
- 9時間 39分
- マージ済み PR(30日)
- 7
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
auth0/auth0-python のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
auth0/auth0-python#852 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
auth0/auth0-python#856 · コメント 4 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
auth0/auth0-python#798 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
auth0/auth0-python#789 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
auth0/auth0-python の issue をすべて見る
似ている issue
-
wr.dynamodb.read_items returns [{}] for a single partition value that does not exist対応中かも @auraseb が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
aws/aws-sdk-pandas#3520 ·
メンテナーはふだん 2 日以内に返信
-
requires triage typing
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
sqlalchemy/sqlalchemy#13704 ·
メンテナーはふだん 1 日以内に返信
-
Edit tool converts CRLF files to LF対応中かも @RaphaelFakhri が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
huggingface/tau#774 ·
メンテナーはふだん 1 日以内に返信
-
show ignores the row limit when a column or table name contains "limit"対応中かも @RaphaelFakhri が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
linebender/resvg#1179 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信