Coder Social home page Coder Social logo

auth's People

Contributors

davidbanham avatar lyntco avatar nwinch avatar s-taylor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

davidbanham

auth's Issues

Bcrypt cycles ENV var

I think this service should accept an ENV var that will specify how many encryption cycles bcrypt should use.

Basically the problem is that production grade bcrypt takes quite a bit of time and it slows down tests significantly. I want to be able to specify something like ENCRYPT_CYCLES=1 in a test environment and make the auth service to create new records faster.

Also this will allow us to use more cycles in security critical apps

auth failures talk too much

when the signIn fails due to a wrong username or wrong password, the response error actually says either wrong username or wrong password.

this is a security vulnerability. firstly it tells the attacker that they've got the username right. and secondly it allows the attacker to check your system against existing email databases and know who's actually registered in the system.

the failure message should just say 'wrong username or password'. don't even mention 'email'

Adhere to semver

Should auth adhere to semver? So far, there have been some major releases with no change in versioning. As this service is now rolled out for multiple projects, this feels quite important.

It will give us the confidence to update without having to worry about projects breaking.

Handle missing `rev` property on POST /entities/:id

Hey,

authDriver.update(purchaser.customerId, {
    permissions: [{type: "purchaser", entity: purchaser.wholesaler}]
})

Lead to:

Unhandled rejection ReqlRuntimeError: Cannot convert `undefined` with r.expr() in:
r.table("entities").get("9b061055-e06a-460f-a068-370d54416af1")("rev").eq(undefined)
                                                                          ^^^^^^^^^

    at Term.run (/home/user/Documents/auth/node_modules/rethinkdbdash/lib/term.js:43:17)
    at Server.exports.validateEmail.exports.validateRevision.r.table.get.getField.eq.run.then (/home/user/Documents/auth/lib/entity.js:31:4)
    at next (/home/user/Documents/auth/node_modules/restify/lib/server.js:906:30)
    at f (/home/user/Documents/auth/node_modules/restify/node_modules/once/once.js:17:25)
    at Server.exports.validateEmail.query.isEmpty.run.then (/home/user/Documents/auth/lib/entity.js:9:23)
    at next (/home/user/Documents/auth/node_modules/restify/lib/server.js:906:30)
    at f (/home/user/Documents/auth/node_modules/restify/node_modules/once/once.js:17:25)
    at Server.module.exports (/home/user/Documents/auth/routes/middleware/basic_auth.js:8:10)
    at next (/home/user/Documents/auth/node_modules/restify/lib/server.js:906:30)
    at f (/home/user/Documents/auth/node_modules/restify/node_modules/once/once.js:17:25)
    at parseJson (/home/user/Documents/auth/node_modules/restify/lib/plugins/json_body_parser.js:65:9)
    at Server.parseBody (/home/user/Documents/auth/node_modules/restify/lib/plugins/body_parser.js:90:13)
    at next (/home/user/Documents/auth/node_modules/restify/lib/server.js:906:30)
    at f (/home/user/Documents/auth/node_modules/restify/node_modules/once/once.js:17:25)
    at IncomingMessage.done (/home/user/Documents/auth/node_modules/restify/lib/plugins/body_reader.js:121:13)
    at IncomingMessage.g (events.js:260:16)
    at emitNone (events.js:67:13)
    at IncomingMessage.emit (events.js:166:7)
    at endReadableNT (_stream_readable.js:905:12)
    at doNTCallback2 (node.js:441:9)
    at process._tickDomainCallback (node.js:396:17)

I might be doing something wrong, too, but given that the request will then timeout with no 500 returned, it's a bug. ;)

Permissions arrays can have duplicates

Getting stuff like this:

 permissions:
   [ { entity: 'dd36730e-f449-4e24-9854-90905c7757f9',
       type: 'purchaser' },
     { entity: '31ba0784-2e6b-4679-86c1-320802d02fa2',
       type: 'purchase' },
     { entity: '31ba0784-2e6b-4679-86c1-320802d02fa2',
       type: 'purchase' },
     { entity: '31ba0784-2e6b-4679-86c1-320802d02fa2',
       type: 'purchase' },
     { entity: '31ba0784-2e6b-4679-86c1-320802d02fa2',
       type: 'purchase' } ],
  rev: 'fac9c07e-6ee7-4e34-8d3e-4357e24532df',
  updated_at: '2015-12-24T06:13:51.658Z' }

Should be a way to compact the dups.

Further arguments against a separate process (service)

Given my initial argument list:

  • Development overhead dealing with too many services.
  • Development overhead dealing with another model structure and its marshalling.
  • Runtime overhead of making remote requests. Especially text-based HTTP.
  • Runtime dependency on another service that isn't the database.
  • Making a service out of something that I see little benefit in being a service.
  • 2nd system syndrome
  • Different databases and services complicating testing.
  • Different databases and services slowing down testing.

I've elaborated a few:

  1. SOA can be argued for when one's dealing with possibilities of graceful degradation. Majority of systems (incl. Ordermentum) depend on AA (authentication+authorization) to the extent that they can't run without it. No resilience advantages with separation.
  2. Overhead of change management. Services can't be versioned nor backtracked from an upgrade as easily libraries. Having two services that need to be deployed at the same time is not SOA. It's premature extraction. Adding backwards compatibility for asynchronous upgrades is a lot of work better spent elsewhere. Note: "changes" include the data and its meaning to the system in the service and its database, not only improvements to the former's code. Related anecdote: I have an app that people have open in their tabs for weeks. It's no duck soup to ensure people's data doesn't get lost over backend upgrades. ;-)
  3. AFAI've understood, there's a possibility of requesting an array of sorts from the service to make decisions on. That's tighter coupling between the permissions structure and the app than a mere boolean-returning request. How does the code related to making boolean requests, let alone more complex ones, get to the app? From a shared library? Where's then the benefit of an intermediary HTTP layer over bundling everything to said library?
  4. From the fact that a library requires its own database, it does not follow that the right or sustainable solution is to have another service present its contents. The new database, by extension of its front-end, becomes a dependency of the system. Adding an intermediary service doesn't reduce that.
  5. There are better approaches to extracting out auxiliary services than having them depend on shared (permission) semantics. E.g. tokens. See Amazon S3's implementation for one approach.

Create a library, have it return an instance of Auth given database connection details and call it a day. ;-)

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.