-
Notifications
You must be signed in to change notification settings - Fork 335
Open
Description
There is a major security issue with how the user data is stored and accessed.
First off, in Session.js when a new Session object is created the user is stored in local storage
this.create = function(token, user){
...
$window.localStorage.currentUser = JSON.stringify(user);
...
};
This seems fine as they are themselves, however, in routes.js
if (requireAdmin && !Session.getUser().admin) {
return transition.router.stateService.target("app.dashboard");
}
if (requireVerified && !Session.getUser().verified) {
return transition.router.stateService.target("app.dashboard");
}
if (requireAdmitted && !Session.getUser().status.admitted) {
return transition.router.stateService.target("app.dashboard");
}
We get from Session.getUser which just fetches the user from localStorage. So, if a user just opens the inspector and changes the localStorage object:
> localStorage.getItem("currentUser")
< // the currentUser object
> localStorage.setItem("currentUser", {...,'admin': true,...}) // copied from above
they can gain access to the admin tab
We actually had an attendee of our hackathon note this to us and we are mostly admins already so we didn't recreate exactly before changing this. Either way, I made a change that makes Session.getUser use the existing users/:id route in the api and I still store the user id in local storage, as that seems relatively harmless
YasserDRIF
Metadata
Metadata
Assignees
Labels
No labels