Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rails 4.x Mass-Assignment Errors #488

Closed
phene opened this issue May 8, 2014 · 6 comments
Closed

Rails 4.x Mass-Assignment Errors #488

phene opened this issue May 8, 2014 · 6 comments

Comments

@phene
Copy link
Contributor

phene commented May 8, 2014

I'm getting mass-assignment errors despite using the configuration option active_record.whitelist_attributes = true

https://github.com/presidentbeef/brakeman/blob/master/lib/brakeman/checks/base_check.rb#L180

@presidentbeef
Copy link
Owner

Sorry, can you be more specific about what warnings you are seeing? If Rails 4 is in use, then mass assignment is not the same as in Rails 2/3 so Brakeman doesn't warn about the same kinds of issues.

@presidentbeef
Copy link
Owner

Are you saying you are using the protected_attributes gem in Rails 4 and setting active_record.whitelist_attributes = true?

@phene
Copy link
Contributor Author

phene commented May 8, 2014

@presidentbeef that's exactly the case. I've patched my local copy to use this logic:

    elsif version_between?("4.0.0", "4.9.9") && (!tracker.config[:gems][:protected_attributes] || (tracker.config[:rails][:active_record] &&
          tracker.config[:rails][:active_record][:whitelist_attributes] == Sexp.new(:true)))
      @mass_assign_disabled = true
    else

@presidentbeef
Copy link
Owner

If you want to send that as a pull request I'd be happy to merge.

@phene
Copy link
Contributor Author

phene commented May 9, 2014

Here you go! #491

@presidentbeef
Copy link
Owner

Fixed with #491

Repository owner locked and limited conversation to collaborators Feb 16, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants