Skip to content

Instantly share code, notes, and snippets.

View vermaarn's full-sized avatar
🐢

Arnav Verma vermaarn

🐢
View GitHub Profile
@scjudd
scjudd / Auth.elm
Last active December 1, 2019 16:36
Authentication in Elm
module Auth exposing (User(..), UserInfo, LoginInfo, loginTask)
import HttpBuilder exposing (..)
import Json.Encode as Encode
import Json.Decode as Decode exposing ((:=))
import Task exposing (Task)
type User
= Authenticated UserInfo
@cerebrl
cerebrl / 1-securing-express.md
Last active May 15, 2025 04:51
Securing ExpressJS

tl;dr

  1. Don't run as root.
  2. For sessions, set httpOnly (and secure to true if running over SSL) when setting cookies.
  3. Use the Helmet for secure headers: https://github.com/evilpacket/helmet
  4. Enable csrf for preventing Cross-Site Request Forgery: http://expressjs.com/api.html#csrf
  5. Don't use the deprecated bodyParser() and only use multipart explicitly. To avoid multiparts vulnerability to 'temp file' bloat, use the defer property and pipe() the multipart upload stream to the intended destination.