Mass assignment (ARCH3129)
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
Key typescript.security.mass-assignment · Severity warning · Category security · CWE CWE-915
Passing the whole request body straight into an ORM create/update call lets attackers set protected fields such as isAdmin. Select only allowed fields.
Incorrect
Section titled “Incorrect”app.post("/users", async (req, res) => { const user = await User.create(req.body); res.json(user);});Correct
Section titled “Correct”app.post("/users", async (req, res) => { const { name, email, password } = req.body; const user = await User.create({ name, email, password }); res.json(user);});Never pass the raw request body into ORM writes; pick fields through an explicit allowlist.