Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# PR96 S5 direct CAS forgery review r1 / S5 CAS 直接偽装レビュー r1

> **Summary:** Changes requested for a port-ownership error in the new rejection test. The disclosed limits of the fakecas check are accurate.
> **概要:** 新しい拒否試験のポート所有者の誤認について修正を求める。fakecas 試験の限界についての開示は正確である。

**Jump:** [English](#english) · [日本語](#japanese)

- Version / 版: 0.1 — 2026-11-17. **Learned:** an unpublished service's saved port does not identify the process listening there. / 非公開サービスの保存済みポートでは、そこで待ち受けるプロセスを特定できない。
- Applies to / 対象: RCOSDP/RDM-developer-guide PR #96, head `9e93762438795c3c8ff924082f2ec8811f408a70`.
- Related / 関連: [PR #96](https://github.com/RCOSDP/RDM-developer-guide/pull/96), [Review index / レビュー索引](README.md), [SPEC-06](../spec/06_documentation_conventions.md), [Used by SPEC-04 / 利用先](../spec/04_acceptance_tests.md).
- Reviewer / レビュワ: REV(担当レビュワ, Codex Astra).

---

<a id="english"></a>
## English

[→ 日本語版へ](#japanese)

Verdict: **CHANGES REQUESTED**. Review used an isolated clone at `/private/tmp/rev-pr96-r1/repo`. No stack or installer was run; no source was changed, committed, pushed, approved or merged.

### Findings

1. **R1-01 — P2 — installer/acceptance/test_s5_shibboleth.py:230.** In the shibboleth render, CAS has no published binding (the mapping from a host port to a service), so the retained `GRDM_PORT_CAS` does not identify a current CAS listener. For example, an unrelated process on 8090 is valid while `.env` retains CAS=8090: `plan.published_ports` excludes CAS before `compose.assign_ports`, so render does not reserve or check that port. Another rendered service can also reuse it. The new assertion incorrectly fails a secure deployment and labels that listener CAS. Conversely, checking the old port alone cannot detect publication on a different port. Verify CAS's actual published bindings rather than treating every listener at the saved port as CAS. The substitution at compose.py:1625 changes only configuration `host_ports`; the dotenv update at 1694 uses only `published`, so it does not change the saved CAS port to the SP port.
2. **R1-02 — P3 — docs/spec/04_acceptance_tests.md:91,223.** Both languages agree on the added rejection behavior, but their S5 prerequisites and following prose still say S5 skips outside the shibboleth render. State that the additional rejection alone also runs in full+fakecas. The version 0.20 header otherwise has matching English/Japanese intent.
3. **R1-03 — INFO, non-blocking — installer/acceptance/test_s5_shibboleth.py:239.** Missing institution mapping in fakecas can prevent authentication even if the CAS trust check regresses, making this test non-discriminating for that regression. The PR's limitations section honestly discloses this, the untested internal-container route, and the lack of a live run. Do not treat the added test as independent proof of the trust check. The HTTP 200 assertions also do not identify login-page content; API 401 with no ticket exchange is an additional anonymous-session observation, not proof of why CAS rejected identity.

### Other checks

`generate_secret` uses `token_urlsafe(32)` for this key, yielding 43 characters in the accepted alphabet; generated values cannot violate the new 32-character minimum. `compose.run` invokes `secret_format_problems` before rendering. The focused unit test covers unsafe characters and short values. The SP note accurately narrows header removal to its explicit list.

The module marker and function name classify the added test as S5/rejection. `accept.incomplete_scenarios` uses a set of cases, not an exact row count, so the extra rejection does not break it; skipped success and rejection rows remain represented in fakecas. GET and POST use the guarded client with redirects disabled and a fresh context. CAS absence from ports causes a skip, but normal generated dotenv includes it; TEST_IDP has a fixture default. The shibboleth branch checks only host exposure, not CAS's internal trust decision.

Validation results are recorded in the bilingual evidence section. Live acceptance in full+fakecas and full+shibboleth remains outstanding; upstream CAS PR #4 tests were not independently rerun in this review.

---

<a id="japanese"></a>
## 日本語

[→ To English](#english)

判定: **CHANGES REQUESTED**。隔離した clone `/private/tmp/rev-pr96-r1/repo` でレビューした。スタックも installer も実行せず、ソース変更、commit、push、approve、merge は行っていない。

### 指摘

1. **R1-01 — P2 — installer/acceptance/test_s5_shibboleth.py:230。** shibboleth の描画では CAS の公開 binding(ホストのポートとサービスの対応)が無いため、保存された `GRDM_PORT_CAS` は現在の CAS の待受先を特定しない。例えば `.env` が CAS=8090 を保持していても、無関係なプロセスが 8090 を使うことは正常である。`plan.published_ports` は `compose.assign_ports` より前に CAS を除外するため、そのポートを予約も検査もしない。他の描画サービスが再利用することもある。新しい assert は安全な構成を失敗させ、その待受を CAS と誤認する。逆に古いポートの検査だけでは別ポートの誤公開を検出できない。保存済みポートの任意の待受を CAS と扱わず、CAS 自身の実効公開 binding を検証すること。compose.py:1625 の置換は設定用 `host_ports` のみで、1694 行の dotenv 更新は `published` のみを使うため、保存済み CAS ポートが SP ポートに置き換わるわけではない。
2. **R1-02 — P3 — docs/spec/04_acceptance_tests.md:91,223。** 追加した拒否の説明は英日で一致するが、S5 の prerequisites と続く説明は shibboleth 以外で skip としている。追加した拒否ケースだけは full+fakecas でも動くことを明記すること。0.20 の版ヘッダの趣旨は英日で一致している。
3. **R1-03 — INFO、非ブロッキング — installer/acceptance/test_s5_shibboleth.py:239。** fakecas に機関対応表が無いため、CAS の信頼検査が退行しても認証できず、この試験が退行を区別できない可能性がある。PR の限界の節は、この点、コンテナ内部経路の未検証、実機未実行を正直に開示している。追加試験を信頼検査の独立した証明とは扱わないこと。HTTP 200 だけではログイン画面の内容も確認できない。チケット交換なしの API 401 は匿名状態の追加観察であり、CAS が属性を拒んだ理由の証明ではない。

### その他の確認

この鍵の `generate_secret` は `token_urlsafe(32)` を使い、許可文字種の43文字になるため、新しい32文字以上の条件に反しない。`compose.run` は描画前に `secret_format_problems` を呼ぶ。追加の単体試験は危険な文字と短すぎる値を扱う。SP note がヘッダ除去を明示的な一覧に限定した説明は正確である。

モジュールの marker と関数名で追加試験は S5/rejection になる。`accept.incomplete_scenarios` は件数でなくケースの集合を見るため、拒否の追加で壊れない。fakecas でも skip した成功・拒否の行は残る。GET と POST は新しい context とリダイレクト無効の保護されたクライアントを使う。ports に CAS が無いと skip するが通常の生成済み dotenv には存在する。TEST_IDP には fixture の既定値がある。shibboleth の分岐はホストへの公開だけを調べ、CAS 内部の信頼判断は調べない。

検証結果は次の英日併記の証跡欄に記録する。full+fakecas と full+shibboleth の実機受入は未了であり、上流 CAS PR #4 の試験は今回独立に再実行していない。


### Evidence / 証跡

Commands ran in `/private/tmp/rev-pr96-r1/repo`; results shown are observed, not live-stack claims. / 次のコマンドは隔離 clone 内で実行した。結果は観測済みであり、実機スタックの検証を意味しない。

```sh
PYTHONPATH=installer python3 -m unittest discover -s installer/tests
python3 tools/docs_check.py
gh pr checks 96 --repo RCOSDP/RDM-developer-guide
```

```toon
validation[3]{check,result,detail}
installer_unit,PASS,788 tests; 14 skipped; 104.793 seconds
docs,PASS,281 files; 8 exempt; 71 warnings
head_ci,PASS,13 checks; queried once on 2026-11-17
```

All expected checks passed; no long CI polling occurred. Logs: `/private/tmp/rev-pr96-r1/unit.log` and `/private/tmp/rev-pr96-r1/docs.log`. / 指定の検査は成功し、CI の長時間ポーリングは行っていない。ログは前記2ファイルに保存した。
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# PR96 S5 direct CAS forgery review r2 / S5 CAS 直接偽装レビュー r2

> **Summary:** The documentation findings are resolved, but recognizing a login form still does not identify a direct CAS binding.
> **概要:** 文書の指摘は解決したが、ログインフォームの識別では CAS の直接公開を特定できない。

**Jump:** [English](#english) · [日本語](#japanese)

- Version / 版: 0.1 — 2026-11-17. **Learned:** the SP intentionally serves CAS pages, so their content cannot prove a bypass. / SP は意図どおり CAS の画面を返すため、その内容で迂回を証明することはできない。
- Applies to / 対象: PR #96 head `e80963ab012dea5bdf85918fc1a4d73b5d20fea6`, delta from `9e93762438795c3c8ff924082f2ec8811f408a70`.
- Reviewer / レビュワ: REV(担当レビュワ, Codex Astra).
- Related / 関連: [PR #96](https://github.com/RCOSDP/RDM-developer-guide/pull/96), [Review index / レビュー索引](README.md), [SPEC-06](../spec/06_documentation_conventions.md), [Used by SPEC-04 / 利用先](../spec/04_acceptance_tests.md).

---

<a id="english"></a>
## English

[→ 日本語版へ](#japanese)

Verdict: **CHANGES REQUESTED**.

**R2-01 — P2 — installer/acceptance/test_s5_shibboleth.py:239–244 — R1-01 remains open.** The new probe still fails valid unrelated listeners. A non-HTTP TCP service or HTTPS-only server can close the connection, produce a protocol error or time out during the unconditional HTTP request. An unrelated HTTP server redirecting off loopback also fails: `GuardedRequest` validates redirect targets even when following is disabled.

There is also a valid SP case: set the retained CAS port equal to the SP port. `published_ports` excludes unpublished CAS before allocation, so no collision is reserved for it. The SP proxies `/login` to CAS (sp-httpd.conf.tmpl:57), legitimately returns the same form containing `name="execution"`, and the new assertion incorrectly calls this a bypass. This follows from code inspection, not a live reproduction. The previous limitation of examining only a retained port also remains: exposure at another port is invisible.

Check actual published CAS bindings (the mapping between a host port and a service) using read-only runtime/configuration evidence. Cover unrelated listeners, non-HTTP listeners, and equal saved CAS/SP ports. Merely catching all request errors cannot resolve service ownership. Do not weaken the loopback guard to accommodate unrelated redirects.

R1-02 is resolved: the S5 prerequisites and following prose both explain the additional full+fakecas rejection in English and Japanese. R1-03 is resolved as a disclosure: the docstring now states the fakecas check alone cannot discriminate a broken trust check because institution mapping may fail. The PR body remains honest about this limitation, the internal-container route and the absent live runs, but its claim that another program's listener does not fail is not yet true. Secret validation and success/rejection classification are unchanged from r1.

No stack or installer was run. The isolated r1 clone was advanced to the exact r2 head; source was not modified or committed. Live acceptance in both renders remains outstanding. The bilingual evidence section records only observed local checks and CI status.

---

<a id="japanese"></a>
## 日本語

[→ To English](#english)

判定: **CHANGES REQUESTED**。

**R2-01 — P2 — installer/acceptance/test_s5_shibboleth.py:239–244 — R1-01 未解決。** 新しい検査でも無関係な正常な待受が失敗する。非 HTTP の TCP サービスや HTTPS 専用サーバーでは、無条件の HTTP 要求が接続切断、プロトコルエラー、タイムアウトになる。外部へリダイレクトする無関係な HTTP サーバーでも、`GuardedRequest` は追跡無効でも宛先を検査するため失敗する。

正常な SP でも発生する。保存済み CAS ポートと SP ポートを同じに設定すると、`published_ports` は割当前に非公開の CAS を除外するため、そのポートの重複を予約しない。SP は `/login` を CAS に proxy し(sp-httpd.conf.tmpl:57)、正常に `name="execution"` を含む同じフォームを返すが、新しい assert はこれを迂回と誤判定する。実機再現ではなくコードを追った判断である。保存済みポートだけを見る限界も残り、別ポートへの公開は見えない。

読み取り専用の実行状態・設定の証跡を使って、CAS 自身の実効公開 binding(ホストのポートとサービスの対応)を確認すること。無関係な待受、非 HTTP の待受、保存済み CAS/SP ポート一致を扱うこと。要求例外の一律無視だけでは所有者の誤認は解決しない。無関係なリダイレクトのために loopback の保護を弱めないこと。

R1-02 は解決した。S5 の prerequisites と続く本文が英日とも追加の full+fakecas 拒否を説明している。R1-03 は限界の開示として解決した。機関対応の失敗があり得るため、fakecas 単独では信頼検査の退行を識別できないことを docstring が明記した。PR 本文もこの限界、内部コンテナの経路、実機未実行を正直に説明しているが、「別のプログラムの待ち受けは失敗にしない」はまだ成立しない。秘密値の検査と成功・拒否の分類は r1 から変更がない。

スタックも installer も実行していない。r1 の隔離 clone を r2 の指定 head に進め、ソース変更・commit はしていない。両描画の実機受入は未了である。英日併記の証跡欄には観測済みのローカル検査と CI 状態だけを記録する。

### Evidence / 証跡

Ran in `/private/tmp/rev-pr96-r1/repo` at the reviewed head. / レビュー対象 head の隔離 clone 内で実行した。

```sh
PYTHONPATH=installer python3 -m unittest discover -s installer/tests
python3 tools/docs_check.py
gh pr checks 96 --repo RCOSDP/RDM-developer-guide
```

```toon
validation[3]{check,result,detail}
installer_unit,PASS,788 tests; 14 skipped; 100.839 seconds
docs,PASS,281 files; 8 exempt; 71 warnings
head_ci,PASS,13 checks; two queries; initially two pending
```

Logs: `/private/tmp/rev-pr96-r1/unit-r2.log` and `/private/tmp/rev-pr96-r1/docs-r2.log`. No live acceptance was attempted. / ログは前記2ファイルに保存した。実機受入は試みていない。
Loading
Loading