openshift-homeroom / workshop-spawner

Multi user spawner for workshop terminals or dashboard.
Apache License 2.0
18 stars 20 forks source link

When using /restart for anonymous-user config, redirecting to page not found. #1

Closed GrahamDumpleton closed 5 years ago

GrahamDumpleton commented 5 years ago

In some cases when hitting the URL /restart to force a restart, the proxy in the dashboard instance is redirecting to /user/<username>/undefined.

GrahamDumpleton commented 5 years ago

After some extra additions to validate session and return error message, new error is now from:

            if (req.session.handshakes[state] === undefined) {
                return res.status(400).json('Invalid session');
            }

So maybe shouldn't clear the state from handshakes cache immediately.

That is, in:

            var next_url = req.session.handshakes[state];
            delete req.session.handshakes[state];

Find another way to expire them if necessary.

Possibly also related to code:

        if (Object.keys(req.session.handshakes).length > 10) {
            // If the number of oustanding auth handshakes gets to be
            // too many, something fishy going on so clear them all and
            // start over again.

            req.session.handshakes = {}
        }
GrahamDumpleton commented 5 years ago

Increased number of states allow before clearing. Also redirect back to main page if don't know about session state. This could be an issue if request was against a sub URL, so may still have to change it back to an error.

GrahamDumpleton commented 5 years ago

Not seen this again after changes, so closing.