Skip to content

Commit

Permalink
[BUG] Fixed mass_assignment vuln (#566)
Browse files Browse the repository at this point in the history
Fixed mass_assignment vuln

Co-authored-by: dastaj <78434825+dastaj@users.noreply.github.com>
  • Loading branch information
timothycarambat and dastaj authored Jan 10, 2024
1 parent 259079a commit 8cd3a92
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions server/endpoints/invite.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function inviteEndpoints(app) {
app.post("/invite/:code", async (request, response) => {
try {
const { code } = request.params;
const userParams = reqBody(request);
const { username, password } = reqBody(request);
const invite = await Invite.get({ code });
if (!invite || invite.status !== "pending") {
response
Expand All @@ -42,7 +42,11 @@ function inviteEndpoints(app) {
return;
}

const { user, error } = await User.create(userParams);
const { user, error } = await User.create(({
username,
password,
role: "default",
}));
if (!user) {
console.error("Accepting invite:", error);
response
Expand Down

0 comments on commit 8cd3a92

Please # to comment.