Webhook.construct_event accepts signatures made with an empty endpoint secret
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
調査の方向性
stripe.Webhook.construct_event エントリポイントから開始し、署名検証中に指定された secret がどのように使用されるかを追跡します。空の secret と空白文字だけの secret のカバレッジを追加し、それらの設定が署名計算前に拒否される場合に行われる処理を検討するとともに、有効な secret では引き続きイベントを検証できることを確認します。
索引モデルが issue の本文から書いたものです。
説明
Version: stripe-python 15.2.0
If the webhook endpoint secret is unset (e.g. STRIPE_WEBHOOK_SECRET missing, read with an empty-string default), passing "" as the secret makes stripe.Webhook.construct_event verify an HMAC keyed with the empty string. Anyone can then forge checkout.session.completed and similar events and they pass verification.
Reproduction
import hashlib, hmac, json, time, stripe
payload = json.dumps({"id": "evt_x", "object": "event", "type": "checkout.session.completed",
"data": {"object": {"metadata": {"tenant_id": "t"}}}})
ts = int(time.time())
sig = hmac.new(b"", f"{ts}.{payload}".encode(), hashlib.sha256).hexdigest()
event = stripe.Webhook.construct_event(payload, f"t={ts},v1={sig}", "")
print(event["type"]) # checkout.session.completed — accepted
Expected: an empty (or whitespace-only) secret is a configuration error, not a key. Suggest raising ValueError (or SignatureVerificationError) when secret is empty, before computing any signature.
Why it matters: a deployment that simply forgot to set the secret silently accepts forged events instead of rejecting them — e.g. activating or cancelling subscriptions. We found this in a security review and now refuse with 503 when the secret is unset, but the library failing closed would protect everyone who hasn't.
- 主要言語
- Python
- スター
- 2.1k
- フォーク
- 539
- 平均マージ
- 3日 5時間
- マージ済み PR(30日)
- 17
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
stripe/stripe-python のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
stripe/stripe-python#1948 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
stripe/stripe-python#1947 ·
メンテナーはふだん 1 日以内に返信
-
feature-request future
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
stripe/stripe-python#1941 · コメント 5 件 ·
メンテナーはふだん 1 日以内に返信
-
feature-request future
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
stripe/stripe-python#1886 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
feature-request
難易度 2/5 1〜3時間 初心者へのやさしさ 54/100
stripe/stripe-python#1841 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
stripe/stripe-python の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
eclipse-score/inc_someip_gateway#356 ·
メンテナーはふだん 2 日以内に返信
-
[BUG]: `GitHubRestAdapter.check_user_permission` and `has_write_access` raise `TypeError` (missing `params`), silently disabling the inactivity lifecycle対応中かも @tarunagnihotri534 が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
AOSSIE-Org/Gitcord-GithubDiscordBot#167 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
mihai-vlc/sublime-jsfmt#56 ·
-
comp/cli comp/plugins P2 type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
NousResearch/hermes-agent#141917 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
riscv/riscv-opcodes#441 ·