This PR fixes a security vulnerability in the slot booking API (slots.controller.ts
) by securely configuring the cookie used for user identification (uid
). The update ensures the cookie is no longer exposed to client-side JavaScript or transmitted over insecure HTTP connections.
Before:
res.cookie("uid", uid);
After:
res.cookie("uid", uid, {
httpOnly: true, // Prevents client-side JavaScript access (mitigates XSS)
secure: isProduction, // Ensures cookie is only sent over HTTPS in production
sameSite: 'strict' // Stricter CSRF protection
maxAge: 1000 * 60 * 60 * 24 * 7, // 7 days
});
Secured the uid cookie in the slot booking API by adding httpOnly, secure, and sameSite flags to prevent XSS and CSRF attacks. The cookie now also has a 7-day expiration.
Manohar Kale
@ManoharBari
Thomas Andri Hutomo
@odaysec