Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Newly granted Discord admins can open admin pages but cannot use admin actions

オープン
#15 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
typescript

調査の方向性

まず src/hooks.server.ts と src/lib/server/admin.ts を読み、その後、isAdmin(locals.user) を呼び出している管理アクションを追跡します。issue に記載されたセッションフローを再現し、新たに管理者権限を付与されたユーザーが同じセッションでアクションを完了できる一方、管理者でないユーザーは引き続き認可失敗を受け取ることを確認します。

索引モデルが issue の本文から書いたものです。

説明

Problem

The request hook refreshes the Discord role and authorizes /admin using the value returned by refreshDiscordRole, but it does not update event.locals.user.role. Every admin action separately checks the stale locals.user object with isAdmin(locals.user).

A user whose stored role changes from user to admin during the hook therefore passes the page guard but receives 403 from actions such as tile creation, verification, and activity purge until they start a new session.

Reproduction

  1. Sign in while the stored role is user.
  2. Grant the user the configured Discord admin role.
  3. Request an admin page. The hook refreshes the database role and allows the page.
  4. Submit an admin action in that same session. The action sees locals.user.role === 'user' and rejects it.

Suggested fix

After a successful role refresh, assign the refreshed role to event.locals.user.role, or have the actions use an authoritative role check that reads or refreshes the current database role.

Affected code

  • src/hooks.server.ts
  • src/lib/server/admin.ts
  • all admin actions that call isAdmin(locals.user)
主要言語
TypeScript
スター
0
フォーク
0
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

hacksu/bingo のほかの issue

hacksu/bingo の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。