Repository navigation
fix(security): OAuth のメール自動リンク廃止・登録制限の統一・非 http URI の無害化 - #293
Merged
Merged
Conversation
…egacy register, guard remote URLs - OAuthService: never auto-link a provider login to an existing local account by email; refuse with "An account with this email already exists. Log in and link the provider from settings." Only verified provider emails are used (GitHub /user/emails verified, Google verified_email/email_verified, Discord verified); otherwise a placeholder email is stored. - OAuth sign-up now honours registration.enabled, invite-only / REQUIRE_INVITATION, blocked usernames and the user:beforeRegister plugin hook. Already-linked users can still log in. - routes/oauth: call requireAuth() (it was passed uncalled, so link/unlink/ accounts never worked). Add POST /:provider/link/authorize; the link state cookie is bound to the initiating session token and the callback links to that session's user. POST /:provider/link requires matching state. - unlinkAccount treats OAuth placeholder password hashes as no password. - Extract registration policy helpers to lib/registrationPolicy.ts (shared by /api/auth/register and OAuth). - Remove legacy POST /api/users, which bypassed all registration gating (unused by the frontend). - Frontend: add toSafeHttpUrl and use it for remote note.uri in NoteCardMenu (open in new tab / copy / share) and MFM url/link nodes. Claude-Session: https://claude.ai/code/session_01Y29fBeRP344FME6de48wUv
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 20 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Oct 14, 2026
Merged
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.
変更
OAuthServiceemail_existsで拒否/user/emailsの verified、Googleverified_email/email_verified、Discordverified)。未検証時はプレースホルダーuser:beforeRegister/afterRegisterフックを実行hasUsablePassword()を追加lib/registrationPolicy.ts(新規): 登録可否・招待制の判定を auth.ts から共通化routes/oauth.ts:requireAuth→requireAuth()(link / unlink / accounts が動作していなかった)。ログイン中セッションに紐付いた link フロー(POST /:provider/link/authorize、state + セッショントークンの httpOnly cookie)を追加routes/users.ts: 招待制等を迂回していた旧POST /api/usersを削除(フロントエンド未使用)toSafeHttpUrl()を追加し、NoteCardMenu(新しいタブで開く / リンクコピー / 共有)とMfmRendererのリンクで http(s) 以外を拒否挙動の変化
POST /api/usersは 404。POST /api/auth/registerを使用確認
https://claude.ai/code/session_01Y29fBeRP344FME6de48wUv