ディープリンクのレガシー経路で sgid/lid/lgid を厳密な正整数バリデーションで検証する#6007
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
Changesレガシーディープリンクパラメータの厳密バリデーション
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Comment |
概要
useDeepLinkのレガシー経路(sgid/lid/lgid形式)でNumber()+ truthy 判定のみだったため、1.5やInfinityのような値がそのまま GraphQL のInt変数に渡り、下流でエラーになる可能性がありました。先行 PR #6003 でsids側に導入済みの/^[1-9]\d*$/バリデーションに揃え、不正値の場合はリンク全体を no-op にします。変更の種類
変更内容
src/hooks/useDeepLink.ts:handleUrlのレガシー分岐でsgid/lidを/^[1-9]\d*$/の厳密な正整数として検証。lgidは省略可だが、指定された場合は同じ正規表現で検証し、不正ならlineIdパスへフォールスルーせずリンク全体を no-op にする。src/hooks/useDeepLink.test.tsx:it.eachで 8 ケース(sgid の小数 / Infinity / 0 / 余分文字、lid の小数 / 指数表記、lgid の小数 / 任意文字列)を追加し、いずれもクエリ非発火・state 不変であることを担保。テスト
npm run lintが通ることnpm testが通ることnpm run typecheckが通ること関連Issue
Closes #6004
スクリーンショット(任意)
Summary by CodeRabbit
Bug Fixes
Tests