Skip to content

Comment on How github was hacked

Comments

I just threw together a quick gem that will ensure active_record model attributes are protected from mass-assignment unless explicitly declared as mass-assignable.

Granted, this as default will break an app that does not have the correct attributes declared as mass-assignable, but the alternative is a vulnerable app.

https://github.com/stevegraham/default_whitelist

Only for relatively new versions of Rails. The oldest version of Rails including this patch was released January 20, 2012.

Note that that commit is only a comment -- the addition of "whitelist_attributes" presumably is older.

It was added in Rails 3.1.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.