Skip to content

Commit

Permalink
Merge pull request #1260 from Datawheel/core-user-security
Browse files Browse the repository at this point in the history
[core] removes password and salt from isAuthenticated response
  • Loading branch information
jhmullen authored Sep 30, 2021
2 parents 76c7574 + b9bdee1 commit 782e266
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/core/src/auth/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@ module.exports = function(app) {
})
);

app.get("/auth/isAuthenticated", isAuthenticated, (req, res) => res.json({...req.user, authenticated: true}));
app.get("/auth/isAuthenticated", isAuthenticated, (req, res) => {
const sanitizedUser = {...req.user, authenticated: true};
delete sanitizedUser.password;
delete sanitizedUser.salt;
return res.json(sanitizedUser);
});

app.get("/auth/logout", (req, res) => {
req.logout();
Expand Down

0 comments on commit 782e266

Please sign in to comment.