Newly granted Discord admins can open admin pages but cannot use admin actions
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 72/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
- 領域
- authorization, backend
調査の方向性
まず 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
- Sign in while the stored role is
user. - Grant the user the configured Discord admin role.
- Request an admin page. The hook refreshes the database role and allows the page.
- 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.tssrc/lib/server/admin.ts- all admin actions that call
isAdmin(locals.user)
- 主要言語
- TypeScript
- スター
- 0
- フォーク
- 0
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
hacksu/bingo のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 68/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 78/100
似ている issue
-
bug(cli): hapi doctor inline-media prints a fabricated B:\ helper-script path in packaged installs オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
Crush オープン
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
catppuccin/catppuccin#3125 ·
-
Add a SECURITY.md オープン
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
ElementsProject/cln-application#167 · コメント 1 件 · リアクション 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Quantco/pnpm-licenses#17 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100