Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta
#15 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript

Direzione di ricerca

Leggi prima src/hooks.server.ts e src/lib/server/admin.ts, quindi traccia le azioni amministrative che chiamano isAdmin(locals.user). Riproduci il flusso della sessione descritto nell’issue e verifica che un amministratore appena designato possa completare un’azione nella stessa sessione, mentre un utente non amministratore continui a ricevere il fallimento dell’autorizzazione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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)
Lingua principale
TypeScript
Stelle
0
Fork
0
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di hacksu/bingo

Tutte le issue di hacksu/bingo

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.