All Projects → detroitenglish → Pw Pwnage Cfworker

detroitenglish / Pw Pwnage Cfworker

Licence: mit
Deploy a Cloudflare Worker to sanely score users' new passwords with zxcvbn AND check for matches against haveibeenpwned's 7.8+ billion breached accounts

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Pw Pwnage Cfworker

Haveibeenpwned Zxcvbn Lambda Api
Deploy your own secure API to estimate password strength and check haveibeenpwned for known matches - HTTPS by force, server not required, fire and brimstone sold separately 🔥
Stars: ✭ 57 (-54.4%)
Mutual labels:  serverless, password-strength, haveibeenpwned
Cerberus
A demonstration of a completely stateless and RESTful token-based authorization system using JSON Web Tokens (JWT) and Spring Security.
Stars: ✭ 482 (+285.6%)
Mutual labels:  rest-api, restful-api, authentication
Securelogin
This version won't be maintained!
Stars: ✭ 1,259 (+907.2%)
Mutual labels:  authentication, passwords
Ngx Api Utils
ngx-api-utils is a lean library of utilities and helpers to quickly integrate any HTTP API (REST, Ajax, and any other) with Angular.
Stars: ✭ 92 (-26.4%)
Mutual labels:  rest-api, authentication
Grpcjsontranscoder
A filter which allows a RESTful JSON API client to send requests to .NET web server over HTTP and get proxied to a gRPC service
Stars: ✭ 97 (-22.4%)
Mutual labels:  rest-api, restful-api
Dumb Passwords
Don't let your user be a victim of their own action
Stars: ✭ 77 (-38.4%)
Mutual labels:  passwords, password-strength
Aztro
The Astrology API 💫 Get daily horoscope!
Stars: ✭ 78 (-37.6%)
Mutual labels:  rest-api, restful-api
Appy Backend
A user system to bootstrap your app.
Stars: ✭ 96 (-23.2%)
Mutual labels:  restful-api, authentication
Pwnedpasswordsdll
Open source solution to check prospective AD passwords against previously breached passwords
Stars: ✭ 71 (-43.2%)
Mutual labels:  passwords, haveibeenpwned
Grest
Build REST APIs with Neo4j and Flask, as quickly as possible!
Stars: ✭ 102 (-18.4%)
Mutual labels:  rest-api, restful-api
Cloudflare Workers Webpack Boilerplate
A superbly simple, minimal-config template for building, bundling and deploying Cloudflare Workers with Webpack 🚀
Stars: ✭ 101 (-19.2%)
Mutual labels:  serverless, cloudflare
Restful Api Guidelines
A model set of guidelines for RESTful APIs and Events, created by Zalando
Stars: ✭ 1,397 (+1017.6%)
Mutual labels:  rest-api, restful-api
Restfm
RESTful web services for FileMaker server.
Stars: ✭ 76 (-39.2%)
Mutual labels:  rest-api, restful-api
Graceful
Elegant Python REST toolkit built on top of falcon
Stars: ✭ 73 (-41.6%)
Mutual labels:  rest-api, restful-api
Evolutility Server Node
Model-driven REST or GraphQL backend for CRUD and more, written in Javascript, using Node.js, Express, and PostgreSQL.
Stars: ✭ 84 (-32.8%)
Mutual labels:  rest-api, restful-api
Hexoplusplus
🎁基于CloudFlareWorker的无服务器Hexo后端,目标:解决静态博客所有痛点[文章编辑、图片上传、博主活跃信息统计、博主说说、Twikoo加强版、阅读量统计【尚未完成】]
Stars: ✭ 72 (-42.4%)
Mutual labels:  serverless, cloudflare
Api Restful Con Laravel Guia Definitiva
Repositorio para el código base del curso "API RESTful con Laravel - Guía Definitiva"
Stars: ✭ 95 (-24%)
Mutual labels:  rest-api, restful-api
Automatic Api
A list of software that turns your database into a REST/GraphQL API
Stars: ✭ 1,583 (+1166.4%)
Mutual labels:  rest-api, restful-api
Jokeapi
A REST API that serves uniformly and well formatted jokes in JSON, XML, YAML or plain text format that also offers a great variety of filtering methods
Stars: ✭ 71 (-43.2%)
Mutual labels:  rest-api, restful-api
Pwned Passwords Django
Utilities for working with the Pwned Passwords database from Django.
Stars: ✭ 71 (-43.2%)
Mutual labels:  passwords, password-strength

Enlist a Cloudflare Worker as your Secure Password Scoring and Pwnage Protection API

(Prefer traditional sorcery? See the AWS Lambda version here)

Deploy a private, secure and serverless RESTful endpoint for sanely scoring users' new passwords using Dropbox's zxcvbn library while (k-)anonymously querying Troy Hunt's haveibeenpwned collection of +5.1 billion breached accounts.

API in Action

    Example: handling results with VuetifyJS

Motivation

People seemed to think this concept was neat, and a tiny RESTful API like this is a perfect use case for Cloudflare Workers.

As a bonus, over 90% of pwnedpassword queries are already cached on Cloudflare's edge, making response times spooky fast 👻


Quick Start

  1. Rename example.cloudflare.env to cloudflare.env and edit the configuration as needed.
  2. Install deps with npm install
  3. Launch 🚀 with npm run deploy

Configuration

The following options are configurable via cloudflare.env:

  • ROUTE_PATTERN: Optionally include a route-matching pattern for your worker. See example.cloudflare.env for details on how patterns are parsed and applied (default: undefined)

  • ALLOWED_ORIGIN: Whitelisted origin for Cross Origin Resource Sharing. If not provided, all origins are allowed (default: *)

  • ALLOWED_ORIGIN_PATTERNS: Comma-seperated list of strings to be converted to RegExp patterns for testing the incoming request origin. If the origin matches, it's returned as allowed. If no pattern is matched, CORS falls back to the configured ALLOWED_ORIGIN (default: undefined)

    • Example: "(foo|bar|buzz)\.example\.lol,yet\.another\.example\.omg"
  • CORS_MAXAGE: Value in seconds for the Access-Control-Max-Age CORS header (default: "300")

  • ALWAYS_RETURN_SCORE: Return the zxcvbn score even if the pwnedpasswords match value is > 0. See Response for details (default: undefined, thereby false)

  • CUSTOM_PW_DICT: Comma-seperated list of words/phrases to be included in the zxcvbn strength estimation dictionary. It's a good idea to include e.g. your company or application name here (default: '')

  • RETURN_PW_METADATA: Return the full result of the zxcvbn strength estimation as a metadata response key. Refer to the zxcvbn documentation for details on what that includes (default: undefined, thereby false)

Updating

Update configuration à la changes to cloudflare.env by re-running npm run deploy.

NOTE: For reasons unknown, the Cloudflare Dash may continue to show older scripts after a successful upload. Check the x-worker-last-modified response header to verify that your latest script is up and running.

Request

POST user password input to your route as JSON with field password like so:

// pwned password
{
  "password": "monkey123"
}
// stronger password
{
  "password": "wonderful waffles"
}

Response

Our little worker-bro will reply with an appropriate status code, and JSON body with ok indicating successful scoring and range search, a strength estimation score of 0 through 4 per zxcvbn, and pwned matches, indicating the number times the input appears in the haveibeenpwned database.

// pwned password 'monkey123'
{
    "ok": true,
    "score": 0,
    "pwned": 56491
}
// stronger password 'wonderful waffles'
{
    "ok": true,
    "score": 3,
    "pwned": 0
}

By default, if pwned is greater than 0, then score will always be 0. You can override this behavior by settings "ALWAYS_RETURN_SCORE" to true in cloudflare.env

If RETURN_PW_METADATA is truthy, responses will also include a metadata key with the complete zxcvbn strength estimation result object.

Each response will also contain a x-worker-last-modified header with a timestamp indicating when the script was built and deployed.

Errors

Failure will return JSON to inform you that something's not ok and a message as to why.

{
    "ok": false,
    "message": "It went kaput 💩"
}

Good to Know

Send a GET request to act as a little health-check. Response 204 means you're good to go. Useful for testing CORS configuration 👍

Because Software

Disclaimer

I am not affiliated with Cloudflare, Troy Hunt, Dropbox, haveibeenpwned, good software development in general, or any combination thereof.

Handling user passwords is no laughing matter, so handle them with care and respect.

Just like your own users, assume that I have no idea what I'm doing. This part is important, because I have no idea what I'm doing.

REVIEW THE SOURCE, and use at your own risk 🙈

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].