News for hackers. Stuff that matters.
Re:IOS 6 injecting should_group_accessibility_children to PO... by jmcnevin on Wednesday October 03, 2012 @10:14AM (#4607470)
This (mass-assignment) is fairly standard Rails-fu, so its fair to assume that this could affect a lot of apps out there.
Re:IOS 6 injecting should_group_accessibility_children to PO... by jcromartie on Wednesday October 03, 2012 @10:34AM (#4607561)
Correct me if I'm wrong, but isn't it pretty much always a bad idea to do it blindly, and the defaults are considered a security problem by the Rails project itself?

http://guides.rubyonrails.org/security.html#mass-assignment

Re:IOS 6 injecting should_group_accessibility_children to PO... by ubernostrum on Wednesday October 03, 2012 @10:35AM (#4607571)
Hey now, don't go bringing facts into this thread -- I've already been downvoted hard for, apparently, not knowing what I'm talking about when saying that this is a security issue. So obviously the Rails team don't know what they're talking about either.
Re:IOS 6 injecting should_group_accessibility_children to PO... by bryanlarsen on Wednesday October 03, 2012 @10:44AM (#4607621)
He just linked to an article that explains how to do it safely.

update to reply because of downvotes:

1) butterfly knives are very useful tools

2) mass assignment can be used safely out of the box in rails post v3.2.3. To use it, you have to explicitly add parameters to the whitelist or disable the whitelist. The article is there to explain why disabling the whitelist is a bad idea.

Re:IOS 6 injecting should_group_accessibility_children to PO... by jcromartie on Wednesday October 03, 2012 @11:02AM (#4607729)
Sure, just like butterfly knives are safe because you can find some safety tips online.

Edit to reply to edits: Mass assignment is still dangerous "out of the box" since you have to switch on the whitelist behavior by calling attr_accessible on your model classes. In the security guide, the older, more dangerous, attr_protected is introduced first.

I think every rails dev should be familiar with the security guide, but more than that I wish that security was the default. While anybody is free to make an app as insecure as they wish, it should be the exception rather than the default.

Re:IOS 6 injecting should_group_accessibility_children to PO... by bryanlarsen on Wednesday October 03, 2012 @11:24AM (#4607861)
You're talking about the old behaviour. New rails apps have config.active_record.whitelist_attributes set. That means that models without attr_acessible statements will throw an error if mass-assignment is attempted. IOW, they've done exactly what you asked for. They should have done it years ago, but they did the right thing after it blew up in their face.
Re:IOS 6 injecting should_group_accessibility_children to PO... by ubernostrum on Wednesday October 03, 2012 @10:30AM (#4607541)
You say "standard Rails-fu", I say security hole. Let's call the whole thing off?
Re:IOS 6 injecting should_group_accessibility_children to PO... by tomjen3 on Wednesday October 03, 2012 @10:31AM (#4607547)
No because you don't know what you are talking about.
Re:IOS 6 injecting should_group_accessibility_children to PO... by ubernostrum on Wednesday October 03, 2012 @10:34AM (#4607563)
I see. So that whole big mass-assignment security issue that exposed GitHub a while back -- that just didn't happen? Writing code in this style is perfectly safe?
Re:IOS 6 injecting should_group_accessibility_children to PO... by bryanlarsen on Wednesday October 03, 2012 @10:46AM (#4607635)
Writing code in this style is perfectly safe if you do it correctly. GitHub didn't, so the defaults were changed to make it harder to do it incorrectly.

UPDATE: editing to reply since hn won't let me reply directly because the thread is to deep, yet I'm getting downvotes

It's not a tautology. Some things are safe even if you do them wrong. Some things are unsafe no matter how you do them.

Rails changed the defaults so that now you have to deliberately decide to do things unsafely. Rails before 3.2.3 fails un-safe in this scenario, but later versions fail safe. Rails 4 uses a different solution that's even harder to screw up.

Re:IOS 6 injecting should_group_accessibility_children to PO... by jerf on Wednesday October 03, 2012 @10:51AM (#4607662)
"Writing code in this style is perfectly safe if you do it correctly."

That's a tautology.

In general you can't count on code being written "correctly", so this isn't a defense. It is better to have systems that degrade gracefully in the face of humans and their idiosyncrasies, rather than those that fail-unsafe, because you can't build your security system on the assumption that your code will be written by superhumans.

Re:IOS 6 injecting should_group_accessibility_children to PO... by tomjen3 on Wednesday October 03, 2012 @11:12AM (#4607792)
Should all database use be frowned upon because injections are possible if you don't use them correctly?
Re:IOS 6 injecting should_group_accessibility_children to PO... by Pewpewarrows on Wednesday October 03, 2012 @11:26AM (#4607868)
I hope you realize that this is the identical argument PHP developers made whenever someone brought up how insecure the base language, libraries, and configuration were.

Users of a framework should have to go out of their way to make themselves insecure. It shouldn't be insecure by default.

Re:IOS 6 injecting should_group_accessibility_children to PO... by untog on Wednesday October 03, 2012 @10:47AM (#4607640)
This isn't a Rails issue, it can affect any web framework. And it's a security flaw every single time mass assignment is used without whitelisting.
Re:IOS 6 injecting should_group_accessibility_children to PO... by masklinn on Wednesday October 03, 2012 @11:00AM (#4607722)
> This isn't a Rails issue, it can affect any web framework.

Not exactly. Most web frameworks don't have a built-in "mass assignment", let alone enable it by default.

Re:IOS 6 injecting should_group_accessibility_children to PO... by untog on Wednesday October 03, 2012 @11:14AM (#4607812)
Well, true. I wonder how many people pass their models straight into a schema-less database without any checks?