Unpaired client answers pairing_required instead of unauthorized when the activation also names an invalid pairing method
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start in src/admission.h at inadmissible_reject_reason() and relies_on_unpaired_access(), then read the pairing-method block in on_server_activate() in src/connection_manager.cpp. Extract that method check into a helper that both paths call, and choose PAIRING_REQUIRED only when the helper also passes. Done when a unit test next to the existing admission tests expects UNAUTHORIZED for a Sentinel session with activities: ["playback", "pairing"] and pairing_psk, and the existing PAIRING_REQUIRED case still passes.
索引モデルが issue の本文から書いたものです。
説明
Summary
When a server sends an unpaired client a server/activate that is broken in two ways at once, sendspin-cpp closes the connection with client/goodbye reason pairing_required. The spec says the reason should be unauthorized.
pairing_required tells the user "turn on unpaired access and this will work". In this case it won't: with unpaired access on, the same activation is still rejected, this time with pair/abort method_not_supported. So the user is pointed at a setting that doesn't fix anything.
Steps to reproduce
- Start a sendspin-cpp-cli player with unpaired access off, which is the default. Do not pass
--allow-unpaired. - Run the conformance client validator with the unpaired suite and fault injection enabled:
uvx --from git+https://github.com/Sendspin/conformance sendspin-validate --suite unpaired --fault-injection - When the validator asks how your app connects, pick server-initiated, then pick the player from the list it found.
- Follow the prompts until step U4. Leave unpaired access off when it asks.
At U4, the validator connects without pairing, so the handshake uses the Sentinel PSK. It then sends:
{
"type": "server/activate",
"payload": {
"activities": ["playback", "pairing"],
"active_roles": [],
"pairing": {"method": "pairing_psk"}
}
}
Expected: client/goodbye with reason unauthorized.
Actual: client/goodbye with reason pairing_required. The validator reports finding UNPAIRED-004 as FAIL.
Why unauthorized is correct
That activation has two separate problems:
- It asks for playback on an unpaired connection while unpaired access is off. The activity set is not allowed (messaging.md, the "Allowed activity sets" table and its footnote).
- It asks for
pairing_pskpairing on a Sentinel connection.pairing_pskis only valid when the handshake matched the pairing PSK (messaging.md, the paragraph after the table). That is true whatever the unpaired-access setting.
The client picks its rejection by the first rule that applies (messaging.md, server/activate, "admissible"):
pairing_requiredapplies only if turning on unpaired access would make the activation admissible. Here it would not: problem 2 remains. This rule does not apply.unauthorizedapplies if the activity set is not allowed for the matched PSK. This rule applies, because of problem 1.
Cause
inadmissible_reject_reason() in src/admission.h decides between the two reasons using relies_on_unpaired_access(). That function asks whether admissible(..., unpaired_access=true) would pass. But admissible() only checks the activity set and the active roles. It never looks at the pairing method.
The pairing-method check lives later in ConnectionManager::on_server_activate() (src/connection_manager.cpp), in the category_ok / offered / format block. It only runs after an activation has passed admissible(). So when admissible() fails, the method is never considered, and "would enabling unpaired access fix it?" wrongly answers yes.
Suggested fix
Answer pairing_required only when enabling unpaired access would make the whole activation acceptable, including its pairing method:
- Pull the existing pairing-method check out of
on_server_activate()into a small helper. The check is: the method is present;pairing_pskif and only if the PSK category isPAIRING; the method is offered; fordynamic_pairing_code, the format is offered. For example,bool pairing_method_acceptable(conn, msg), which returns true whenpairingis not inactivities. - In the rejection path, choose
PAIRING_REQUIREDonly wheninadmissible_reject_reason()says so andpairing_method_acceptable()holds. Otherwise close withUNAUTHORIZED. - Keep using the same helper in the existing method-check block, so the two paths can't drift apart.
Add a unit test next to the existing admission tests:
- an unpaired (Sentinel) session;
- unpaired access off;
activities: ["playback", "pairing"],pairing.method: "pairing_psk";- expected result:
UNAUTHORIZED.
The existing case should still give PAIRING_REQUIRED: activities: ["playback"] with active_roles: ["player@v1"], which is the spec's worked example.
Notes
- Only a misbehaving server would send this activation, so it is an edge case. It is still the exact situation the rule order exists to make deterministic.
- Found with the conformance client validator (Sendspin/conformance#164, step U4). Tested against sendspin-cpp-cli
main@7501898, built on sendspin-cpp.
- 主要言語
- C++
- スター
- 29
- フォーク
- 12
- 平均マージ
- 12時間 14分
- マージ済み PR(30日)
- 69
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Sendspin/sendspin-cpp のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 22/100
Sendspin/sendspin-cpp#204 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
Check to see if the input/output are the same device and if the input can be renamed seperatelyオープン
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
Sendspin/sendspin-cpp#134 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Support clearing external buffers再び着手できるかも @kahrendt が 95 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンenhancement
Sendspin/sendspin-cpp#55 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
Sendspin/sendspin-cpp の issue をすべて見る
似ている issue
-
Mac mini M6 (16 GB): Q2_0 streaming works - measured 11.7->27.2 tok/s + arena fix for sub-32 GB Macsオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
champion good first issue remake source/qq
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
metasequoiaime/msime-windows#1025 ·
メンテナーはふだん 1 日以内に返信
-
backlog bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
EchoTools/nevr-runtime#653 ·
メンテナーはふだん 1 日以内に返信
-
`--fail-require-skip` never fires: run_tests.py searches stdout, but the unittest binary writes the skip summary to stderr対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
InfiniTimeOrg/InfiniTime#2492 ·