Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

mosspilot/nodejs-auth

Open more actions menu

Repository files navigation

Sample Node.js Auth Application

This is a sample application with an aim at implementing a simple node.js

Running the application for local development

  1. Clone this repository
  2. Install MongoDB as a local instance
  3. Generate a self-signed x509 certificate and private key and place them in the sslcert directory
  4. From the project directory, install npm dependencies npm install
  5. Run the application in "dev mode" using nodemon
    • Install nodemon globally npm install -g nodemon
    • Linux based: npm run devmode
    • Windows:
      • set DEBUG env variable set DEBUG=jmoss-auth-exercise:*
      • run the application using nodemon nodemon start

Security

The following section is an ongoing discussion of security related features or considerations.

Implemented Basic Security Features

  • Web server only supports HTTPS
    • Potential feature: ngix may be more efficient
  • Utilizes the "helmet" middleware for sane header defaults and reduced attack surface for XSS / CSRF / Cookie abuse, etc
  • Utilizes passport-local-mongoose middleware to store passwords in hashed and salted format
  • Utilizes espress-session to set cookie attributes

Hardening Considerations / TODO's

The following is an ongoing list of items to consider for hardening into a production environment. The list is considered in progress and will be updated as new features are developed.

Certificate management

  • Use an x509 certificate from a certificate authority
    • TODO: Support using forward secrecy (DHE/ECDHE)
  • Store certificates securely in a keychain / OS

Database

  • Only support encrypted connections with Mongo DB
  • Encrypt the mongo db instance
    • Note: passwords are already salted and hashed

Local login page

  • TODO: Input validation / testing / prevention of injection attacks
  • TODO: Testing side channel attack on user account discovery
  • TODO: Limited number of login attempts
  • TODO: DDOS mitigation

Other TODOs / Nice to haves:

  • Maybe Revisit serialization approaches for local / github
  • Bring in other profile data to the account collection

About

Hacking together a simple nodejs auth server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
Morty Proxy This is a proxified and sanitized view of the page, visit original site.