heartcombo--simple_form/test
Leonardo Tegon 8c91bd76a5
Don't call `#send` in form object to build file inputs
Before this commit, Simple Form was calling `#send` in the form object
to check whether the resulting object was an attachment. That made the
library open to DOS, information disclousure and execution of unintended
action attacks if a form was built with user input.

```erb
<%= simple_form_for @user do |f| %>
  <%= f.label @user_supplied_string %>
  ...
<% end %>
```

The solution is try to figure out if an input is of type file by
checking for methods present in the most popular Ruby Gems for file
uploads. The current supported Gems are: `activestorage`, `carrierwave`,
`paperclip`, `shrine` and `refile`.

The code is relying on public APIs so it should be fine for now.
It would be nice to have a single API to perform this check, so we'll
suggest one for those libraries.

Co-Authored-By: Felipe Renan <feelipe.renan@gmail.com>
2019-09-27 17:00:00 -03:00
..
action_view_extensions Use different assertions for Rails 5 and 6 2019-09-20 16:32:49 -03:00
components Use custom i18n scope for label required html 2018-03-26 12:44:51 +02:00
form_builder Don't call `#send` in form object to build file inputs 2019-09-27 17:00:00 -03:00
generators Code cleanup 2018-01-08 10:29:03 +02:00
inputs Fix invalid check concerning "required" html attribute on select el 2019-03-28 13:55:08 -07:00
support Don't call `#send` in form object to build file inputs 2019-09-27 17:00:00 -03:00
simple_form_test.rb Add frozen_string_literal in all .rb files 2017-11-27 17:06:18 -08:00
test_helper.rb Don't call `#send` in form object to build file inputs 2019-09-27 17:00:00 -03:00