traPtitech / traPtitech/Checkin
認証サブシステム(メール確認・CSRF・セッション)を実装する
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 0
- Avg merge
- 3d 5h
- Merged PRs (30d)
- 7
Description
背景
認証(Auth)系エンドポイント(後述の「対象エンドポイント」)は、ブラウザ向けの HTML 応答・リダイレクト・Cookie を伴うため、oRPC(パース済み JSON を前提とする契約)には適さず、通常の Nitro ルートとして実装する。
なお本人性の担保は2層に分かれる:
- traQ ID: NeoShowcase プロキシが付与する信頼済みヘッダ
X-Forwarded-Userから取得する。自前で認証を実装する必要はなく、ヘッダをContextに注入するだけでよい。 - メールアドレス確認セッション: isct メールアドレスの所有権を確認して確立する一時セッション(Cookie)。本 issue の実装の大半はこちら側にある。
対象エンドポイント(oRPC 契約対象外)
POST /verify-email— 確認メール送信(202)GET /verify-email/confirm— 確認ページ表示(text/html)POST /verify-email/confirm— トークン消費・ログイン完了(303 リダイレクト + Set-Cookie)GET /csrf— CSRF トークン用 Cookie 発行(204)
やること
- traQ ID を
X-Forwarded-Userヘッダから取得しContextに注入する(信頼済みプロキシ前提) - メール送信基盤(isct メールアドレス宛)
- ワンタイムトークンの発行・検証・消費
-
__Host-checkin_email_verified_session/__Host-checkin_csrfCookie の発行と検証 - 状態を変更するリクエストの CSRF トークン(
X-CSRF-Token)検証
スコープ外/関連
- 認可・レート制限は #15。
- traQ ID ↔ Stripe Customer のマッピング(DB)は #18。
- oRPC 契約には含めない(RPC に不向きなブラウザフローのため)。
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the Nitro route setup and the Context definition, then map the four listed endpoints and their browser-facing response requirements. Trace how trusted X-Forwarded-User data enters Context and determine the existing email, token, and cookie infrastructure before implementing the flow. Done means email verification, one-time token consumption, session and CSRF cookies, and X-CSRF-Token validation work for the specified endpoints.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, authentication, backend, security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100