Security Lessons Learned From The Diaspora Launch
kalzumeus.com
Security Lessons Learned From The Diaspora Launch
1–10 of 142 posts
Re: Security Lessons Learned From The Diaspora Launch
#2If you open source something, unless it's perfectly written, wouldn't the hacking potential be... near 100%? If everyone can see how you do everything it seems like even a minor slip up will potentially surrender your site.
Could someone explain this (I'm probably missing a piece of the puzzle I can't place)?
Re: Security Lessons Learned From The Diaspora Launch
#3First, mass assignment.
The answer to mass-assignment bugs is "attr_accessible". Accessible attributes can be set via update/build/new; nothing else can. Every Rails AR model should have an "attr_accessible" line in it.
I've met smart dev teams working under the misconception that attr_accessible means "these are the attributes that can be changed based on user requests", and so virtually everything is made accessible. No! If something's not attr_accessible, you just set it manually (user.foo = params[:user][:foo]). It's not painful and the extra line expresses something important ("this is a sensitive attribute"). Attributes are inaccessible until they prove themselves mass-assignment-worthy.
Second, the string interpolation in the regex.
Real quick: don't ever let users interpolate arbitrary strings into regular expressions. Regular expression libraries are terribly complicated and not very well tested. To illustrate (but not fully explain) the danger here, run this line of code:
ruby -e "'=XX===============================' =~
/X(.+)+X/"
There are worse things that can happen to you with regex injection than a trivial DoS, but that should be enough motivation.Oh, one more thing: I appreciate Patrick's take on systems failures breaking Rails apps before underlying crypto flaws will, but even if they had protected their keys, their crypto wouldn't have worked. Don't build things that require crypto. You aren't going to get it right.
Re: Security Lessons Learned From The Diaspora Launch
#4I've always wondered about this (not being a code-monkey-ninja-wizard, myself)... If you open source something, unless it's perfectly written, wouldn't the hacking potential be... near 100%? If everyone can see how you do everything it seems like even a minor slip up will potentially surrender your site. Could someone explain this (I'm probably missing a piece of the puzzle I can't place)?
Re: Security Lessons Learned From The Diaspora Launch
#5Re: Security Lessons Learned From The Diaspora Launch
#6I've always wondered about this (not being a code-monkey-ninja-wizard, myself)... If you open source something, unless it's perfectly written, wouldn't the hacking potential be... near 100%? If everyone can see how you do everything it seems like even a minor slip up will potentially surrender your site. Could someone explain this (I'm probably missing a piece of the puzzle I can't place)?
Now, if you're a highly anticipated project and you're making errors covered in every Security 101 article which happen to be very visible, then OSSing your code makes it highly likely that people will see those, for good and ill. What scares me for Diaspora's future isn't those errors -- it is the part of the iceberg below the waterline. I mean, if you're steaming at full speed towards a gigantic "I'M GONNA RIP UP YOUR BOAT!" sign, there is probably something underwater and I doubt any qualified security guy (I am so not one) will donate you a few tens of thousands of dollars to tell you how screwed you are right now.
Re: Security Lessons Learned From The Diaspora Launch
#7I've always wondered about this (not being a code-monkey-ninja-wizard, myself)... If you open source something, unless it's perfectly written, wouldn't the hacking potential be... near 100%? If everyone can see how you do everything it seems like even a minor slip up will potentially surrender your site. Could someone explain this (I'm probably missing a piece of the puzzle I can't place)?
That said, MPWILGSIANSE (my password is LadyGaga so I am no security expert)
Re: Security Lessons Learned From The Diaspora Launch
#8I've always wondered about this (not being a code-monkey-ninja-wizard, myself)... If you open source something, unless it's perfectly written, wouldn't the hacking potential be... near 100%? If everyone can see how you do everything it seems like even a minor slip up will potentially surrender your site. Could someone explain this (I'm probably missing a piece of the puzzle I can't place)?
Re: Security Lessons Learned From The Diaspora Launch
#9Not to be totally nitpicky but if they're using any recent version of Rails (I haven't looked at the source yet), the DESTROY action doesn't respond to GET by default. That doesn't change the fact that they don't scope deletes to the logged-in user's assets.
Re: Security Lessons Learned From The Diaspora Launch
#10I can probably go all night on this, but a couple things from a quick read of this (very good) post: First, mass assignment. The answer to mass-assignment bugs is "attr_accessible". Accessible attributes can be set via update/build/new; nothing else can. Every Rails AR model should have an "attr_accessible" line in it. I've met smart dev teams working under the misconception that attr_accessible means "these are the…
I'd do you one better: use an initializer to monkeypatch ActiveRecord::Base and fire "attr_accessible nil", which will cause mass assignment to fail on any object you create from a class which doesn't make the assignment explicit.