3 ms·
This should be exhibit number one why you should always favor open source libraries rather than writing your own plumbing functionality, especially around authe
by mooreds 9y ago
This should be exhibit number one why you should always favor open source libraries rather than writing your own plumbing functionality, especially around authentication and authorization. The onus should be on the developer to explain why the open source library isn't a fit, rather than defaulting to 'roll your own'.
The edge cases discussed don't pop up that often unless you have lots of folks using your software or are really diligent about fuzzing and testing edge cases. If you roll your own, say, username system, you probably aren't going to fall into either of those two cases. Which means you're vulnerable.
- devmunchies 9y agobut then again, open source does not mean its good software, obviously. there should be some way quickly check if a library meets security best-practices. like a some sort of "vetted software" reference
- always_good 9y agoAlso, using a 3rd party library for something as important as authentication because you don't know how it works doesn't sound much better nor secure. Like storing sensitive data in the authn's session system because you don't understand encryption vs signing nor how to find out -- maybe it's time to just sit down and credentialize as a craftsman. The authn/z systems I've used that were the biggest headaches in my life were kitchen sink frameworks trying to generalize over everyone's creature features, and they were often tied to a company/community culture of not-gonna-touch-it that only hurt users and security.
- mooreds 9y agoI think you should absolutely understand any third party systems/libraries you use, especially when it is as important as authentication. Using a third party component doesn't free you up to be lazy or to use it incorrectly. My comment was stating that you should default to these types of libraries and only roll your own if you can't do what you need to, simply because they're more likely to handle edge cases that can have serious implications. Do you do unicode normalization on your usernames? I freely admin that I don't, and wasn't aware it was needed until I read this post.
- rch 9y agoActually, the first step in a lot of Django projects is to rip out the default config and ditch usernames in favor of email addresses for login, and attach some form of unique internal id to the "account" (or whatever billing, social IDs, etc. might be associated with).
- yjftsjthsd-h 9y agoShould that be included by default, then?
- NoGravitas 9y agoYes, but it would make upgrades to the first version that uses it a major flag day. Which limits when it could be rolled out.
- yjftsjthsd-h 9y agoOff by default so no changes for existing users?
- rch 9y agoProbably, but there's disagreement about how to do so, and it's not hard to make the changes anyway.
- pc86 9y agoIf you don't fall into any of the affected cases, what exactly is the vulnerability? The security aspect I get, and happen to agree with 100%, but if I roll my own sub-optimal username classification system for my CRUD app that gets 80 users in its entire lifetime, so what? I will have certainly learned a lot more than just typical `npm install usernames`.