google / google/CodeCity

Login loop in code editor when no $.user object for given ID

Aperta
#441 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
bug core
Lingua principale
JavaScript
Stelle
198
Fork
38
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

A weird edge case which causes an unexpected login loop. To reproduce:

* Start a fresh database from the current core (as of 9a58103).
* [Open a code editor for `$.thing.name`](http://localhost:8080/code/?$.thing.name) or any other unimportant property.
* Use your browser URL bar padlock menu to delete the `ID` cookie, if present.
* Make a trivial change to the property being edited (e.g. "The thing prototype").
* Click "Save".
* Note that a login window opens. Click "Sign In".
* Note that the code editor now has a butter bar saying "User not logged in", and the login window has reopened.

The cause is that, although the login server has successfully set the `ID` cookie, there is no `$.user` object corresponding to this ID in `$.userDatabase.byMd5`, because at the moment _user objects are only created by the telnet server_.

This has the effect of making it impossible to have code-only Code City instances. Proposed fix:

* [ ] Extract login and associated `$.user`-creation code to a general-purpose login function shared by both the telnet and http servers.
* [ ] Ensure that any save which results in the ownership of an object (e.g., because it creates a `Function` object) is enough to prevent the owning `$.user` object from being `.destroy`ed. We don't want a user who's never "created a character" being assigned a band-new $.user object for every save!

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia tracciando il flusso di login nei server telnet e HTTP, quindi esamina come viene popolato $.userDatabase.byMd5 e come vengono distrutti gli oggetti utente. Riproduci il flusso di salvataggio con un cookie dell'ID mancante nell'editor di codice. Il lavoro è completato quando le istanze code-only possono salvare senza un ciclo di login e la proprietà dell'utente non crea oggetti $.user usa e getta a ogni salvataggio.

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

Valutazione

Stack tecnologico
javascript
Ambito
authentication, backend
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
30/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.