Giter Club home page Giter Club logo

couch_email_auth's People

Contributors

klaustrainer avatar robertkowalski avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

robertkowalski

couch_email_auth's Issues

Don't require configuring a redirect location

Currently, the GET request fails with an error if the redirectLocation configuration is not specified. If no redirectLocation is specified, the server should respond with status code 200 and return the response body from the request to CouchDB's /_session endpoint.

Doesn't allow to be authenticated in two different browsers at the same time

Currently, any existing CouchDB authentication cookie is invalidated as soon as a new authentication token is generated (also see issue #38). Aside from the problem that is described in issue #38, this prevents users from being authenticated in two different browsers at the same time (i.e., they have to re-authenticate every time they switch browsers). As frequently using the same web site with different browsers is a common use-case these days (think switching between different devices), this is a serious design flaw.

Docs

At some point we should add docs

Denial-of-service vulnerability

If Bob knows Alice's email address, he could invalidate Alice's authentication cookie by sending an HTTP POST-request that has Alice's email address as email parameter value.

The problem is that even when Bob is only pretending to sign in as Alice, by just sending a POST-request containing Alice's email address as email parameter value, any authentication cookie that may be in use by Alice is invalidated as well.

TODOs (in this order):

  • test 1: reproduce the issue
  • test 2: proof that the issue is fixed (it must be failing at this point)
  • bugfix: test 1 must fail, and test 2 must pass
  • cleanup: remove test 1 (which is now obsolete)

Use Hapi.js

Hapi helps alot writing maintanable code and takes care of alot of things we are currently missing like protection against aborted requests or client request timeouts

http://hapijs.com/api

Rename to couch-email-auth

It is quite unconventional in JavaScript-land to have underscored file and module names. We should therefore change the project and module name to couch-email-auth (and file names accordingly), in order to not look too strange.

Require providing the redirect location as request parameter

As an application developer, I'd like to provide the redirect location as request parameter, in order to be able to use couch_email_auth with multiple applications.

For security reasons, this should come along with a whitelist of domains that are allowed in redirect locations.

This implies getting rid of the redirectLocation configuration option.

make transport mechanism pluggable

Let's provide support for email by default, but if I want to send SMS I should be able to plug that functionality in. This might conflict with some parts of #23

Redirect after successful authentication

Instead of sending a response with status code 200, the server should send status code 302 and set the Location header to value that is retrieved from the configuration.

TODO:

  • introduce correspondent configuration (e.g. redirectLocation)
  • change the HTTP response accordingly

Optionally include `AuthSession` cookie value with response to `GET` request

If browsers don't accept third-party cookies and requests to the couch_email_auth endpoint are cross-origin, clients should still be possible to set the AuthSession cookie themselves.

We should optionally add the respective AuthSession query parameter to the redirectUrl in the response after following the sign-in link, so that clients can set the AuthSession cookie themselves.

Abort at start time if an essential requirement is missing

If an essential requirement is missing, the service should stop immediately (i.e., at start time) rather than causing problems later. That is, we should provide sensible defaults where possible and have as few requirements as possible. However, there are some prerequisites that we can't provide, and that users have to make sure are available (e.g. the configuration of the address in the "From" header in the email).

TODO: Define which requirements are essential.

Blog post

write a blogpost for the couchdb news / blog

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.