Complete the code to import the Express framework safely.
const express = require([1]);To import Express, you must use the module name as a string: "express".
Complete the code to parse JSON request bodies securely using Express.
app.use(express.[1]());Use express.json() middleware to safely parse JSON bodies.
Fix the error in this code to prevent prototype pollution in user input handling.
const safeUser = Object.assign({}, req.body, [1]);Using null as the second argument prevents prototype pollution by not copying prototype properties.
Fill both blanks to safely set HTTP headers to prevent clickjacking and XSS attacks.
app.use(helmet.[1]()); app.use(helmet.[2]());
helmet.frameguard() helps prevent clickjacking by setting frame options.helmet.xssFilter() adds protections against cross-site scripting (XSS).
Fill all three blanks to create a secure password hash using bcrypt.
const bcrypt = require('bcrypt'); const saltRounds = [1]; const password = req.body.password; const hash = await bcrypt.[2](password, [3]);
Use 10 as salt rounds for good security.hashSync hashes the password synchronously.
Pass saltRounds as the salt parameter.