Repository navigation
fix(serve): デッキの URL を 127.0.0.1 宛てにし、::1 で待ち受ける別プロセスにトークンを送らない - #34
Merged
Merged
Conversation
serve は IPv4(0.0.0.0)で待ち受けるが、localhost が ::1 に先に解決される環境では、 他のユーザーが同じポートの ::1 で待ち受けていると、ブラウザがトークン付きの URL を そちらに送ってしまう。起動時に表示するデッキの URL と、LAN IP が無いときのリモコン URL を 127.0.0.1 にする。
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
問題
ippon serveは IPv4(0.0.0.0)で待ち受けますが、起動時に表示するデッキの URL はhttp://localhost:<port>/?t=<token>でした。localhostが::1に先に解決される環境では、別のローカルユーザーが同じポート番号で::1を先に listen しておけます。そうすると、ブラウザはトークン付きの URL をそのプロセスに送ってしまいます。トークンがあれば、デッキ・リモコン・/cmdをすべて操作できます。#33 で
ippon current(x-ippon-key)について Codex に指摘されたのと同じ問題で、そちらは #33 で直しました。この PR は、以前からあったデッキ URL 側を直します。修正
deckUrlをhttp://127.0.0.1:<port>/?t=...にしました。localhost)も127.0.0.1にしました。isLocal)は127.0.0.1も受け付けるので、/__current-slideなどの挙動は変わりません。127.0.0.1から読むので、そのまま動きます。確認
npm run typecheckとnpm testが通りました(84 件 pass)。deckUrlとcurrentUrlが127.0.0.1宛てであることを確かめるテストを追加しました。